Skip to content

Conversation

kroening
Copy link
Member

@kroening kroening commented Aug 28, 2025

$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.

@kroening kroening marked this pull request as ready for review August 28, 2025 14:10
Comment on lines 536 to 542
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);
}
}
Copy link
Collaborator

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?

Copy link
Member Author

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.

@kroening kroening force-pushed the past5-fix branch 2 times, most recently from 0951e4e to 940a3ac Compare August 28, 2025 20:43
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.
@kroening kroening changed the title $past now supports array types $past now supports array and struct types Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants