diff --git a/src/V3Active.cpp b/src/V3Active.cpp index 93696b8b1..059de9366 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -301,7 +301,7 @@ private: m_namer.scopep()->addActivep(m_scopeFinalp); } nodep->unlinkFrBack(); - m_scopeFinalp->addStmtsp(new AstComment(nodep->fileline(), nodep->typeName())); + m_scopeFinalp->addStmtsp(new AstComment(nodep->fileline(), nodep->typeName(), true)); m_scopeFinalp->addStmtsp(nodep->bodysp()->unlinkFrBackWithNext()); nodep->deleteTree(); VL_DANGLING(nodep); } diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 19d0f13ba..226c3b7f4 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -2387,15 +2387,17 @@ class AstComment : public AstNodeStmt { // Parents: {statement list} // Children: none private: + bool m_showAt; // Show "at " string m_name; // Text of comment public: - AstComment(FileLine* fl, const string& name) + AstComment(FileLine* fl, const string& name, bool showAt=false) : AstNodeStmt(fl) - , m_name(name) {} + , m_showAt(showAt), m_name(name) {} ASTNODE_NODE_FUNCS(Comment) virtual string name() const { return m_name; } // * = Text virtual V3Hash sameHash() const { return V3Hash(); } // Ignore name in comments virtual bool same(const AstNode* samep) const { return true; } // Ignore name in comments + virtual bool showAt() const { return m_showAt; } }; class AstCond : public AstNodeCond { diff --git a/src/V3Clock.cpp b/src/V3Clock.cpp index 39fdda0ee..8ef9ec3f1 100644 --- a/src/V3Clock.cpp +++ b/src/V3Clock.cpp @@ -271,7 +271,7 @@ private: m_scopep = NULL; } virtual void visit(AstAlways* nodep) { - AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName()); + AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true); nodep->replaceWith(cmtp); if (AstNode* stmtsp = nodep->bodysp()) { stmtsp->unlinkFrBackWithNext(); @@ -280,7 +280,7 @@ private: nodep->deleteTree(); VL_DANGLING(nodep); } virtual void visit(AstAlwaysPost* nodep) { - AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName()); + AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true); nodep->replaceWith(cmtp); if (AstNode* stmtsp = nodep->bodysp()) { stmtsp->unlinkFrBackWithNext(); @@ -309,7 +309,7 @@ private: nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep); } virtual void visit(AstInitial* nodep) { - AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName()); + AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true); nodep->replaceWith(cmtp); if (AstNode* stmtsp = nodep->bodysp()) { stmtsp->unlinkFrBackWithNext(); diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index a5ccf8313..0257df134 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -236,7 +236,9 @@ public: nodep->v3fatalSrc("Case statements should have been reduced out"); } virtual void visit(AstComment* nodep) { - putsDecoration(string("// ")+nodep->name()+" at "+nodep->fileline()->ascii()+"\n"); + string at; + if (nodep->showAt()) at = " at "+nodep->fileline()->ascii(); + putsDecoration(string("// ")+nodep->name()+at+"\n"); iterateChildren(nodep); } virtual void visit(AstCoverDecl* nodep) { diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 54952a913..9ff27b8db 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -364,7 +364,8 @@ private: // outvscp is the variable for functions only, if NULL, it's a task UASSERT_OBJ(refp->taskp(), refp, "Unlinked?"); AstNode* newbodysp = AstNode::cloneTreeNull(refp->taskp()->stmtsp(), true); // Maybe NULL - AstNode* beginp = new AstComment(refp->fileline(), string("Function: ")+refp->name()); + AstNode* beginp = new AstComment(refp->fileline(), + string("Function: ")+refp->name(), true); if (newbodysp) beginp->addNext(newbodysp); if (debug()>=9) { beginp->dumpTreeAndNext(cout, "-newbegi:"); } // @@ -483,7 +484,8 @@ private: AstCFunc* cfuncp = m_statep->ftaskCFuncp(refp->taskp()); UASSERT_OBJ(cfuncp, refp, "No non-inline task associated with this task call?"); // - AstNode* beginp = new AstComment(refp->fileline(), string("Function: ")+refp->name()); + AstNode* beginp = new AstComment(refp->fileline(), + string("Function: ")+refp->name(), true); AstCCall* ccallp = new AstCCall(refp->fileline(), cfuncp, NULL); beginp->addNext(ccallp); // Convert complicated outputs to temp signals diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index 79067529d..4f535304b 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -684,7 +684,7 @@ private: || nodep == v3Global.rootp()->evalp()) { // Need a non-null place to remember to later add a statement; make one if (!nodep->stmtsp()) nodep->addStmtsp( - new AstComment(nodep->fileline(), "Tracing activity check")); + new AstComment(nodep->fileline(), "Tracing activity check", true)); V3GraphVertex* activityVtxp = getActivityVertexp(nodep->stmtsp(), nodep->slow()); new V3GraphEdge(&m_graph, activityVtxp, funcVtxp, 1); } diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index 11be3e04d..d1be9c725 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -130,7 +130,8 @@ private: void addIgnore(const char* why) { ++m_statIgnSigs; m_initSubFuncp->addStmtsp( - new AstComment(m_traVscp->fileline(), "Tracing: "+m_traShowname+" // Ignored: "+why)); + new AstComment(m_traVscp->fileline(), + "Tracing: "+m_traShowname+" // Ignored: "+why, true)); } // VISITORS