From 4100417f830026733459a75e3fae2cb991c4e35a Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 15 Dec 2006 22:28:18 +0000 Subject: [PATCH] Show known scopes when dotted errors show up git-svn-id: file://localhost/svn/verilator/trunk/verilator@839 77ca24e4-aefa-0310-84f0-b9a241c72d87 --- Changes | 2 ++ src/V3LinkDot.cpp | 44 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Changes b/Changes index 5e4c7d316..53683d320 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,8 @@ indicates the contributor was also the author of the fix; Thanks! * Verilator 3.62*** +*** When dotted signal lookup fails, help the user by showing known scopes. + **** Fix dotted references inside generated cells. [David Hewson] * Verilator 3.623 12/05/2006 diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 30534f9a0..c7864e00e 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -81,6 +81,26 @@ public: } return NULL; } + void errorScopes(AstNode* nodep) { + if (!this) { // Silence if we messed it up and aren't debugging + if (debug()) nodep->v3fatalSrc("Void pointer; perhaps used null vxp instead of okVxp?"); + return; + } + { + string scopes; + for (NameVtxMap::iterator it = m_nameToVtxMap.begin(); it!=m_nameToVtxMap.end(); ++it) { + if (scopes != "") scopes += ", "; + scopes += it->second->cellName(); + } + cerr<second->name()<findDotted(aboveVxp, scope, baddot); + LinkDotBaseVertex* okVxp; + aboveVxp = m_statep->findDotted(aboveVxp, scope, baddot, okVxp); if (!aboveVxp) nodep->v3fatalSrc("Can't find cell insertion point at '"<prettyName()); } { @@ -392,7 +416,8 @@ private: string dotted = dottedname.substr(0, pos); string ident = dottedname.substr(pos+strlen("__DOT__")); string baddot; - aboveVxp = m_statep->findDotted(aboveVxp, dotted, baddot); + LinkDotBaseVertex* okVxp; + aboveVxp = m_statep->findDotted(aboveVxp, dotted, baddot, okVxp); if (!aboveVxp) nodep->v3fatalSrc("Can't find cellinline insertion point at '"<prettyName()); m_statep->insertInline(aboveVxp, m_cellVxp, nodep, ident); } else { // No __DOT__, just directly underneath @@ -551,13 +576,14 @@ private: nodep->varp(NULL); // Module that is not in hiearchy. We'll be dead code eliminating it later. } else { string baddot; + LinkDotBaseVertex* okVxp; LinkDotBaseVertex* dotVxp = m_cellVxp; // Start search at current scope if (nodep->inlinedDots()!="") { // Correct for current scope string inl = AstNode::prettyName(nodep->inlinedDots()); - dotVxp = m_statep->findDotted(dotVxp, inl, baddot); + dotVxp = m_statep->findDotted(dotVxp, inl, baddot, okVxp); if (!dotVxp) nodep->v3fatalSrc("Couldn't resolve inlined scope '"<inlinedDots()); } - dotVxp = m_statep->findDotted(dotVxp, nodep->dotted(), baddot); // Maybe NULL + dotVxp = m_statep->findDotted(dotVxp, nodep->dotted(), baddot, okVxp); // Maybe NULL if (!m_statep->forScopeCreation()) { AstVar* varp = (m_statep->findSym(dotVxp, nodep->name(), baddot) ->castVar()); // maybe NULL @@ -565,6 +591,7 @@ private: UINFO(7," Resolved "<varp()) { nodep->v3error("Can't find definition of '"<dotted()+"."+nodep->prettyName()); + okVxp->errorScopes(nodep); } } else { string baddot; @@ -572,6 +599,7 @@ private: ->castVarScope()); // maybe NULL if (!vscp) { nodep->v3error("Can't find varpin scope of '"<dotted()+"."+nodep->prettyName()); + okVxp->errorScopes(nodep); } else { while (vscp->user2p()) { // If V3Inline aliased it, pick up the new signal UINFO(7," Resolved pre-alias "<taskp(NULL); // Module that is not in hiearchy. We'll be dead code eliminating it later. } else { string baddot; + LinkDotBaseVertex* okVxp; LinkDotBaseVertex* dotVxp = m_cellVxp; // Start search at current scope if (nodep->inlinedDots()!="") { // Correct for current scope string inl = AstNode::prettyName(nodep->inlinedDots()); UINFO(8,"\t\tInlined "<findDotted(dotVxp, inl, baddot); + dotVxp = m_statep->findDotted(dotVxp, inl, baddot, okVxp); if (!dotVxp) nodep->v3fatalSrc("Couldn't resolve inlined scope '"<inlinedDots()); } - dotVxp = m_statep->findDotted(dotVxp, nodep->dotted(), baddot); // Maybe NULL + dotVxp = m_statep->findDotted(dotVxp, nodep->dotted(), baddot, okVxp); // Maybe NULL AstNodeFTask* taskp = (m_statep->findSym(dotVxp, nodep->name(), baddot) ->castNodeFTask()); // maybe NULL @@ -610,6 +639,7 @@ private: UINFO(7," Resolved "<taskp()) { nodep->v3error("Can't find definition of '"<dotted()+"."+nodep->prettyName()); + okVxp->errorScopes(nodep); } } nodep->iterateChildren(*this);