Convert constant bits to integers
This commit is contained in:
parent
c86377790f
commit
9916686c24
|
|
@ -662,6 +662,14 @@ void vhdl_const_bits::emit(std::ostream &of, int level) const
|
||||||
of << (qualified_ ? "\")" : "\"");
|
of << (qualified_ ? "\")" : "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vhdl_expr *vhdl_const_bit::cast(const vhdl_type *to)
|
||||||
|
{
|
||||||
|
if (to->get_name() == VHDL_TYPE_INTEGER)
|
||||||
|
return new vhdl_const_int(bit_ == '1' ? 1 : 0);
|
||||||
|
else
|
||||||
|
return vhdl_expr::cast(to);
|
||||||
|
}
|
||||||
|
|
||||||
void vhdl_const_bit::emit(std::ostream &of, int level) const
|
void vhdl_const_bit::emit(std::ostream &of, int level) const
|
||||||
{
|
{
|
||||||
of << "'" << vl_to_vhdl_bit(bit_) << "'";
|
of << "'" << vl_to_vhdl_bit(bit_) << "'";
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,7 @@ public:
|
||||||
vhdl_const_bit(char bit)
|
vhdl_const_bit(char bit)
|
||||||
: vhdl_expr(vhdl_type::std_logic(), true), bit_(bit) {}
|
: vhdl_expr(vhdl_type::std_logic(), true), bit_(bit) {}
|
||||||
void emit(std::ostream &of, int level) const;
|
void emit(std::ostream &of, int level) const;
|
||||||
|
vhdl_expr *cast(const vhdl_type *to);
|
||||||
private:
|
private:
|
||||||
char bit_;
|
char bit_;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue