diff --git a/Changes b/Changes index 265c3cb0f..a9e55a251 100644 --- a/Changes +++ b/Changes @@ -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 diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 69e581006..844a87587 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -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 diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 5c0623374..f082e08e1 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -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