forked from github/verilator
Fix public parameters in unused packages, bug804.
This commit is contained in:
parent
3234fa15ef
commit
e9c46afcf7
2
Changes
2
Changes
@ -9,6 +9,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||
|
||||
*** Add optimization of operators between concats, msg1447. [Jie Xu]
|
||||
|
||||
**** Fix public parameters in unused packages, bug804. [Jonathon Donaldson]
|
||||
|
||||
**** Fix generate unrolling with function call, bug830. [Steven Slatter]
|
||||
|
||||
**** Fix cast-to-size context-determined sizing, bug828. [Geoff Barrett]
|
||||
|
@ -81,6 +81,7 @@ private:
|
||||
typedef multimap<AstVarScope*,AstNodeAssign*> AssignMap;
|
||||
|
||||
// STATE
|
||||
AstNodeModule* m_modp; // Current module
|
||||
vector<AstNode*> m_varEtcsp; // List of all encountered to avoid another loop through tree
|
||||
vector<AstVarScope*> m_vscsp; // List of all encountered to avoid another loop through tree
|
||||
AssignMap m_assignMap; // List of all simple assignments for each variable
|
||||
@ -112,6 +113,12 @@ private:
|
||||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
checkAll(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
||||
nodep->iterateChildren(*this);
|
||||
checkAll(nodep);
|
||||
@ -168,6 +175,7 @@ private:
|
||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
||||
nodep->iterateChildren(*this);
|
||||
checkAll(nodep);
|
||||
if (nodep->isSigPublic() && m_modp && m_modp->castPackage()) m_modp->user1Inc();
|
||||
if (mightElim(nodep)) {
|
||||
m_varEtcsp.push_back(nodep);
|
||||
}
|
||||
@ -253,6 +261,7 @@ private:
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
DeadVisitor(AstNetlist* nodep, bool elimUserVars, bool elimDTypes) {
|
||||
m_modp = NULL;
|
||||
m_elimUserVars = elimUserVars;
|
||||
m_elimDTypes = elimDTypes;
|
||||
m_sideEffect = false;
|
||||
|
24
test_regress/t/t_param_public.cpp
Normal file
24
test_regress/t/t_param_public.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
||||
//
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2006 by Wilson Snyder.
|
||||
|
||||
#include <verilated.h>
|
||||
#include "Vt_param_public.h"
|
||||
|
||||
#include "Vt_param_public_p.h"
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
Vt_param_public *topp = new Vt_param_public;
|
||||
|
||||
Verilated::debug(0);
|
||||
|
||||
// Make sure public tag worked
|
||||
if (Vt_param_public_p::INPACK) {}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
topp->eval();
|
||||
}
|
||||
}
|
@ -7,8 +7,16 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
|
||||
compile (
|
||||
);
|
||||
if ($Self->{vlt}) {
|
||||
compile (
|
||||
verilator_flags2 => ["--exe $Self->{t_dir}/$Self->{name}.cpp"],
|
||||
make_top_shell => 0,
|
||||
make_main => 0,
|
||||
);
|
||||
} else {
|
||||
compile (
|
||||
);
|
||||
}
|
||||
|
||||
execute (
|
||||
check_finished=>1,
|
||||
|
@ -36,3 +36,8 @@ module b #(
|
||||
initial if ($c32("TWO") != 2) $stop;
|
||||
`endif
|
||||
endmodule
|
||||
|
||||
//bug804
|
||||
package p;
|
||||
localparam INPACK /*verilator public*/ = 6;
|
||||
endpackage
|
||||
|
Loading…
Reference in New Issue
Block a user