Fix defparam in generate broke in 3.840, bug543.
This commit is contained in:
parent
e4f0a8952c
commit
b51d197117
2
Changes
2
Changes
|
|
@ -7,6 +7,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||||
|
|
||||||
**** Fix double-deep parameter cell WIDTHs, bug541. [Hiroki Honda]
|
**** Fix double-deep parameter cell WIDTHs, bug541. [Hiroki Honda]
|
||||||
|
|
||||||
|
**** Fix defparam in generate broke in 3.840, bug543. [Alex Solomatnikov]
|
||||||
|
|
||||||
|
|
||||||
* Verilator 3.840 2012/07/31 Beta
|
* Verilator 3.840 2012/07/31 Beta
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -544,6 +544,10 @@ private:
|
||||||
m_statep->insertInline(aboveSymp, m_modSymp, nodep, nodep->name());
|
m_statep->insertInline(aboveSymp, m_modSymp, nodep, nodep->name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
virtual void visit(AstDefParam* nodep, AstNUser*) {
|
||||||
|
nodep->user1p(m_curSymp);
|
||||||
|
nodep->iterateChildren(*this);
|
||||||
|
}
|
||||||
virtual void visit(AstGenerate* nodep, AstNUser*) {
|
virtual void visit(AstGenerate* nodep, AstNUser*) {
|
||||||
// Begin: ... blocks often replicate under genif/genfor, so simply suppress duplicate checks
|
// Begin: ... blocks often replicate under genif/genfor, so simply suppress duplicate checks
|
||||||
// See t_gen_forif.v for an example.
|
// See t_gen_forif.v for an example.
|
||||||
|
|
@ -834,14 +838,15 @@ private:
|
||||||
virtual void visit(AstDefParam* nodep, AstNUser*) {
|
virtual void visit(AstDefParam* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->v3warn(DEFPARAM,"Suggest replace defparam with Verilog 2001 #(."<<nodep->name()<<"(...etc...))");
|
nodep->v3warn(DEFPARAM,"Suggest replace defparam with Verilog 2001 #(."<<nodep->name()<<"(...etc...))");
|
||||||
VSymEnt* foundp = m_statep->getNodeSym(m_modp)->findIdFallback(nodep->path());
|
VSymEnt* foundp = m_statep->getNodeSym(nodep)->findIdFallback(nodep->path());
|
||||||
AstCell* cellp = foundp->nodep()->castCell();
|
AstCell* cellp = foundp->nodep()->castCell();
|
||||||
if (!cellp) {
|
if (!cellp) {
|
||||||
nodep->v3error("In defparam, cell "<<nodep->path()<<" never declared");
|
nodep->v3error("In defparam, cell "<<nodep->path()<<" never declared");
|
||||||
} else {
|
} else {
|
||||||
AstNode* exprp = nodep->rhsp()->unlinkFrBack();
|
AstNode* exprp = nodep->rhsp()->unlinkFrBack();
|
||||||
UINFO(9,"Defparam cell "<<nodep->path()<<"."<<nodep->name()
|
UINFO(9,"Defparam cell "<<nodep->path()<<"."<<nodep->name()
|
||||||
<<" <= "<<exprp<<endl);
|
<<" attach-to "<<cellp
|
||||||
|
<<" <= "<<exprp<<endl);
|
||||||
// Don't need to check the name of the defparam exists. V3Param does.
|
// Don't need to check the name of the defparam exists. V3Param does.
|
||||||
AstPin* pinp = new AstPin (nodep->fileline(),
|
AstPin* pinp = new AstPin (nodep->fileline(),
|
||||||
-1, // Pin# not relevant
|
-1, // Pin# not relevant
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2003 by Wilson Snyder. This program is free software; you can
|
||||||
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
|
# Version 2.0.
|
||||||
|
|
||||||
|
compile (
|
||||||
|
);
|
||||||
|
|
||||||
|
execute (
|
||||||
|
check_finished=>1,
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(1);
|
||||||
|
1;
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed into the Public Domain, for any use,
|
||||||
|
// without warranty, 2012 by Wilson Snyder.
|
||||||
|
|
||||||
|
module t (/*AUTOARG*/
|
||||||
|
// Inputs
|
||||||
|
clk
|
||||||
|
);
|
||||||
|
input clk;
|
||||||
|
parameter PAR = 3;
|
||||||
|
|
||||||
|
wire [31:0] o1a,o1b;
|
||||||
|
|
||||||
|
m1 #(0) m1a(.o(o1a));
|
||||||
|
m1 #(1) m1b(.o(o1b));
|
||||||
|
|
||||||
|
always @ (posedge clk) begin
|
||||||
|
if (o1a != 8) $stop;
|
||||||
|
if (o1b != 4) $stop;
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module m1 (output wire [31:0] o);
|
||||||
|
parameter W = 0;
|
||||||
|
generate
|
||||||
|
if (W == 0) begin
|
||||||
|
m2 m2 (.o(o));
|
||||||
|
defparam m2.PAR2 = 8;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
m2 m2 (.o(o));
|
||||||
|
defparam m2.PAR2 = 4;
|
||||||
|
end
|
||||||
|
endgenerate
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module m2 (output wire [31:0] o);
|
||||||
|
parameter PAR2 = 10;
|
||||||
|
assign o = PAR2;
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue