mirror of
https://github.com/verilator/verilator.git
synced 2025-04-29 20:16:53 +00:00
Internals: Remove dead loop-related code in V3Order.cpp and V3OrderGraph.h
Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
parent
71b2eeef67
commit
cb72390b57
@ -127,21 +127,19 @@ public:
|
||||
V3List<OrderMoveVertex*> m_readyVertices; // Ready vertices with same domain & scope
|
||||
private:
|
||||
bool m_onReadyList; // True if DomScope is already on list of ready dom/scopes
|
||||
AstSenTree* m_domainp; // Domain all vertices belong to
|
||||
AstScope* m_scopep; // Scope all vertices belong to
|
||||
OrderLoopId m_inLoop; // Loop member of
|
||||
const AstSenTree* m_domainp; // Domain all vertices belong to
|
||||
const AstScope* m_scopep; // Scope all vertices belong to
|
||||
|
||||
typedef pair<pair<OrderLoopId, AstSenTree*>, AstScope*> DomScopeKey;
|
||||
typedef pair<const AstSenTree*, const AstScope*> DomScopeKey;
|
||||
typedef std::map<DomScopeKey, OrderMoveDomScope*> DomScopeMap;
|
||||
static DomScopeMap s_dsMap; // Structure registered for each dom/scope pairing
|
||||
|
||||
public:
|
||||
OrderMoveDomScope(OrderLoopId inLoop, AstSenTree* domainp, AstScope* scopep)
|
||||
: m_onReadyList(false), m_domainp(domainp), m_scopep(scopep), m_inLoop(inLoop) {}
|
||||
OrderMoveDomScope(const AstSenTree* domainp, const AstScope* scopep)
|
||||
: m_onReadyList(false), m_domainp(domainp), m_scopep(scopep) {}
|
||||
OrderMoveDomScope* readyDomScopeNextp() const { return m_readyDomScopeE.nextp(); }
|
||||
OrderLoopId inLoop() const { return m_inLoop; }
|
||||
AstSenTree* domainp() const { return m_domainp; }
|
||||
AstScope* scopep() const { return m_scopep; }
|
||||
const AstSenTree* domainp() const { return m_domainp; }
|
||||
const AstScope* scopep() const { return m_scopep; }
|
||||
void ready(OrderVisitor* ovp); // Check the domScope is on ready list, add if not
|
||||
void movedVertex(OrderVisitor* ovp, OrderMoveVertex* vertexp); // Mark one vertex as finished, remove from ready list if done
|
||||
// STATIC MEMBERS (for lookup)
|
||||
@ -152,20 +150,20 @@ public:
|
||||
s_dsMap.clear();
|
||||
}
|
||||
V3List<OrderMoveVertex*>& readyVertices() { return m_readyVertices; }
|
||||
static OrderMoveDomScope* findCreate (OrderLoopId inLoop, AstSenTree* domainp, AstScope* scopep) {
|
||||
const DomScopeKey key = make_pair(make_pair(inLoop,domainp),scopep);
|
||||
static OrderMoveDomScope* findCreate(const AstSenTree* domainp,
|
||||
const AstScope* scopep) {
|
||||
const DomScopeKey key = make_pair(domainp,scopep);
|
||||
DomScopeMap::iterator iter = s_dsMap.find(key);
|
||||
if (iter != s_dsMap.end()) {
|
||||
return iter->second;
|
||||
} else {
|
||||
OrderMoveDomScope* domScopep = new OrderMoveDomScope(inLoop, domainp, scopep);
|
||||
OrderMoveDomScope* domScopep = new OrderMoveDomScope(domainp, scopep);
|
||||
s_dsMap.insert(make_pair(key, domScopep));
|
||||
return domScopep;
|
||||
}
|
||||
}
|
||||
string name() const {
|
||||
return (string("MDS:")
|
||||
+" lp="+cvtToStr(inLoop())
|
||||
+" d="+cvtToStr((void*)domainp())
|
||||
+" s="+cvtToStr((void*)scopep()));
|
||||
}
|
||||
@ -520,19 +518,6 @@ private:
|
||||
return varVxp;
|
||||
}
|
||||
|
||||
V3GraphEdge* findEndEdge(V3GraphVertex* vertexp, AstNode* errnodep, OrderLoopEndVertex*& evertexpr) {
|
||||
// Given a vertex, find the end block corresponding to it
|
||||
// Every vertex should have a pointer to the end block (one hopes)
|
||||
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) {
|
||||
if (OrderLoopEndVertex* evertexp = dynamic_cast<OrderLoopEndVertex*>(edgep->top())) {
|
||||
evertexpr = evertexp;
|
||||
return edgep;
|
||||
}
|
||||
}
|
||||
errnodep->v3fatalSrc("Loop-broken vertex doesn't have pointer to LoopEndVertex: "<<vertexp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool isClkAssign(AstNodeAssign* nodep) {
|
||||
if (AstVarRef* varrefp = nodep->lhsp()->castVarRef()) {
|
||||
if (varrefp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
||||
@ -922,7 +907,7 @@ private:
|
||||
}
|
||||
virtual void visit(AstSenTree* nodep) {
|
||||
// Having a node derived from the sentree isn't required for
|
||||
// correctness, it mearly makes the graph better connected
|
||||
// correctness, it merely makes the graph better connected
|
||||
// and improves graph algorithmic performance
|
||||
if (m_scopep) { // Else TOPSCOPE's SENTREE list
|
||||
m_inSenTree = true;
|
||||
@ -1198,7 +1183,6 @@ void OrderVisitor::processDomainsIterate(OrderEitherVertex* vertexp) {
|
||||
// Combo logic may be pushed into a seq domain if all its inputs are the same domain,
|
||||
// else, if all inputs are from flops, it's end-of-sequential code
|
||||
// else, it's full combo code
|
||||
if (!vertexp->inLoop()) vertexp->inLoop(LOOPID_NOTLOOPED);
|
||||
if (vertexp->domainp()) return; // Already processed, or sequential logic
|
||||
UINFO(5," pdi: "<<vertexp<<endl);
|
||||
OrderVarVertex* vvertexp = dynamic_cast<OrderVarVertex*>(vertexp);
|
||||
@ -1481,9 +1465,8 @@ void OrderVisitor::processMovePrepScopes() {
|
||||
for (OrderMoveVertex* vertexp = m_pomWaiting.begin(); vertexp; vertexp=vertexp->pomWaitingNextp()) {
|
||||
AstSenTree* domainp = vertexp->logicp()->domainp();
|
||||
AstScope* scopep = vertexp->logicp()->scopep();
|
||||
OrderLoopId inLoop = vertexp->logicp()->inLoop();
|
||||
// Create the dom pairing for later lookup
|
||||
OrderMoveDomScope* domScopep = OrderMoveDomScope::findCreate(inLoop, domainp, scopep);
|
||||
OrderMoveDomScope* domScopep = OrderMoveDomScope::findCreate(domainp, scopep);
|
||||
vertexp->domScopep(domScopep);
|
||||
}
|
||||
}
|
||||
@ -1595,7 +1578,6 @@ void OrderVisitor::processMoveOne(OrderMoveVertex* vertexp, OrderMoveDomScope* d
|
||||
inline void OrderMoveDomScope::ready(OrderVisitor* ovp) { // Check the domScope is on ready list, add if not
|
||||
if (!m_onReadyList) {
|
||||
m_onReadyList = true;
|
||||
UASSERT (inLoop()!=0, "Loop# 0 is illegal, perhaps should be LOOPID_NOTLOOPED?");
|
||||
m_readyDomScopeE.pushBack(ovp->m_pomReadyDomScope, this);
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,6 @@
|
||||
// OrderInputsVertex
|
||||
// OrderSettleVertex
|
||||
// OrderLogicVertex
|
||||
// OrderLoopBeginVertex
|
||||
// OrderLoopEndVertex
|
||||
// OrderVarVertex
|
||||
// OrderVarStdVertex
|
||||
// OrderVarPreVertex
|
||||
@ -36,12 +34,15 @@
|
||||
//
|
||||
// V3GraphEdge
|
||||
// OrderEdge
|
||||
// OrderChangeDetEdge
|
||||
// OrderComboCutEdge
|
||||
// OrderPostCutEdge
|
||||
// OrderPreCutEdge
|
||||
//*************************************************************************
|
||||
|
||||
|
||||
#ifndef _V3ORDERGRAPH_H_
|
||||
#define _V3ORDERGRAPH_H_
|
||||
|
||||
#include "config_build.h"
|
||||
#include "verilatedos.h"
|
||||
#include "V3Ast.h"
|
||||
@ -62,13 +63,6 @@ enum OrderWeights {
|
||||
WEIGHT_MEDIUM = 8, // Medium weight just so dot graph looks nice
|
||||
WEIGHT_NORMAL = 32 }; // High weight just so dot graph looks nice
|
||||
|
||||
enum OrderLoopId {
|
||||
LOOPID_UNKNOWN = 0, // Not assigned yet
|
||||
LOOPID_NOTLOOPED=1, // Not looped
|
||||
LOOPID_FIRST = 2, // First assigned id (numbers increment from here)
|
||||
LOOPID_MAX = (1<<30)
|
||||
};
|
||||
|
||||
struct OrderVEdgeType {
|
||||
enum en {
|
||||
VERTEX_UNKNOWN = 0,
|
||||
@ -80,8 +74,6 @@ struct OrderVEdgeType {
|
||||
VERTEX_VARPOST,
|
||||
VERTEX_VARPORD,
|
||||
VERTEX_VARSETTLE,
|
||||
VERTEX_LOOPBEGIN,
|
||||
VERTEX_LOOPEND,
|
||||
VERTEX_MOVE,
|
||||
EDGE_STD,
|
||||
EDGE_CHANGEDET,
|
||||
@ -94,11 +86,9 @@ struct OrderVEdgeType {
|
||||
static const char* const names[] = {
|
||||
"%E-vedge", "VERTEX_INPUTS", "VERTEX_SETTLE", "VERTEX_LOGIC",
|
||||
"VERTEX_VARSTD", "VERTEX_VARPRE", "VERTEX_VARPOST",
|
||||
"VERTEX_VARPORD", "VERTEX_VARSETTLE", "VERTEX_LOOPBEGIN",
|
||||
"VERTEX_LOOPEND", "VERTEX_MOVE",
|
||||
"VERTEX_VARPORD", "VERTEX_VARSETTLE", "VERTEX_MOVE",
|
||||
"EDGE_STD", "EDGE_CHANGEDET", "EDGE_COMBOCUT",
|
||||
"EDGE_PRECUT", "EDGE_POSTCUT", "_ENUM_END"
|
||||
|
||||
};
|
||||
return names[m_e];
|
||||
}
|
||||
@ -139,16 +129,15 @@ public:
|
||||
class OrderEitherVertex : public V3GraphVertex {
|
||||
AstScope* m_scopep; // Scope the vertex is in
|
||||
AstSenTree* m_domainp; // Clock domain (NULL = to be computed as we iterate)
|
||||
OrderLoopId m_inLoop; // Loop number vertex is in
|
||||
bool m_isFromInput; // From input, or derived therefrom (conservatively false)
|
||||
protected:
|
||||
OrderEitherVertex(V3Graph* graphp, const OrderEitherVertex& old)
|
||||
: V3GraphVertex(graphp, old), m_scopep(old.m_scopep), m_domainp(old.m_domainp)
|
||||
, m_inLoop(old.m_inLoop), m_isFromInput(old.m_isFromInput) {}
|
||||
, m_isFromInput(old.m_isFromInput) {}
|
||||
public:
|
||||
OrderEitherVertex(V3Graph* graphp, AstScope* scopep, AstSenTree* domainp)
|
||||
: V3GraphVertex(graphp), m_scopep(scopep), m_domainp(domainp)
|
||||
, m_inLoop(LOOPID_UNKNOWN), m_isFromInput(false) {}
|
||||
, m_isFromInput(false) {}
|
||||
virtual ~OrderEitherVertex() {}
|
||||
virtual OrderEitherVertex* clone(V3Graph* graphp) const = 0;
|
||||
// Methods
|
||||
@ -159,8 +148,6 @@ public:
|
||||
void domainp(AstSenTree* domainp) { m_domainp = domainp; }
|
||||
AstScope* scopep() const { return m_scopep; }
|
||||
AstSenTree* domainp() const { return m_domainp; }
|
||||
OrderLoopId inLoop() const { return m_inLoop; }
|
||||
void inLoop(OrderLoopId inloop) { m_inLoop = inloop; }
|
||||
void isFromInput(bool flag) { m_isFromInput=flag; }
|
||||
bool isFromInput() const { return m_isFromInput; }
|
||||
};
|
||||
@ -319,62 +306,6 @@ public:
|
||||
virtual bool domainMatters() { return false; }
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
//--- Looping constructs
|
||||
|
||||
class OrderLoopBeginVertex : public OrderLogicVertex {
|
||||
// A vertex can never be under two loops...
|
||||
// However, a LoopBeginVertex is not "under" the loop per se, and it may be under another loop.
|
||||
OrderLoopId m_loopId; // Arbitrary # to ID this loop
|
||||
uint32_t m_loopColor; // Color # of loop (for debug)
|
||||
OrderLoopBeginVertex(V3Graph* graphp, const OrderLoopBeginVertex& old)
|
||||
: OrderLogicVertex(graphp, *this)
|
||||
, m_loopId(old.m_loopId), m_loopColor(old.m_loopColor) {}
|
||||
public:
|
||||
OrderLoopBeginVertex(V3Graph* graphp, AstScope* scopep, AstSenTree* domainp, AstUntilStable* nodep,
|
||||
OrderLoopId loopId, uint32_t loopColor)
|
||||
: OrderLogicVertex(graphp, scopep, domainp, nodep)
|
||||
, m_loopId(loopId), m_loopColor(loopColor) {}
|
||||
virtual ~OrderLoopBeginVertex() {}
|
||||
virtual OrderLoopBeginVertex* clone(V3Graph* graphp) const {
|
||||
return new OrderLoopBeginVertex(graphp, *this);
|
||||
}
|
||||
// Methods
|
||||
virtual OrderVEdgeType type() const { return OrderVEdgeType::VERTEX_LOOPBEGIN; }
|
||||
virtual string name() const { return "LoopBegin_"+cvtToStr(loopId())+"_c"+cvtToStr(loopColor()); }
|
||||
virtual bool domainMatters() { return true; }
|
||||
virtual string dotColor() const { return "blue"; }
|
||||
AstUntilStable* untilp() const { return nodep()->castUntilStable(); }
|
||||
OrderLoopId loopId() const { return m_loopId; }
|
||||
uint32_t loopColor() const { return m_loopColor; }
|
||||
};
|
||||
|
||||
class OrderLoopEndVertex : public OrderLogicVertex {
|
||||
// A end vertex points to the *same nodep* as the Begin, as we need it to
|
||||
// be a logic vertex for moving, but don't need a permanent node. We
|
||||
// won't add to the output graph though, so it shouldn't matter.
|
||||
OrderLoopBeginVertex* m_beginVertexp; // Corresponding loop begin
|
||||
OrderLoopEndVertex(V3Graph* graphp, const OrderLoopEndVertex& old)
|
||||
: OrderLogicVertex(graphp, old), m_beginVertexp(old.m_beginVertexp) {}
|
||||
public:
|
||||
OrderLoopEndVertex(V3Graph* graphp, OrderLoopBeginVertex* beginVertexp)
|
||||
: OrderLogicVertex(graphp, beginVertexp->scopep(),
|
||||
beginVertexp->domainp(), beginVertexp->nodep())
|
||||
, m_beginVertexp(beginVertexp) {
|
||||
inLoop(beginVertexp->loopId());
|
||||
}
|
||||
virtual ~OrderLoopEndVertex() {}
|
||||
virtual OrderLoopEndVertex* clone(V3Graph* graphp) const {
|
||||
return new OrderLoopEndVertex(graphp, *this); }
|
||||
// Methods
|
||||
virtual OrderVEdgeType type() const { return OrderVEdgeType::VERTEX_LOOPEND; }
|
||||
virtual string name() const { return "LoopEnd_"+cvtToStr(inLoop())+"_c"+cvtToStr(loopColor()); }
|
||||
virtual bool domainMatters() { return false; }
|
||||
virtual string dotColor() const { return "blue"; }
|
||||
OrderLoopBeginVertex* beginVertexp() const { return m_beginVertexp; }
|
||||
uint32_t loopColor() const { return beginVertexp()->loopColor(); }
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
//--- Following only under the move graph, not the main graph
|
||||
|
||||
@ -415,7 +346,6 @@ public:
|
||||
if (logicp()) {
|
||||
nm = logicp()->name();
|
||||
nm += (string("\\nMV:")
|
||||
+" lp="+cvtToStr(logicp()->inLoop())
|
||||
+" d="+cvtToStr((void*)logicp()->domainp())
|
||||
+" s="+cvtToStr((void*)logicp()->scopep()));
|
||||
} else {
|
||||
@ -471,23 +401,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class OrderChangeDetEdge : public OrderEdge {
|
||||
// Edge created from variable to OrderLoopEndVertex
|
||||
// Indicates a change detect will be required for this loop construct
|
||||
OrderChangeDetEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top,
|
||||
const OrderChangeDetEdge& old)
|
||||
: OrderEdge(graphp, fromp, top, old) {}
|
||||
public:
|
||||
OrderChangeDetEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top)
|
||||
: OrderEdge(graphp, fromp, top, WEIGHT_MEDIUM, false) {}
|
||||
virtual OrderVEdgeType type() const { return OrderVEdgeType::EDGE_CHANGEDET; }
|
||||
virtual ~OrderChangeDetEdge() {}
|
||||
virtual OrderChangeDetEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) const {
|
||||
return new OrderChangeDetEdge(graphp, fromp, top, *this);
|
||||
}
|
||||
virtual string dotColor() const { return "blue"; }
|
||||
};
|
||||
|
||||
class OrderComboCutEdge : public OrderEdge {
|
||||
// Edge created from output of combo logic
|
||||
// Breakable if the output var is also a input,
|
||||
@ -547,3 +460,5 @@ public:
|
||||
virtual bool followComboConnected() const { return false; }
|
||||
virtual bool followSequentConnected() const { return false; }
|
||||
};
|
||||
|
||||
#endif // _V3ORDERGRAPH_H_
|
||||
|
Loading…
Reference in New Issue
Block a user