Go to the documentation of this file.
25 if(expr_type.
id()==ID_array)
27 std::size_t op_width=width/expr.
operands().size();
35 tmp.size() == op_width,
36 "convert_constant: unexpected operand width",
39 for(std::size_t j=0; j<op_width; j++)
47 else if(expr_type.
id()==ID_string)
53 else if(expr_type.
id()==ID_range)
61 for(std::size_t i=0; i<width; i++)
70 expr_type.
id() == ID_unsignedbv || expr_type.
id() == ID_signedbv ||
71 expr_type.
id() == ID_bv || expr_type.
id() == ID_fixedbv ||
72 expr_type.
id() == ID_floatbv || expr_type.
id() == ID_c_enum ||
73 expr_type.
id() == ID_c_enum_tag || expr_type.
id() == ID_c_bool ||
74 expr_type.
id() == ID_c_bit_field)
78 for(std::size_t i=0; i<width; i++)
86 else if(expr_type.
id()==ID_enumeration)
91 for(std::size_t i=0; i<elements.size(); i++)
92 if(elements[i].
id()==value)
95 else if(expr_type.
id()==ID_verilog_signedbv ||
96 expr_type.
id()==ID_verilog_unsignedbv)
101 binary.size() * 2 == width,
102 "wrong value length in constant",
105 for(std::size_t i=0; i<
binary.size(); i++)
135 "unknown character in Verilog constant",
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const enumeration_typet & to_enumeration_type(const typet &type)
Cast a typet to a enumeration_typet.
The type of an expression, extends irept.
std::vector< literalt > bvt
const mp_integer string2integer(const std::string &n, unsigned base)
virtual bvt convert_constant(const constant_exprt &expr)
typet & type()
Return the type of the expression.
boolbv_widtht boolbv_width
#define DATA_INVARIANT_WITH_DIAGNOSTICS(CONDITION, REASON,...)
void conversion_failed(const exprt &expr, bvt &bv)
numbering< irep_idt > string_numbering
const std::string & id2string(const irep_idt &d)
#define forall_operands(it, expr)
mp_integer get_from() const
literalt const_literal(bool value)
const irep_idt & id() const
virtual const bvt & convert_bv(const exprt &expr, const optionalt< std::size_t > expected_width=nullopt)
Convert expression to vector of literalts, using an internal cache to speed up conversion if availabl...
const range_typet & to_range_type(const typet &type)
Cast a typet to a range_typet.
bvt build_constant(const mp_integer &i, std::size_t width)
const irept::subt & elements() const
static std::string binary(const constant_exprt &src)
const std::string integer2binary(const mp_integer &n, std::size_t width)
A constant literal expression.
const irep_idt & get_value() const