From 9a96f621eff087ef5ca76043d9be3d92a6fae274 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 18 Apr 2011 10:47:02 -0400 Subject: [PATCH] Fix CDCRSTLOGIC report showing endpoint flops without resets. --- Changes | 2 ++ src/V3Cdc.cpp | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 7fd23e17a..4d38b3a6d 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix error on enum references to other packages, bug339. [Alex Solomatnikov] +**** Fix CDCRSTLOGIC report showing endpoint flops without resets. + * Verilator 3.812 2011/04/06 *** Add --trace-max-width and --trace-max-array, bug319. [Alex Solomatnikov] diff --git a/src/V3Cdc.cpp b/src/V3Cdc.cpp index 54526858a..78b97bf05 100644 --- a/src/V3Cdc.cpp +++ b/src/V3Cdc.cpp @@ -46,6 +46,8 @@ #include "V3EmitV.h" #include "V3File.h" +#define CDC_WEIGHT_ASYNC 0x1000 // Weight for edges that feed async logic + //###################################################################### class CdcBaseVisitor : public AstNVisitor { @@ -314,7 +316,9 @@ private: UINFO(3,__FUNCTION__<<": "<6) m_graph.dump(); if (debug()>6) m_graph.dumpDotFilePrefixed("cdc_pre"); - m_graph.removeRedundantEdgesSum(&V3GraphEdge::followAlwaysTrue); + // + m_graph.removeRedundantEdges(&V3GraphEdge::followAlwaysTrue); // This will MAX across edge weights + // m_graph.dumpDotFilePrefixed("cdc_simp"); // analyzeReset(); @@ -411,12 +415,15 @@ private: CdcEitherVertex* eToVertexp = (CdcEitherVertex*)edgep->top(); if (!eToVertexp) targetp = eToVertexp; if (CdcLogicVertex* vvertexp = dynamic_cast(eToVertexp)) { - if (vvertexp->isFlop()) { + if (vvertexp->isFlop() // IE the target flop that is upsetting us + && edgep->weight() >= CDC_WEIGHT_ASYNC) { // And this signal feeds an async reset line targetp = eToVertexp; + //UINFO(9," targetasync "<name()<<" "<<" from "<name()<name()<<" "<nodep()->fileline()<nodep(),V3ErrorCode::CDCRSTLOGIC,"Logic in path that feeds async reset, via signal: "+nodep->prettyName()); dumpAsyncRecurse(targetp, "", " ",0); } @@ -618,8 +625,9 @@ private: if (!varscp) nodep->v3fatalSrc("Var didn't get varscoped in V3Scope.cpp\n"); CdcVarVertex* varvertexp = makeVarVertex(varscp); UINFO(5," VARREF to "<lvalue()) { new V3GraphEdge(&m_graph, m_logicVertexp, varvertexp, 1); if (m_inDly) { @@ -628,7 +636,13 @@ private: varvertexp->srcDomainSet(true); } } else { - new V3GraphEdge(&m_graph, varvertexp, m_logicVertexp, 1); + if (varvertexp->cntAsyncRst()) { + //UINFO(9," edgeasync "<name()<<" to "<name()<<" to "<