Skip to content

Commit fa78509

Browse files
committed
SystemVerilog: sequence and property ports
This adds SV sequence and property ports.
1 parent 5c83c53 commit fa78509

File tree

3 files changed

+71
-4
lines changed

3 files changed

+71
-4
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: 52 additions & 4 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,53 @@ 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+
{ init($$, ID_nil); }
2569+
| '=' property_actual_arg
2570+
{ $$ = $2; }
2571+
;
2572+
2573+
property_actual_arg:
2574+
property_expr
2575+
;
2576+
25502577
property_spec:
25512578
clocking_event TOK_DISABLE TOK_IFF '(' expression ')' property_expr
25522579
{ init($$, ID_sva_disable_iff); mto($$, $5); mto($$, $7); }
@@ -2556,7 +2583,7 @@ property_spec:
25562583
;
25572584

25582585
sequence_formal_type:
2559-
data_type
2586+
data_type_or_implicit
25602587
| TOK_SEQUENCE
25612588
{ init($$, ID_verilog_sequence); }
25622589
| TOK_UNTYPED
@@ -2723,12 +2750,33 @@ sequence_port_list_opt:
27232750
sequence_port_list:
27242751
sequence_port_item
27252752
{ init($$); mto($$, $1); }
2726-
| sequence_port_list sequence_port_item
2753+
| sequence_port_list ',' sequence_port_item
27272754
{ $$=$1; mto($$, $2); }
27282755
;
27292756

27302757
sequence_port_item:
2758+
attribute_instance_brace
2759+
sequence_formal_type
27312760
formal_port_identifier
2761+
variable_dimension_brace
2762+
sequence_actual_arg_opt
2763+
{
2764+
init($$, ID_decl);
2765+
addswap($$, ID_type, $2);
2766+
addswap($3, ID_type, $4);
2767+
mto($$, $3); /* declarator */
2768+
addswap($$, ID_value, $5);
2769+
}
2770+
;
2771+
2772+
sequence_actual_arg_opt:
2773+
/* Optional */
2774+
{ init($$, ID_nil); }
2775+
| sequence_actual_arg
2776+
;
2777+
2778+
sequence_actual_arg:
2779+
sequence_expr
27322780
;
27332781

27342782
sequence_identifier_opt:

0 commit comments

Comments
 (0)