Skip to content

Commit e009e1b

Browse files
authored
Merge pull request #1392 from diffblue/verilog-interconnect-grammar
SystemVerilog: grammar for interconnect nets
2 parents a4330c4 + 6d3853d commit e009e1b

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
KNOWNBUG
1+
CORE
22
interconnect1.sv
33

4-
^EXIT=0$
4+
^file .* line 2: no support for interconnect nets$
5+
^EXIT=2$
56
^SIGNAL=0$
67
--
78
--
8-
interconnect is not implemented.

src/hw_cbmc_irep_ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ IREP_ID_ONE(verilog_associative_array)
123123
IREP_ID_ONE(verilog_declarations)
124124
IREP_ID_ONE(verilog_default_clocking)
125125
IREP_ID_ONE(verilog_default_disable)
126+
IREP_ID_ONE(verilog_interconnect)
126127
IREP_ID_ONE(verilog_lifetime)
127128
IREP_ID_ONE(verilog_logical_equality)
128129
IREP_ID_ONE(verilog_logical_inequality)

src/verilog/parser.y

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,10 @@ net_declaration:
15211521
addswap($$, ID_class, $1);
15221522
addswap($$, ID_type, $4);
15231523
swapop($$, $6); }
1524+
| TOK_INTERCONNECT delay3_opt list_of_net_decl_assignments ';'
1525+
{ init($$, ID_decl);
1526+
stack_expr($$).set(ID_class, ID_verilog_interconnect);
1527+
swapop($$, $3); }
15241528
;
15251529

15261530
// Note that the identifier that is defined using the typedef may be
@@ -1790,14 +1794,19 @@ net_type_opt:
17901794
| net_type
17911795
;
17921796

1793-
net_port_type: net_type_opt signing_opt packed_dimension_brace
1794-
{
1795-
// The net type is a subtype of the signing.
1796-
add_as_subtype(stack_type($2), stack_type($1));
1797-
// That becomes a subtype of the packed dimension.
1798-
add_as_subtype(stack_type($3), stack_type($2));
1799-
$$ = $3;
1800-
}
1797+
net_port_type:
1798+
net_type_opt signing_opt packed_dimension_brace
1799+
{
1800+
// The net type is a subtype of the signing.
1801+
add_as_subtype(stack_type($2), stack_type($1));
1802+
// That becomes a subtype of the packed dimension.
1803+
add_as_subtype(stack_type($3), stack_type($2));
1804+
$$ = $3;
1805+
}
1806+
| TOK_INTERCONNECT
1807+
{
1808+
init($$, ID_verilog_interconnect);
1809+
}
18011810
;
18021811

18031812
variable_port_type: var_data_type ;

src/verilog/verilog_elaborate.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,14 @@ void verilog_typecheckt::collect_symbols(const verilog_declt &decl)
492492
symbols_added.push_back(symbol.name);
493493
}
494494
}
495-
else if(decl_class == ID_reg || decl_class == ID_var)
495+
else if(
496+
decl_class == ID_reg || decl_class == ID_var ||
497+
decl_class == ID_verilog_interconnect)
496498
{
499+
if(decl_class == ID_verilog_interconnect)
500+
throw errort().with_location(decl.source_location())
501+
<< "no support for interconnect nets";
502+
497503
symbolt symbol;
498504

499505
symbol.mode = mode;

0 commit comments

Comments
 (0)