Fix detection of wire/reg duplicates

This commit is contained in:
Wilson Snyder 2023-05-05 20:16:27 -04:00
parent 584f8cc9e7
commit d308a561e4
5 changed files with 22 additions and 4 deletions

View File

@ -1211,7 +1211,8 @@ class LinkDotFindVisitor final : public VNVisitor {
return;
}
const bool nansiBad
= ((findvarp->isDeclTyped() && nodep->isDeclTyped())
= (((findvarp->isDeclTyped() || findvarp->isNet())
&& (nodep->isDeclTyped() || nodep->isNet()))
|| (findvarp->isIO() && nodep->isIO())); // e.g. !(output && output)
const bool ansiBad
= findvarp->isAnsi() || nodep->isAnsi(); // dup illegal with ANSI

View File

@ -152,7 +152,7 @@ module bug3182(in, out);
bit_source = c_fake_dependency() | in;
wire [5:0] tmp = bit_source; // V3Gate should inline this
wire out = ~(tmp >> 5) & (bit_source == 5'd10);
assign out = ~(tmp >> 5) & (bit_source == 5'd10);
/* verilator lint_on WIDTH */
endmodule
@ -374,7 +374,6 @@ endmodule
// total polarity. This bug was introduced when fixing #3445.
module bug4059(input wire clk, input wire [31:0] in, output wire out);
wire [127:0] words_i;
logic [127:0] words_i;
for (genvar i = 0; i < $bits(in); ++i) begin
always_ff @(posedge clk)
words_i[4 * i +: 4] <= {4{in[i]}};

View File

@ -11,4 +11,16 @@
t/t_var_dup2_bad.v:11:11: ... Location of original declaration
11 | output bad_o_r);
| ^~~~~~~
%Error: t/t_var_dup2_bad.v:17:9: Duplicate declaration of signal: 'bad_w_r'
17 | reg bad_w_r;
| ^~~~~~~
t/t_var_dup2_bad.v:16:9: ... Location of original declaration
16 | wire bad_w_r;
| ^~~~~~~
%Error: t/t_var_dup2_bad.v:20:9: Duplicate declaration of signal: 'bad_r_w'
20 | reg bad_r_w;
| ^~~~~~~
t/t_var_dup2_bad.v:19:9: ... Location of original declaration
19 | wire bad_r_w;
| ^~~~~~~
%Error: Exiting due to

View File

@ -12,4 +12,11 @@ module t
wire bad_o_w;
reg bad_o_r;
wire bad_w_r;
reg bad_w_r;
wire bad_r_w;
reg bad_r_w;
endmodule

View File

@ -47,7 +47,6 @@
64 | output bad_reout_port
| ^~~~~~~~~~~~~~
%Error: t/t_var_dup_bad.v:73:9: Duplicate declaration of signal: 'bad_rewire'
: ... note: ANSI ports must have type declared with the I/O (IEEE 1800-2017 23.2.2.2)
73 | wire bad_rewire;
| ^~~~~~~~~~
t/t_var_dup_bad.v:70:16: ... Location of original declaration