-
Notifications
You must be signed in to change notification settings - Fork 20
$past
now supports array and struct types
#1247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/verilog/verilog_expr.cpp
Outdated
exprt verilog_past_exprt::default_value(const typet &type) | ||
{ | ||
auto zero = from_integer(0, type()); | ||
if(zero.is_nil()) | ||
throw "failed to create $past default value"; | ||
if(type.id() == ID_array) | ||
{ | ||
auto &array_type = to_array_type(type); | ||
auto zero_rec = default_value(array_type.element_type()); | ||
return array_of_exprt{zero_rec, array_type}; | ||
} | ||
else | ||
return std::move(zero); | ||
{ | ||
return from_integer(0, type); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this use CBMC's zero_initializer
or else the one for Verilog being proposed in #1001?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the standard seems to guarantee that the value prior to the initial state is the default initial value, will consolidate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All done
0951e4e
to
940a3ac
Compare
This merges the types in struct and union declarations.
$past returns a "zero value" when asked for a value prior to the initial frame. This adds the zero value for array and struct types.
$past
now supports array types$past
now supports array and struct types
$past
returns a "zero value" when asked for a value prior to the initial frame. This adds the zero value for array and struct types.