Skip to content

Commit fa35950

Browse files
committed
Verilog: parameters with value $
This adds support for Verilog parameters that have value $, signalling an unbounded range.
1 parent 57e0c27 commit fa35950

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
unbounded1.sv
3+
--module main --bound 1
4+
^\[main\.property\.1\] always \(main\.a ##\[0:\$\] main.b\): REFUTED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--

regression/verilog/SVA/unbounded1.sv

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module main;
2+
3+
parameter upper = $;
4+
5+
reg a, b;
6+
7+
assert property (a ##[0:upper] b);
8+
9+
endmodule

src/verilog/parser.y

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ list_of_param_assignments:
15721572
{ $$=$1; mto($$, $3); }
15731573
;
15741574

1575-
param_assignment: param_identifier '=' const_expression
1575+
param_assignment: param_identifier '=' constant_param_expression
15761576
{ init($$, ID_parameter);
15771577
auto base_name = stack_expr($1).id();
15781578
stack_expr($$).set(ID_identifier, base_name);
@@ -2061,10 +2061,8 @@ sequence_expr:
20612061
cycle_delay_range:
20622062
"##" number
20632063
{ init($$, ID_sva_cycle_delay); mto($$, $2); stack_expr($$).operands().push_back(nil_exprt()); }
2064-
| "##" '[' number TOK_COLON number ']'
2065-
{ init($$, ID_sva_cycle_delay); mto($$, $3); mto($$, $5); }
2066-
| "##" '[' number TOK_COLON '$' ']'
2067-
{ init($$, ID_sva_cycle_delay); mto($$, $3); stack_expr($$).add_to_operands(exprt(ID_infinity)); }
2064+
| "##" '[' cycle_delay_const_range_expression ']'
2065+
{ $$ = $3; }
20682066
;
20692067

20702068
cycle_delay_const_range_expression:
@@ -3180,6 +3178,12 @@ inc_or_dec_expression:
31803178
{ init($$, ID_postdecrement); mto($$, $1); }
31813179
;
31823180

3181+
constant_param_expression:
3182+
constant_expression
3183+
| '$'
3184+
{ init($$, ID_infinity); }
3185+
;
3186+
31833187
constant_range:
31843188
const_expression TOK_COLON const_expression
31853189
{ init($$, ID_verilog_non_indexed_part_select); mto($$, $1); mto($$, $3); }

0 commit comments

Comments
 (0)