Fix task inlining under , bug589.

This commit is contained in:
Wilson Snyder 2012-12-15 21:41:37 -05:00
parent e68afa53a8
commit 4c7f051247
3 changed files with 10 additions and 4 deletions

View File

@ -9,6 +9,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix non-integer vpi_get_value, bug587. [Rich Porter]
**** Fix task inlining under $display, bug589. [Holger Waechtler]
* Verilator 3.843 2012/12/01

View File

@ -1913,7 +1913,7 @@ public:
bool hidden() const { return m_hidden; }
};
struct AstDisplay : public AstNode {
struct AstDisplay : public AstNodeStmt {
// Parents: stmtlist
// Children: file which must be a varref
// Children: SFORMATF to generate print string
@ -1921,7 +1921,7 @@ private:
AstDisplayType m_displayType;
public:
AstDisplay(FileLine* fileline, AstDisplayType dispType, const string& text, AstNode* filep, AstNode* exprsp)
: AstNode (fileline) {
: AstNodeStmt (fileline) {
setOp1p(new AstSFormatF(fileline,text,true,exprsp));
setNOp3p(filep);
m_displayType = dispType;
@ -1976,11 +1976,11 @@ struct AstSFormat : public AstNode {
void lhsp(AstNode* nodep) { setOp3p(nodep); }
};
struct AstSysIgnore : public AstNode {
struct AstSysIgnore : public AstNodeStmt {
// Parents: stmtlist
// Children: varrefs or exprs
AstSysIgnore(FileLine* fileline, AstNode* exprsp)
: AstNode (fileline) { addNOp1p(exprsp); }
: AstNodeStmt (fileline) { addNOp1p(exprsp); }
ASTNODE_NODE_FUNCS(SysIgnore, SYSIGNORE)
virtual string verilogKwd() const { return "$ignored"; }
virtual bool isGateOptimizable() const { return false; } // Though deleted before opt

View File

@ -979,9 +979,13 @@ private:
// Iterate into the FTask we are calling. Note it may be under a different
// scope then the caller, so we need to restore state.
AstScope* oldscopep = m_scopep;
InsertMode prevInsMode = m_insMode;
AstNode* prevInsStmtp = m_insStmtp;
m_scopep = m_statep->getScope(nodep);
nodep->accept(*this);
m_scopep = oldscopep;
m_insMode = prevInsMode;
m_insStmtp = prevInsStmtp;
}
void insertBeforeStmt(AstNode* nodep, AstNode* newp) {
// See also AstNode::addBeforeStmt; this predates that function