Skip to content

Commit 009b13b

Browse files
authored
Merge pull request #944 from diffblue/sequence_repetition4
SVA: sequence repetition for proper sequences
2 parents a0c228e + 38a7880 commit 009b13b

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
sequence_repetition4.sv
3+
4+
^\[main\.p0\] \(main\.x == 0 ##1 main\.x == 1\) \[\*2\]: PROVED up to bound \d+$
5+
^\[main\.p1\] \(main\.x == 0 ##1 main\.x == 1 ##1 main\.x == 0\) \[\*2\]: REFUTED$
6+
^EXIT=10$
7+
^SIGNAL=0$
8+
--
9+
^warning: ignoring
10+
--
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module main(input clk);
2+
3+
reg [31:0] x = 0;
4+
5+
// 0 1 0 1 0 1 ...
6+
always_ff @(posedge clk)
7+
x = x == 0 ? 1 : 0;
8+
9+
// should pass
10+
initial p0: assert property ((x == 0 ##1 x == 1)[*2]);
11+
12+
// should fail
13+
initial p1: assert property ((x == 0 ##1 x == 1 ##1 x == 0)[*2]);
14+
15+
endmodule

src/verilog/parser.y

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,6 +2572,11 @@ sequence_expr_proper:
25722572
{ init($$, ID_sva_sequence_concatenation); mto($$, $1); mto($2, $3); mto($$, $2); }
25732573
| '(' sequence_expr_proper ')'
25742574
{ $$ = $2; }
2575+
| '(' sequence_expr_proper ')' sequence_abbrev
2576+
{ $$ = $4;
2577+
// preserve the operand ordering as in the source code
2578+
stack_expr($$).operands().insert(stack_expr($$).operands().begin(), stack_expr($2));
2579+
}
25752580
| expression_or_dist boolean_abbrev
25762581
{ $$ = $2;
25772582
// preserve the operand ordering as in the source code

src/verilog/sva_expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ exprt sva_sequence_consecutive_repetition_exprt::lower() const
5151
auto cycle_delay =
5252
sva_cycle_delay_exprt{from_integer(1, integer_typet{}), lhs()};
5353
result = sva_sequence_concatenation_exprt{
54-
std::move(cycle_delay), std::move(result)};
54+
std::move(result), std::move(cycle_delay)};
5555
}
5656

5757
return result;

0 commit comments

Comments
 (0)