32 if(type.
id()==ID_unsignedbv ||
33 type.
id()==ID_signedbv ||
35 type.
id()==ID_fixedbv ||
36 type.
id()==ID_floatbv ||
37 type.
id()==ID_pointer)
40 else if(expr.
id()==ID_array)
44 for(
const auto &op : expr.
operands())
49 else if(expr.
id()==ID_struct)
53 for(
const auto &op : expr.
operands())
58 else if(expr.
id()==ID_union)
68 return std::string(numeric_cast_v<std::size_t>(*width),
'x');
80 out <<
"$date\n " <<
ctime(&t) <<
"$end" <<
"\n";
83 out <<
"$timescale 1 ns $end" <<
"\n";
89 for(
const auto &step : goto_trace.
steps)
91 if(step.is_assignment())
93 auto lhs_object=step.get_lhs_object();
94 if(lhs_object.has_value())
96 irep_idt identifier=lhs_object->get_identifier();
97 const typet &type=lhs_object->type();
99 const auto number=n.
number(identifier);
103 if(width.has_value() && (*width) >= 1)
104 out <<
"$var reg " << (*width) <<
" V" << number <<
" " << identifier
112 out <<
"$enddefinitions $end" <<
"\n";
114 unsigned timestamp=0;
116 for(
const auto &step : goto_trace.
steps)
118 if(step.is_assignment())
120 auto lhs_object = step.get_lhs_object();
121 if(lhs_object.has_value())
123 irep_idt identifier = lhs_object->get_identifier();
124 const typet &type = lhs_object->type();
126 out <<
'#' << timestamp <<
"\n";
129 const auto number = n.
number(identifier);
132 if(type.
id() == ID_bool)
134 if(step.full_lhs_value.is_true())
136 <<
"V" << number <<
"\n";
137 else if(step.full_lhs_value.is_false())
139 <<
"V" << number <<
"\n";
142 <<
"V" << number <<
"\n";
149 out <<
"b" <<
binary <<
" V" << number <<
" "
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
typet & type()
Return the type of the expression.
bool is_constant() const
Return whether the expression is a constant.
const irep_idt & id() const
const std::string & get_string(const irep_idt &name) const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
number_type number(const key_type &a)
The type of an expression, extends irept.
static std::string binary(const constant_exprt &src)
std::optional< mp_integer > pointer_offset_bits(const typet &type, const namespacet &ns)
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
char * ctime(const time_t *clock)
time_t time(time_t *tloc)
std::string as_vcd_binary(const exprt &expr, const namespacet &ns)
void output_vcd(const namespacet &ns, const goto_tracet &goto_trace, std::ostream &out)
Traces of GOTO Programs in VCD (Value Change Dump) Format.