Fix package import of non-localparam parameter, bug591.
This commit is contained in:
parent
895e374860
commit
27660b271d
2
Changes
2
Changes
|
|
@ -11,6 +11,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||||
|
|
||||||
**** Fix task inlining under $display, bug589. [Holger Waechtler]
|
**** Fix task inlining under $display, bug589. [Holger Waechtler]
|
||||||
|
|
||||||
|
**** Fix package import of non-localparam parameter, bug591. [Jeremy Bennett]
|
||||||
|
|
||||||
|
|
||||||
* Verilator 3.843 2012/12/01
|
* Verilator 3.843 2012/12/01
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ public:
|
||||||
abovep->reinsert(name, symp);
|
abovep->reinsert(name, symp);
|
||||||
return symp;
|
return symp;
|
||||||
}
|
}
|
||||||
void insertSym(VSymEnt* abovep, const string& name, AstNode* nodep, AstPackage* packagep) {
|
VSymEnt* insertSym(VSymEnt* abovep, const string& name, AstNode* nodep, AstPackage* packagep) {
|
||||||
if (!abovep) nodep->v3fatalSrc("Null symbol table inserting node");
|
if (!abovep) nodep->v3fatalSrc("Null symbol table inserting node");
|
||||||
VSymEnt* symp = new VSymEnt(&m_syms, nodep);
|
VSymEnt* symp = new VSymEnt(&m_syms, nodep);
|
||||||
UINFO(9," INSERTsym se"<<(void*)symp<<" name='"<<name<<"' above=se"<<(void*)abovep<<" node="<<nodep<<endl);
|
UINFO(9," INSERTsym se"<<(void*)symp<<" name='"<<name<<"' above=se"<<(void*)abovep<<" node="<<nodep<<endl);
|
||||||
|
|
@ -258,6 +258,7 @@ public:
|
||||||
nodep->user1p(symp);
|
nodep->user1p(symp);
|
||||||
checkDuplicate(abovep, nodep, name);
|
checkDuplicate(abovep, nodep, name);
|
||||||
abovep->insert(name, symp);
|
abovep->insert(name, symp);
|
||||||
|
return symp;
|
||||||
}
|
}
|
||||||
static bool existsModScope(AstNodeModule* nodep) {
|
static bool existsModScope(AstNodeModule* nodep) {
|
||||||
return nodep->user1p()!=NULL;
|
return nodep->user1p()!=NULL;
|
||||||
|
|
@ -698,7 +699,8 @@ private:
|
||||||
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
||||||
if (m_statep->forPrimary() && nodep->isGParam()) {
|
if (m_statep->forPrimary() && nodep->isGParam()) {
|
||||||
m_paramNum++;
|
m_paramNum++;
|
||||||
m_statep->insertSym(m_curSymp, "__paramNumber"+cvtToStr(m_paramNum), nodep, m_packagep);
|
VSymEnt* symp = m_statep->insertSym(m_curSymp, "__paramNumber"+cvtToStr(m_paramNum), nodep, m_packagep);
|
||||||
|
symp->importable(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -752,6 +754,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_curSymp->import(srcp, nodep->name());
|
m_curSymp->import(srcp, nodep->name());
|
||||||
|
UINFO(2," Link Done: "<<nodep<<endl);
|
||||||
// No longer needed, but can't delete until any multi-instantiated modules are expanded
|
// No longer needed, but can't delete until any multi-instantiated modules are expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -876,7 +879,9 @@ private:
|
||||||
nodep->v3error("Pin is not an in/out/inout: "<<nodep->prettyName());
|
nodep->v3error("Pin is not an in/out/inout: "<<nodep->prettyName());
|
||||||
} else {
|
} else {
|
||||||
refp->user4(true);
|
refp->user4(true);
|
||||||
m_statep->insertSym(m_statep->getNodeSym(m_modp), "__pinNumber"+cvtToStr(nodep->pinNum()), refp, NULL/*packagep*/);
|
VSymEnt* symp = m_statep->insertSym(m_statep->getNodeSym(m_modp),
|
||||||
|
"__pinNumber"+cvtToStr(nodep->pinNum()), refp, NULL/*packagep*/);
|
||||||
|
symp->importable(false);
|
||||||
}
|
}
|
||||||
// Ports not needed any more
|
// Ports not needed any more
|
||||||
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ private:
|
||||||
VSymEnt* m_parentp; // Table that created this table, dot notation needed to resolve into it
|
VSymEnt* m_parentp; // Table that created this table, dot notation needed to resolve into it
|
||||||
AstPackage* m_packagep; // Package node is in (for V3LinkDot, unused here)
|
AstPackage* m_packagep; // Package node is in (for V3LinkDot, unused here)
|
||||||
string m_symPrefix; // String to prefix symbols with (for V3LinkDot, unused here)
|
string m_symPrefix; // String to prefix symbols with (for V3LinkDot, unused here)
|
||||||
|
bool m_importable; // Allow importing
|
||||||
#ifdef VL_DEBUG
|
#ifdef VL_DEBUG
|
||||||
static int debug() {
|
static int debug() {
|
||||||
static int level = -1;
|
static int level = -1;
|
||||||
|
|
@ -107,6 +108,8 @@ public:
|
||||||
AstNode* nodep() const { if (!this) return NULL; else return m_nodep; } // null check so can call .findId(...)->nodep()
|
AstNode* nodep() const { if (!this) return NULL; else return m_nodep; } // null check so can call .findId(...)->nodep()
|
||||||
string symPrefix() const { return m_symPrefix; }
|
string symPrefix() const { return m_symPrefix; }
|
||||||
void symPrefix(const string& name) { m_symPrefix = name; }
|
void symPrefix(const string& name) { m_symPrefix = name; }
|
||||||
|
bool importable() const { return m_importable; }
|
||||||
|
void importable(bool flag) { m_importable = flag; }
|
||||||
void insert(const string& name, VSymEnt* entp) {
|
void insert(const string& name, VSymEnt* entp) {
|
||||||
UINFO(9, " SymInsert se"<<(void*)this<<" '"<<name<<"' se"<<(void*)entp<<" "<<entp->nodep()<<endl);
|
UINFO(9, " SymInsert se"<<(void*)this<<" '"<<name<<"' se"<<(void*)entp<<" "<<entp->nodep()<<endl);
|
||||||
if (name != "" && m_idNameMap.find(name) != m_idNameMap.end()) {
|
if (name != "" && m_idNameMap.find(name) != m_idNameMap.end()) {
|
||||||
|
|
@ -152,13 +155,17 @@ public:
|
||||||
if (id_or_star != "*") {
|
if (id_or_star != "*") {
|
||||||
IdNameMap::const_iterator it = srcp->m_idNameMap.find(id_or_star);
|
IdNameMap::const_iterator it = srcp->m_idNameMap.find(id_or_star);
|
||||||
if (it != m_idNameMap.end()) {
|
if (it != m_idNameMap.end()) {
|
||||||
|
if (it->second->importable()) {
|
||||||
|
reinsert(it->first, it->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
any = true; // Legal, though perhaps lint questionable to import nothing
|
||||||
|
} else {
|
||||||
|
for (IdNameMap::const_iterator it=srcp->m_idNameMap.begin(); it!=srcp->m_idNameMap.end(); ++it) {
|
||||||
|
if (it->second->importable()) {
|
||||||
reinsert(it->first, it->second);
|
reinsert(it->first, it->second);
|
||||||
any = true;
|
any = true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (IdNameMap::const_iterator it=srcp->m_idNameMap.begin(); it!=srcp->m_idNameMap.end(); ++it) {
|
|
||||||
reinsert(it->first, it->second);
|
|
||||||
any = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return any;
|
return any;
|
||||||
|
|
@ -244,6 +251,7 @@ inline VSymEnt::VSymEnt(VSymGraph* m_graphp, AstNode* nodep)
|
||||||
m_fallbackp = NULL;
|
m_fallbackp = NULL;
|
||||||
m_parentp = NULL;
|
m_parentp = NULL;
|
||||||
m_packagep = NULL;
|
m_packagep = NULL;
|
||||||
|
m_importable = true;
|
||||||
m_graphp->pushNewEnt(this);
|
m_graphp->pushNewEnt(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,31 @@
|
||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed into the Public Domain, for any use,
|
||||||
|
// without warranty, 2012 by Jeremy Bennett
|
||||||
|
|
||||||
|
// see bug 591
|
||||||
|
|
||||||
|
package pkg2;
|
||||||
|
parameter PARAM2 = 16;
|
||||||
|
endpackage // pkg2
|
||||||
|
|
||||||
|
package pkg1;
|
||||||
|
import pkg2::*;
|
||||||
|
parameter PARAM1 = 8;
|
||||||
|
endpackage // pkg1
|
||||||
|
|
||||||
|
module t (/*AUTOARG*/
|
||||||
|
// Inputs
|
||||||
|
clk
|
||||||
|
);
|
||||||
|
input clk;
|
||||||
|
|
||||||
|
import pkg1::*;
|
||||||
|
|
||||||
|
reg [PARAM1:0] bus1;
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue