diff --git a/tgt-vhdl/vhdl_syntax.cc b/tgt-vhdl/vhdl_syntax.cc index 5b997445a..12e9d4afb 100644 --- a/tgt-vhdl/vhdl_syntax.cc +++ b/tgt-vhdl/vhdl_syntax.cc @@ -435,3 +435,9 @@ void vhdl_const_bit::emit(std::ofstream &of, int level) const { of << "'" << bit_ << "'"; } + +void vhdl_const_int::emit(std::ofstream &of, int level) const +{ + of << value_; +} + diff --git a/tgt-vhdl/vhdl_syntax.hh b/tgt-vhdl/vhdl_syntax.hh index c15fdbdfe..a027221d3 100644 --- a/tgt-vhdl/vhdl_syntax.hh +++ b/tgt-vhdl/vhdl_syntax.hh @@ -82,6 +82,15 @@ private: char bit_; }; +class vhdl_const_int : public vhdl_expr { +public: + vhdl_const_int(int64_t value) + : vhdl_expr(vhdl_type::integer()), value_(value) {} + void emit(std::ofstream &of, int level) const; +private: + int64_t value_; +}; + class vhdl_expr_list : public vhdl_element { public: ~vhdl_expr_list(); diff --git a/tgt-vhdl/vhdl_type.cc b/tgt-vhdl/vhdl_type.cc index 1896f113f..060961178 100644 --- a/tgt-vhdl/vhdl_type.cc +++ b/tgt-vhdl/vhdl_type.cc @@ -38,6 +38,11 @@ vhdl_type *vhdl_type::line() return new vhdl_type(VHDL_TYPE_LINE); } +vhdl_type *vhdl_type::integer() +{ + return new vhdl_type(VHDL_TYPE_INTEGER); +} + std::string vhdl_type::get_string() const { switch (name_) { @@ -56,6 +61,8 @@ std::string vhdl_type::get_string() const return std::string("Line"); case VHDL_TYPE_FILE: return std::string("File"); + case VHDL_TYPE_INTEGER: + return std::string("Integer"); default: return std::string("BadType"); } diff --git a/tgt-vhdl/vhdl_type.hh b/tgt-vhdl/vhdl_type.hh index 2bc28ad1f..574de501b 100644 --- a/tgt-vhdl/vhdl_type.hh +++ b/tgt-vhdl/vhdl_type.hh @@ -28,7 +28,8 @@ enum vhdl_type_name_t { VHDL_TYPE_STD_LOGIC_VECTOR, VHDL_TYPE_STRING, VHDL_TYPE_LINE, - VHDL_TYPE_FILE + VHDL_TYPE_FILE, + VHDL_TYPE_INTEGER, }; /* @@ -52,6 +53,7 @@ public: static vhdl_type *string(); static vhdl_type *line(); static vhdl_type *std_logic_vector(int msb, int lsb); + static vhdl_type *integer(); protected: vhdl_type_name_t name_; int msb_, lsb_;