Add constant integers
This commit is contained in:
parent
d762253f74
commit
120b5dc80e
|
|
@ -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_;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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_;
|
||||
|
|
|
|||
Loading…
Reference in New Issue