Skip to content

Commit 0cc28a8

Browse files
committed
SVA: sequence repetition for proper sequences
The sequence abbreviation operator can be applied to a full sequence, not just state formulas. This adds the grammar for this case.
1 parent a0c228e commit 0cc28a8

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
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: PROVED up to bound 5
5+
^\[main\.p1\] main\.x == 0 ##1 main\.x == 1 ##1 0: REFUTED
6+
^EXIT=10$
7+
^SIGNAL=0$
8+
--
9+
^warning: ignoring
10+
--
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

+5
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

0 commit comments

Comments
 (0)