Fix duplicate implicit variables under generates, bug201

This commit is contained in:
Wilson Snyder 2010-01-11 12:36:12 -05:00
parent 266b3b8678
commit d1cb3b0d15
3 changed files with 14 additions and 1 deletions

View File

@ -41,6 +41,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix creating implicit variables for expressions, bug196. [Byron Bradley]
**** Fix duplicate implicit variables under generates, bug201. [Byron Bradley]
**** Fix tracing with --pins-bv 1, bug195. [Michael S]
**** Fix MinGW compilation, bug184. [by Shankar Giri]

View File

@ -191,9 +191,12 @@ private:
m_modp->addStmtp(newp);
// Link it to signal list
IdState old_id = m_idState;
V3SymTable* old_varsp = m_curVarsp;
m_idState = ID_FIND;
m_curVarsp = symsFind(m_modp); // Must add the variable under the module; curVarsp might be lower now
newp->accept(*this);
m_idState = old_id;
m_curVarsp = old_varsp;
}
}

View File

@ -6,19 +6,27 @@
// without warranty.
`timescale 1ns / 1ps
module t(data_i, data_o);
module t(data_i, data_o, single);
parameter op_bits = 32;
input [op_bits -1:0] data_i;
output [31:0] data_o;
input single;
//simplistic example, should choose 1st conditional generate and assign straight through
//the tool also compiles the special case and determines an error (replication value is 0
generate
if (op_bits == 32) begin : general_case
assign data_o = data_i;
// Test implicit signals
/* verilator lint_off IMPLICIT */
assign imp = single;
/* verilator lint_on IMPLICIT */
end
else begin : special_case
assign data_o = {{(32 -op_bits){1'b0}},data_i};
/* verilator lint_off IMPLICIT */
assign imp = single;
/* verilator lint_on IMPLICIT */
end
endgenerate
endmodule