diff --git a/Changes b/Changes index 390a82298..ef0170b4a 100644 --- a/Changes +++ b/Changes @@ -12,6 +12,8 @@ indicates the contributor was also the author of the fix; Thanks! *** Add by-design and by-module subtotals to verilator_profcfunc. +*** Fix extra evaluation of pure combo blocks in SystemC output. + **** Add IMPERFECTSCH warning, disabled by default. * Verilator 3.670 2008/07/23 diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index a950496f9..6213d1a46 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -417,3 +417,7 @@ void AstCCall::dump(ostream& str) { funcp()->dump(str); } } +void AstCFunc::dump(ostream& str) { + this->AstNode::dump(str); + if (slow()) str<<" [SLOW]"; +} diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index ea068bb28..6c5fc0256 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -3143,6 +3143,7 @@ public: virtual string name() const { return m_name; } virtual bool broken() const { return ( (m_scopep && !m_scopep->brokeExists())); } virtual bool maybePointedTo() const { return true; } + virtual void dump(ostream& str=cout); virtual V3Hash sameHash() const { return V3Hash(); } virtual bool same(AstNode* samep) const { return ((funcType()==samep->castCFunc()->funcType()) && (rtnTypeVoid()==samep->castCFunc()->rtnTypeVoid()) diff --git a/src/V3Order.cpp b/src/V3Order.cpp index 8440bc2f0..f68c0b5eb 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -256,7 +256,7 @@ private: AstSenTree* m_deleteDomainp;// Delete this from tree AstSenTree* m_settleDomainp;// Initial activation tree OrderInputsVertex* m_inputsVxp; // Top level vertex all inputs point from - OrderSettleVertex* m_settleVxp; // Top level vertex all inputs point from + OrderSettleVertex* m_settleVxp; // Top level vertex all settlement vertexes point from OrderLogicVertex* m_logicVxp; // Current statement being tracked, NULL=ignored AstTopScope* m_topScopep; // Current top scope being processed AstScope* m_scopetopp; // Scope under TOPSCOPE @@ -341,6 +341,8 @@ private: OrderVarVertex* processInsLoopNewVar(OrderVarVertex* oldVertexp, bool& createdr); void processBrokeLoop(); void processCircular(); + void processInputs(); + void processInputsIterate(OrderEitherVertex* vertexp); void processSensitive(); void processDomains(); void processDomainsIterate(OrderEitherVertex* vertexp); @@ -927,6 +929,39 @@ void OrderVisitor::processBrokeLoop() { } } +//###################################################################### +// Clock propagation + +void OrderVisitor::processInputs() { + m_graph.userClearVertices(); // Vertex::user() // true if added as begin/end + processInputsIterate(m_inputsVxp); +} + +void OrderVisitor::processInputsIterate(OrderEitherVertex* vertexp) { + // Propagate PrimaryIn through simple assignments + if (vertexp->user()) return; // Already processed + //UINFO(9," InIt "<user(true); + if (OrderVarStdVertex* vvertexp = dynamic_cast(vertexp)) { + vvertexp->isFromInput(true); + } + for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep=edgep->outNextp()) { + OrderEitherVertex* toVertexp = (OrderEitherVertex*)edgep->top(); + if (OrderVarStdVertex* vvertexp = dynamic_cast(toVertexp)) { + processInputsIterate(vvertexp); + } + if (OrderLogicVertex* vvertexp = dynamic_cast(toVertexp)) { + if (AstNodeAssign* nodep = vvertexp->nodep()->castNodeAssign()) { + if (nodep->lhsp()->castVarRef() + && nodep->rhsp()->castVarRef()) { + UINFO(9," Input reassignment: "<verticesNextp()) { if (OrderVarStdVertex* vvertexp = dynamic_cast(itp)) { - if (vvertexp->isClock() && !vvertexp->varScp()->varp()->isPrimaryIn()) { + if (vvertexp->isClock() && !vvertexp->isFromInput()) { // If a clock is generated internally, we need to do another loop // through the entire evaluation. This fixes races; see t_clk_dpulse test. UINFO(5,"Circular Clock "<weight()==0) { // was cut OrderEdge* oedgep = dynamic_cast(edgep); if (!oedgep) vvertexp->varScp()->v3fatalSrc("Cuttable edge not of proper type"); + UINFO(6," CutCircularO: "<name()<weight()==0) { // was cut OrderEdge* oedgep = dynamic_cast(edgep); if (!oedgep) vvertexp->varScp()->v3fatalSrc("Cuttable edge not of proper type"); + UINFO(6," CutCircularI: "<name()<