25 if(expr_type.
id()==ID_array)
27 std::size_t op_width=width/expr.
operands().size();
34 if(tmp.size()!=op_width)
37 error() <<
"convert_constant: unexpected operand width" <<
eom;
41 for(std::size_t j=0; j<op_width; j++)
49 else if(expr_type.
id()==ID_string)
55 else if(expr_type.
id()==ID_range)
63 for(std::size_t i=0; i<width; i++)
71 else if(expr_type.
id()==ID_unsignedbv ||
72 expr_type.
id()==ID_signedbv ||
73 expr_type.
id()==ID_bv ||
74 expr_type.
id()==ID_fixedbv ||
75 expr_type.
id()==ID_floatbv ||
76 expr_type.
id()==ID_c_enum ||
77 expr_type.
id()==ID_c_enum_tag ||
78 expr_type.
id()==ID_c_bool ||
79 expr_type.
id()==ID_c_bit_field ||
80 expr_type.
id()==ID_incomplete_c_enum)
84 for(std::size_t i=0; i<width; i++)
92 else if(expr_type.
id()==ID_enumeration)
97 for(std::size_t i=0; i<elements.size(); i++)
98 if(elements[i].
id()==value)
101 else if(expr_type.
id()==ID_verilog_signedbv ||
102 expr_type.
id()==ID_verilog_unsignedbv)
106 if(
binary.size()*2!=width)
109 error() <<
"wrong value length in constant: " 114 for(std::size_t i=0; i<
binary.size(); i++)
143 error() <<
"unknown character in Verilog constant:" The type of an expression, extends irept.
const std::string & id2string(const irep_idt &d)
const mp_integer string2integer(const std::string &n, unsigned base)
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
std::vector< irept > subt
boolbv_widtht boolbv_width
const irep_idt & get_value() const
typet & type()
Return the type of the expression.
virtual const bvt & convert_bv(const exprt &expr, const optionalt< std::size_t > expected_width=nullopt)
A constant literal expression.
virtual bvt convert_constant(const constant_exprt &expr)
const irep_idt & id() const
const enumeration_typet & to_enumeration_type(const typet &type)
Cast a typet to a enumeration_typet.
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
source_locationt source_location
void conversion_failed(const exprt &expr, bvt &bv)
numbering< irep_idt > string_numbering
#define forall_operands(it, expr)
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
const irept::subt & elements() const
literalt const_literal(bool value)
static std::string binary(const constant_exprt &src)
const std::string integer2binary(const mp_integer &n, std::size_t width)
const range_typet & to_range_type(const typet &type)
Cast a typet to a range_typet.
std::vector< literalt > bvt
bvt build_constant(const mp_integer &i, std::size_t width)
mp_integer get_from() const