Skip to content

Commit 04c32a6

Browse files
committed
Verilog: rules for Section A.6.10
This changes some of the rules in Section A.6.10 to match those in 1800-2017.
1 parent f32990a commit 04c32a6

File tree

3 files changed

+64
-12
lines changed

3 files changed

+64
-12
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
initial1.sv
3+
--module main --bound 1
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
9+
Syntax is missing for initial label: assert property (...);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module main(input clk);
2+
3+
// count up from 0 to 10
4+
reg [7:0] counter;
5+
6+
initial counter = 0;
7+
8+
always @(posedge clk)
9+
if(counter == 10)
10+
counter = 0;
11+
else
12+
counter = counter + 1;
13+
14+
// expected to pass
15+
initial p0: assert property (counter == 0);
16+
17+
// expected to pass if there are timeframes 0 and 1
18+
initial p1: assert property (s_nexttime counter == 1);
19+
20+
endmodule

src/verilog/parser.y

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -803,10 +803,8 @@ module_or_generate_item:
803803
| attribute_instance_brace gate_instantiation { $$=$2; }
804804
// | attribute_instance_brace udp_instantiation { $$=$2; }
805805
| attribute_instance_brace module_instantiation { $$=$2; }
806-
| attribute_instance_brace concurrent_assert_statement { $$=$2; }
807-
| attribute_instance_brace concurrent_assume_statement { $$=$2; }
808-
| attribute_instance_brace concurrent_cover_statement { $$=$2; }
809-
| attribute_instance_brace concurrent_assertion_item_declaration { $$=$2; }
806+
| attribute_instance_brace concurrent_assertion_item { $$=$2; }
807+
| attribute_instance_brace assertion_item_declaration { $$=$2; }
810808
| attribute_instance_brace module_common_item { $$=$2; }
811809
;
812810

@@ -1535,8 +1533,19 @@ block_item_declaration:
15351533
// System Verilog standard 1800-2017
15361534
// A.2.10 Assertion declarations
15371535

1538-
concurrent_assertion_item_declaration:
1539-
property_declaration
1536+
concurrent_assertion_item:
1537+
concurrent_assertion_statement
1538+
| block_identifier TOK_COLON concurrent_assertion_statement
1539+
{
1540+
$$=$3;
1541+
stack_expr($$).set(ID_identifier, stack_expr($1).id());
1542+
}
1543+
;
1544+
1545+
concurrent_assertion_statement:
1546+
assert_property_statement
1547+
| assume_property_statement
1548+
| cover_property_statement
15401549
;
15411550

15421551
assert_property_statement:
@@ -1567,6 +1576,10 @@ cover_property_statement: TOK_COVER TOK_PROPERTY '(' expression ')' action_block
15671576
{ init($$, ID_cover); mto($$, $4); mto($$, $6); }
15681577
;
15691578

1579+
assertion_item_declaration:
1580+
property_declaration
1581+
;
1582+
15701583
property_declaration:
15711584
TOK_PROPERTY property_identifier TOK_ENDPROPERTY
15721585
;
@@ -2120,12 +2133,10 @@ statement:
21202133
;
21212134

21222135
statement_item:
2123-
assert_property_statement
2124-
| assume_property_statement
2125-
| blocking_assignment ';' { $$ = $1; }
2136+
blocking_assignment ';' { $$ = $1; }
21262137
| nonblocking_assignment ';' { $$ = $1; }
21272138
| case_statement
2128-
| cover_property_statement
2139+
| concurrent_assertion_statement
21292140
| conditional_statement
21302141
| inc_or_dec_expression ';'
21312142
| subroutine_call_statement
@@ -2137,7 +2148,7 @@ statement_item:
21372148
| procedural_continuous_assignments ';'
21382149
| seq_block
21392150
| wait_statement
2140-
| immediate_assert_statement
2151+
| procedural_assertion_statement
21412152
;
21422153

21432154
subroutine_call_statement:
@@ -2367,7 +2378,19 @@ statement_brace:
23672378
// System Verilog standard 1800-2017
23682379
// A.6.10 Assertion statements
23692380

2370-
immediate_assert_statement: TOK_ASSERT '(' expression ')' action_block
2381+
procedural_assertion_statement:
2382+
immediate_assertion_statement
2383+
;
2384+
2385+
immediate_assertion_statement:
2386+
simple_immediate_assertion_statement
2387+
;
2388+
2389+
simple_immediate_assertion_statement:
2390+
simple_immediate_assert_statement
2391+
;
2392+
2393+
simple_immediate_assert_statement: TOK_ASSERT '(' expression ')' action_block
23712394
{ init($$, ID_assert); mto($$, $3); mto($$, $5); }
23722395
;
23732396

0 commit comments

Comments
 (0)