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",
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...
virtual bvt convert_constant(const constant_exprt &expr)
numberingt< irep_idt > string_numbering
bvt conversion_failed(const exprt &expr)
Print that the expression of x has failed conversion, then return a vector of x's width.
virtual std::size_t boolbv_width(const typet &type) const
static bvt build_constant(const mp_integer &i, std::size_t width)
A constant literal expression.
const irep_idt & get_value() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const irept::subt & elements() const
typet & type()
Return the type of the expression.
const irep_idt & id() const
number_type number(const key_type &a)
mp_integer get_from() const
The type of an expression, extends irept.
#define forall_operands(it, expr)
const std::string & id2string(const irep_idt &d)
static std::string binary(const constant_exprt &src)
std::vector< literalt > bvt
literalt const_literal(bool value)
const mp_integer string2integer(const std::string &n, unsigned base)
const std::string integer2binary(const mp_integer &n, std::size_t width)
#define DATA_INVARIANT_WITH_DIAGNOSTICS(CONDITION, REASON,...)
const range_typet & to_range_type(const typet &type)
Cast a typet to a range_typet.
const enumeration_typet & to_enumeration_type(const typet &type)
Cast a typet to a enumeration_typet.