Skip to content

Commit 067ff29

Browse files
committed
SystemVerilog: property ports
This adds SV property ports.
1 parent 5c83c53 commit 067ff29

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
property_port1.sv
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module main;
2+
3+
wire [31:0] x = 10;
4+
5+
property is_ten(something);
6+
something == 10
7+
endproperty : is_ten
8+
9+
assert property (is_ten(x));
10+
11+
endmodule

src/verilog/parser.y

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ checker_port_list_opt:
794794
checker_port_list:
795795
checker_port_item
796796
{ init($$); mts($$, $1); }
797-
| checker_port_list checker_port_item
797+
| checker_port_list ',' checker_port_item
798798
{ $$ = $1; mts($$, $2); }
799799
;
800800

@@ -2515,6 +2515,7 @@ property_declaration:
25152515
TOK_ENDPROPERTY property_identifier_opt
25162516
{ init($$, ID_verilog_property_declaration);
25172517
stack_expr($$).set(ID_base_name, stack_expr($2).id());
2518+
stack_expr($$).set(ID_ports, stack_expr($3));
25182519
mto($$, $5); }
25192520
;
25202521

@@ -2526,27 +2527,51 @@ property_identifier_opt:
25262527
property_port_list_paren_opt:
25272528
/* optional */
25282529
| '(' property_port_list_opt ')'
2530+
{ $$ = $2; }
25292531
;
25302532

25312533
property_port_list_opt:
25322534
/* optional */
2535+
{ init($$); }
25332536
| property_port_list
25342537
;
25352538

25362539
property_port_list:
25372540
property_port_item
2541+
{ init($$); mts($$, $1); }
25382542
| property_port_list_opt ',' property_port_item
2543+
{ $$ = $1; mts($$, $3); }
25392544
;
25402545

25412546
property_port_item:
2542-
attribute_instance_brace property_formal_type formal_port_identifier variable_dimension_brace
2547+
attribute_instance_brace
2548+
property_formal_type
2549+
formal_port_identifier
2550+
variable_dimension_brace
2551+
property_actual_arg_opt
2552+
{
2553+
init($$, ID_decl);
2554+
addswap($$, ID_type, $2);
2555+
addswap($3, ID_type, $4);
2556+
mto($$, $3); /* declarator */
2557+
addswap($$, ID_value, $5);
2558+
}
25432559
;
25442560

25452561
property_formal_type:
25462562
sequence_formal_type
25472563
| TOK_PROPERTY
25482564
;
25492565

2566+
property_actual_arg_opt:
2567+
/* Optional */
2568+
| '=' property_actual_arg
2569+
;
2570+
2571+
property_actual_arg:
2572+
property_expr
2573+
;
2574+
25502575
property_spec:
25512576
clocking_event TOK_DISABLE TOK_IFF '(' expression ')' property_expr
25522577
{ init($$, ID_sva_disable_iff); mto($$, $5); mto($$, $7); }
@@ -2556,7 +2581,7 @@ property_spec:
25562581
;
25572582

25582583
sequence_formal_type:
2559-
data_type
2584+
data_type_or_implicit
25602585
| TOK_SEQUENCE
25612586
{ init($$, ID_verilog_sequence); }
25622587
| TOK_UNTYPED

0 commit comments

Comments
 (0)