Skip to content
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

SVA: sequence repetition for proper sequences #944

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions regression/verilog/SVA/sequence_repetition4.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
sequence_repetition4.sv

^\[main\.p0\] \(main\.x == 0 ##1 main\.x == 1\) \[\*2\]: PROVED up to bound \d+$
^\[main\.p1\] \(main\.x == 0 ##1 main\.x == 1 ##1 main\.x == 0\) \[\*2\]: REFUTED$
^EXIT=10$
^SIGNAL=0$
--
^warning: ignoring
--
15 changes: 15 additions & 0 deletions regression/verilog/SVA/sequence_repetition4.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module main(input clk);

reg [31:0] x = 0;

// 0 1 0 1 0 1 ...
always_ff @(posedge clk)
x = x == 0 ? 1 : 0;

// should pass
initial p0: assert property ((x == 0 ##1 x == 1)[*2]);

// should fail
initial p1: assert property ((x == 0 ##1 x == 1 ##1 x == 0)[*2]);

endmodule
5 changes: 5 additions & 0 deletions src/verilog/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -2572,6 +2572,11 @@ sequence_expr_proper:
{ init($$, ID_sva_sequence_concatenation); mto($$, $1); mto($2, $3); mto($$, $2); }
| '(' sequence_expr_proper ')'
{ $$ = $2; }
| '(' sequence_expr_proper ')' sequence_abbrev
{ $$ = $4;
// preserve the operand ordering as in the source code
stack_expr($$).operands().insert(stack_expr($$).operands().begin(), stack_expr($2));
}
| expression_or_dist boolean_abbrev
{ $$ = $2;
// preserve the operand ordering as in the source code
Expand Down
2 changes: 1 addition & 1 deletion src/verilog/sva_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exprt sva_sequence_consecutive_repetition_exprt::lower() const
auto cycle_delay =
sva_cycle_delay_exprt{from_integer(1, integer_typet{}), lhs()};
result = sva_sequence_concatenation_exprt{
std::move(cycle_delay), std::move(result)};
std::move(result), std::move(cycle_delay)};
}

return result;
Expand Down
Loading