Fix imports causing symbol table error, bug490.
This commit is contained in:
parent
fb90e47e70
commit
f3867d7f80
1
Changes
1
Changes
|
|
@ -15,6 +15,7 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||||
|
|
||||||
*** Fix generate operators not short circuiting, bug413. [by Jeremy Bennett]
|
*** Fix generate operators not short circuiting, bug413. [by Jeremy Bennett]
|
||||||
|
|
||||||
|
**** Fix imports causing symbol table error, bug490. [Alex Solomatnikov]
|
||||||
|
|
||||||
* Verilator 3.833 2012/04/15
|
* Verilator 3.833 2012/04/15
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -215,18 +215,17 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep, AstNUser* vup) {
|
||||||
// Top scope
|
// Top scope
|
||||||
m_curVarsp = symsFindNew(nodep, NULL);
|
m_curVarsp = symsFindNew(nodep, NULL);
|
||||||
// And recurse...
|
// Recurse..., backward as must do packages before using packages
|
||||||
// Recurse...
|
|
||||||
m_idState = ID_FIND;
|
m_idState = ID_FIND;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
if (debug()==9) m_curVarsp->dump(cout,"-curvars: ",true/*user4p_is_table*/);
|
if (debug()==9) m_curVarsp->dump(cout,"-curvars: ",true/*user4p_is_table*/);
|
||||||
m_idState = ID_PARAM;
|
m_idState = ID_PARAM;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
m_idState = ID_RESOLVE;
|
m_idState = ID_RESOLVE;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
nodep->checkTree();
|
nodep->checkTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,13 @@ private:
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void visit(AstPackageImport* nodep, AstNUser*) {
|
||||||
|
// Package Import: We need to do the package before the use of a package
|
||||||
|
nodep->iterateChildren(*this);
|
||||||
|
if (!nodep->packagep()) nodep->v3fatalSrc("Unlinked package"); // Parser should set packagep
|
||||||
|
new V3GraphEdge(&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep, AstNUser*) {
|
||||||
// Cell: Resolve its filename. If necessary, parse it.
|
// Cell: Resolve its filename. If necessary, parse it.
|
||||||
if (!nodep->modp()) {
|
if (!nodep->modp()) {
|
||||||
|
|
|
||||||
|
|
@ -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,27 @@
|
||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed into the Public Domain, for any use,
|
||||||
|
// without warranty, 2012 by Wilson Snyder.
|
||||||
|
|
||||||
|
// see bug491
|
||||||
|
|
||||||
|
package functions;
|
||||||
|
function real abs (real num);
|
||||||
|
abs = (num <0) ? -num : num;
|
||||||
|
endfunction
|
||||||
|
endpackage
|
||||||
|
|
||||||
|
module t ();
|
||||||
|
import functions::*;
|
||||||
|
localparam P = 1;
|
||||||
|
generate
|
||||||
|
if (P == 1) begin
|
||||||
|
initial begin
|
||||||
|
if (abs(-2.1) != 2.1) $stop;
|
||||||
|
if (abs(2.2) != 2.2) $stop;
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
endgenerate
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue