Skip to content

Commit c6d15d0

Browse files
committed
Verilog: set type of implicit nets
1800 2017 6.10 allows implicit declarations of nets. The type of these nets is to be derived from the LHS of the assignment or the type of the port connection. The warning when a net is declared implicitly is dropped by default; it can be reactivated with --warn-implicit-nets.
1 parent a363d90 commit c6d15d0

19 files changed

+155
-48
lines changed

regression/verilog/nets/implicit1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
implicit1.sv
3-
--bound 0
3+
--bound 0 --warn-implicit-nets
44
^file .* line 4: implicit wire main\.O$
55
^file .* line 4: implicit wire main\.A$
66
^file .* line 4: implicit wire main\.B$
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
KNOWNBUG
1+
CORE
22
implicit2.sv
3-
--bound 0
3+
--bound 0 --warn-implicit-nets
44
^EXIT=0$
55
^SIGNAL=0$
66
--
77
^warning: ignoring
88
--
9-
The width of the implicit net is set incorrectly.

regression/verilog/nets/implicit3.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
implicit3.sv
3-
--bound 0
3+
--bound 0 --warn-implicit-nets
44
^file .* line 6: implicit wire main\.O$
55
^EXIT=0$
66
^SIGNAL=0$
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
KNOWNBUG
1+
CORE
22
implicit4.sv
3-
--bound 0
3+
--bound 0 --warn-implicit-nets
44
^EXIT=0$
55
^SIGNAL=0$
66
--
77
^warning: ignoring
88
--
9-
The width of the implicit net is set incorrectly.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
KNOWNBUG
1+
CORE
22
implicit5.sv
3-
--bound 0
4-
^EXIT=0$
3+
--bound 0 --warn-implicit-nets
4+
^file .* line 4: unknown identifier A$
5+
^EXIT=2$
56
^SIGNAL=0$
67
--
78
^warning: ignoring
89
--
9-
This case should be errored.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
implicit6.sv
3+
--bound 0 --warn-implicit-nets
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--

regression/verilog/nets/implicit6.sv

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module main;
2+
3+
parameter P = 2;
4+
5+
// implicit nets are allowed in the port connection list of a module
6+
and [P:0] (O, A, B);
7+
8+
assert final ($bits(O) == P+1);
9+
10+
endmodule
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
implicit7.sv
3+
--bound 0 --warn-implicit-nets
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
9+
The implicit net is not known yet when evaluating parameters.

regression/verilog/nets/implicit7.sv

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module main;
2+
3+
parameter P = 10;
4+
5+
// implicit nets are allowed in the port connection list of a module
6+
sub #(P) my_sub(x);
7+
8+
// The type of the implict net could be used to define another parameter
9+
parameter Q = $bits(x);
10+
11+
assert final (Q == P + 1);
12+
13+
endmodule
14+
15+
module sub #(parameter P = 1)(input [P:0] some_input);
16+
endmodule

src/ebmc/ebmc_parse_options.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class ebmc_parse_optionst:public parse_options_baset
4747
"(random-traces)(trace-steps):(random-seed):(traces):"
4848
"(random-trace)(random-waveform)"
4949
"(liveness-to-safety)"
50-
"I:D:(preprocess)(systemverilog)(vl2smv-extensions)",
50+
"I:D:(preprocess)(systemverilog)(vl2smv-extensions)"
51+
"(warn-implicit-nets)",
5152
argc,
5253
argv,
5354
std::string("EBMC ") + EBMC_VERSION),

0 commit comments

Comments
 (0)