Fix package logic var compile error.

This commit is contained in:
Wilson Snyder 2013-01-17 19:04:36 -05:00
parent 410e6ff203
commit 385c166830
3 changed files with 14 additions and 2 deletions

View File

@ -18,6 +18,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix implicit one bit parameter selection, bug603. [Jeremy Bennett]
**** Fix package logic var compile error.
* Verilator 3.844 2013/01/09

View File

@ -46,8 +46,10 @@ private:
// NODE STATE
// AstVar::user1p -> AstVarScope replacement for this variable
// AstTask::user2p -> AstTask*. Replacement task
// AstVar::user3p -> AstVarScope for packages
AstUser1InUse m_inuser1;
AstUser2InUse m_inuser2;
AstUser3InUse m_inuser3;
// STATE, inside processing a single module
AstNodeModule* m_modp; // Current module
@ -201,10 +203,12 @@ private:
}
virtual void visit(AstVar* nodep, AstNUser*) {
// Make new scope variable
if (!nodep->user1p()) {
if (m_modp->castPackage()
? !nodep->user3p() : !nodep->user1p()) {
AstVarScope* varscp = new AstVarScope(nodep->fileline(), m_scopep, nodep);
UINFO(6," New scope "<<varscp<<endl);
nodep->user1p(varscp);
if (m_modp->castPackage()) nodep->user3p(varscp);
m_scopep->addVarp(varscp);
}
}
@ -212,7 +216,9 @@ private:
// VarRef needs to point to VarScope
// Make sure variable has made user1p.
nodep->varp()->accept(*this);
AstVarScope* varscp = (AstVarScope*)nodep->varp()->user1p();
AstVarScope* varscp = nodep->packagep()
? (AstVarScope*)nodep->varp()->user3p()
: (AstVarScope*)nodep->varp()->user1p();
if (!varscp) nodep->v3fatalSrc("Can't locate varref scope");
nodep->varScopep(varscp);
}

View File

@ -45,6 +45,10 @@ module t (/*AUTOARG*/
$write("*-* All Finished *-*\n");
$finish;
end
always @ (posedge clk) begin
p::pi += 1;
if (p::pi < 124) $stop;
end
endmodule
module t2;