From 7c5b0f737ca2ea291e384f3b1299f19e17ed4a91 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 17 Jul 2008 11:59:02 +0100 Subject: [PATCH] Class for VHDL type declarations --- tgt-vhdl/vhdl_syntax.cc | 8 ++++++++ tgt-vhdl/vhdl_syntax.hh | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tgt-vhdl/vhdl_syntax.cc b/tgt-vhdl/vhdl_syntax.cc index af65ee0a1..1c4c1a82b 100644 --- a/tgt-vhdl/vhdl_syntax.cc +++ b/tgt-vhdl/vhdl_syntax.cc @@ -380,6 +380,14 @@ void vhdl_signal_decl::emit(std::ostream &of, int level) const emit_comment(of, level, true); } +void vhdl_type_decl::emit(std::ofstream &of, int level) const +{ + of << "type " << name_ << " is "; + type_->emit(of, level); + of << ";"; + emit_comment(of, level, true); +} + vhdl_expr::~vhdl_expr() { if (type_ != NULL) diff --git a/tgt-vhdl/vhdl_syntax.hh b/tgt-vhdl/vhdl_syntax.hh index 5fa684e21..d0d7f5ff3 100644 --- a/tgt-vhdl/vhdl_syntax.hh +++ b/tgt-vhdl/vhdl_syntax.hh @@ -462,6 +462,14 @@ private: }; +class vhdl_type_decl : public vhdl_decl { +public: + vhdl_type_decl(const char *name, vhdl_type *base) + : vhdl_decl(name, base) {} + void emit(std::ofstream &of, int level) const; +}; + + /* * A variable declaration inside a process (although this isn't * enforced here).