clang-format remaining sources. No functional change.

This commit is contained in:
Wilson Snyder
2020-04-15 07:58:34 -04:00
parent 1b94e3b0e2
commit f3308d236b
85 changed files with 14640 additions and 13099 deletions
+75 -61
View File
@@ -38,9 +38,7 @@ protected:
// Utilities
void dump() {
if (debug()>=9) {
m_graph.dumpDotFilePrefixed("v3graphtest_"+name());
}
if (debug() >= 9) m_graph.dumpDotFilePrefixed("v3graphtest_" + name());
}
public:
@@ -56,9 +54,11 @@ public:
class V3GraphTestVertex : public V3GraphVertex {
string m_name;
public:
V3GraphTestVertex(V3Graph* graphp, const string& name)
: V3GraphVertex(graphp), m_name(name) {}
: V3GraphVertex(graphp)
, m_name(name) {}
virtual ~V3GraphTestVertex() {}
// ACCESSORS
virtual string name() const { return m_name; }
@@ -84,13 +84,13 @@ public:
V3Graph* gp = &m_graph;
// Verify we break edges at a good point
// A simple alg would make 3 breaks, below only requires b->i to break
V3GraphTestVertex* i = new V3GraphTestVarVertex(gp, "*INPUTS*");
V3GraphTestVertex* a = new V3GraphTestVarVertex(gp, "a");
V3GraphTestVertex* b = new V3GraphTestVarVertex(gp, "b");
V3GraphTestVertex* g1 = new V3GraphTestVarVertex(gp, "g1");
V3GraphTestVertex* g2 = new V3GraphTestVarVertex(gp, "g2");
V3GraphTestVertex* g3 = new V3GraphTestVarVertex(gp, "g3");
V3GraphTestVertex* q = new V3GraphTestVarVertex(gp, "q");
V3GraphTestVertex* i = new V3GraphTestVarVertex(gp, "*INPUTS*");
V3GraphTestVertex* a = new V3GraphTestVarVertex(gp, "a");
V3GraphTestVertex* b = new V3GraphTestVarVertex(gp, "b");
V3GraphTestVertex* g1 = new V3GraphTestVarVertex(gp, "g1");
V3GraphTestVertex* g2 = new V3GraphTestVarVertex(gp, "g2");
V3GraphTestVertex* g3 = new V3GraphTestVarVertex(gp, "g3");
V3GraphTestVertex* q = new V3GraphTestVarVertex(gp, "q");
new V3GraphEdge(gp, i, a, 2, true);
new V3GraphEdge(gp, a, b, 2, true);
new V3GraphEdge(gp, b, g1, 2, true);
@@ -106,11 +106,11 @@ public:
gp->stronglyConnected(&V3GraphEdge::followAlwaysTrue);
dump();
UASSERT(i->color()!=a->color() && a->color() != g2->color() && g2->color() != q->color(),
UASSERT(i->color() != a->color() && a->color() != g2->color() && g2->color() != q->color(),
"SelfTest: Separate colors not assigned");
UASSERT(a->color()==b->color() && a->color()==g1->color(),
UASSERT(a->color() == b->color() && a->color() == g1->color(),
"SelfTest: Strongly connected nodes not colored together");
UASSERT(g2->color()==g3->color(),
UASSERT(g2->color() == g3->color(),
"SelfTest: Strongly connected nodes not colored together");
}
};
@@ -122,12 +122,12 @@ public:
V3Graph* gp = &m_graph;
// Verify we break edges at a good point
// A simple alg would make 3 breaks, below only requires b->i to break
V3GraphTestVertex* i = new V3GraphTestVarVertex(gp, "*INPUTS*");
V3GraphTestVertex* a = new V3GraphTestVarVertex(gp, "a");
V3GraphTestVertex* b = new V3GraphTestVarVertex(gp, "b");
V3GraphTestVertex* g1 = new V3GraphTestVarVertex(gp, "g1");
V3GraphTestVertex* g2 = new V3GraphTestVarVertex(gp, "g2");
V3GraphTestVertex* g3 = new V3GraphTestVarVertex(gp, "g3");
V3GraphTestVertex* i = new V3GraphTestVarVertex(gp, "*INPUTS*");
V3GraphTestVertex* a = new V3GraphTestVarVertex(gp, "a");
V3GraphTestVertex* b = new V3GraphTestVarVertex(gp, "b");
V3GraphTestVertex* g1 = new V3GraphTestVarVertex(gp, "g1");
V3GraphTestVertex* g2 = new V3GraphTestVarVertex(gp, "g2");
V3GraphTestVertex* g3 = new V3GraphTestVarVertex(gp, "g3");
new V3GraphEdge(gp, i, a, 2, true);
new V3GraphEdge(gp, a, b, 2, true);
new V3GraphEdge(gp, b, g1, 2, true);
@@ -149,20 +149,20 @@ public:
virtual void runTest() {
V3Graph* gp = &m_graph;
V3GraphTestVertex* clk = new V3GraphTestVarVertex(gp, "$clk");
V3GraphTestVertex* clk = new V3GraphTestVarVertex(gp, "$clk");
V3GraphTestVertex* a = new V3GraphTestVarVertex(gp, "$a");
V3GraphTestVertex* a_dly = new V3GraphTestVarVertex(gp, "$a_dly");
V3GraphTestVertex* a_dlyblk= new V3GraphTestVarVertex(gp, "$a_dlyblk");
V3GraphTestVertex* b = new V3GraphTestVarVertex(gp, "$b");
V3GraphTestVertex* b_dly = new V3GraphTestVarVertex(gp, "$b_dly");
V3GraphTestVertex* b_dlyblk= new V3GraphTestVarVertex(gp, "$b_dlyblk");
V3GraphTestVertex* c = new V3GraphTestVarVertex(gp, "$c");
V3GraphTestVertex* i = new V3GraphTestVarVertex(gp, "$i");
V3GraphTestVertex* a = new V3GraphTestVarVertex(gp, "$a");
V3GraphTestVertex* a_dly = new V3GraphTestVarVertex(gp, "$a_dly");
V3GraphTestVertex* a_dlyblk = new V3GraphTestVarVertex(gp, "$a_dlyblk");
V3GraphTestVertex* b = new V3GraphTestVarVertex(gp, "$b");
V3GraphTestVertex* b_dly = new V3GraphTestVarVertex(gp, "$b_dly");
V3GraphTestVertex* b_dlyblk = new V3GraphTestVarVertex(gp, "$b_dlyblk");
V3GraphTestVertex* c = new V3GraphTestVarVertex(gp, "$c");
V3GraphTestVertex* i = new V3GraphTestVarVertex(gp, "$i");
V3GraphTestVertex* ap = new V3GraphTestVarVertex(gp, "$a_pre");
V3GraphTestVertex* bp = new V3GraphTestVarVertex(gp, "$b_pre");
V3GraphTestVertex* cp = new V3GraphTestVarVertex(gp, "$c_pre");
V3GraphTestVertex* ap = new V3GraphTestVarVertex(gp, "$a_pre");
V3GraphTestVertex* bp = new V3GraphTestVarVertex(gp, "$b_pre");
V3GraphTestVertex* cp = new V3GraphTestVarVertex(gp, "$c_pre");
V3GraphTestVertex* n;
@@ -177,26 +177,27 @@ public:
// Desired order between different _DLY blocks so we can elim temporaries
// implemented by cutable "pre" signal dependencies
n = new V3GraphTestVertex(gp, "*INPUTS*"); {
n = new V3GraphTestVertex(gp, "*INPUTS*");
{
new V3GraphEdge(gp, n, clk, 2);
new V3GraphEdge(gp, n, i, 2);
}
V3GraphTestVertex* posedge = n = new V3GraphTestVertex(gp, "*posedge clk*"); {
new V3GraphEdge(gp, clk, n, 2);
}
V3GraphTestVertex* posedge = n = new V3GraphTestVertex(gp, "*posedge clk*");
{ new V3GraphEdge(gp, clk, n, 2); }
// AssignPre's VarRefs on LHS: generate special BLK
// normal: VarRefs on LHS: generate normal
// underSBlock: VarRefs on RHS: consume 'pre' (required to save cutable tests)
n = new V3GraphTestVertex(gp, "a_dly<PRE=a"); {
n = new V3GraphTestVertex(gp, "a_dly<PRE=a");
{
new V3GraphEdge(gp, n, a_dlyblk, 2); // Block ordering
new V3GraphEdge(gp, n, a_dly, 2);
new V3GraphEdge(gp, ap, n, 2, true); // DESIRED delayed ordering (inp is required)
new V3GraphEdge(gp, posedge, n, 2);
}
n = new V3GraphTestVertex(gp, "b_dly<PRE=b"); {
n = new V3GraphTestVertex(gp, "b_dly<PRE=b");
{
new V3GraphEdge(gp, n, b_dlyblk, 2); // Block ordering
new V3GraphEdge(gp, n, b_dly, 2);
new V3GraphEdge(gp, bp, n, 2, true); // DESIRED delayed ordering
@@ -207,7 +208,8 @@ public:
// normal: VarRefs on LHS: generate normal
// underSBlock: VarRefs on RHS: generate 'pre' signals (cutable)
// SenItems: consume CLOCK dependency
n = new V3GraphTestVertex(gp, "a_dly<=b|c"); {
n = new V3GraphTestVertex(gp, "a_dly<=b|c");
{
new V3GraphEdge(gp, a_dlyblk, n, 2); // Block ordering in
new V3GraphEdge(gp, n, a_dly, 2);
// Note we don't include ap as we're generating a_dly
@@ -215,7 +217,8 @@ public:
new V3GraphEdge(gp, n, cp, 2); // DESIRED delayed usage
new V3GraphEdge(gp, posedge, n, 2);
}
n = new V3GraphTestVertex(gp, "b_dly<=a"); {
n = new V3GraphTestVertex(gp, "b_dly<=a");
{
new V3GraphEdge(gp, b_dlyblk, n, 2); // Block ordering in
new V3GraphEdge(gp, n, b_dly, 2);
new V3GraphEdge(gp, n, ap, 2); // DESIRED delayed usage
@@ -225,12 +228,14 @@ public:
// AssignPost's
// normal: VarRefs on LHS: generate normal
// underSBlock: VarRefs on RHS: consume normal
n = new V3GraphTestVertex(gp, "a=POST=a_dly"); {
n = new V3GraphTestVertex(gp, "a=POST=a_dly");
{
new V3GraphEdge(gp, n, a, 3);
new V3GraphEdge(gp, a_dly, n, 3);
new V3GraphEdge(gp, posedge, n, 2);
}
n = new V3GraphTestVertex(gp, "b=POST=b_dly"); {
n = new V3GraphTestVertex(gp, "b=POST=b_dly");
{
new V3GraphEdge(gp, n, b, 3);
new V3GraphEdge(gp, b_dly, n, 3);
new V3GraphEdge(gp, posedge, n, 2);
@@ -258,9 +263,12 @@ public:
//======================================================================
class DfaTestVertex : public DfaVertex {
string m_name;
string m_name;
public:
DfaTestVertex(DfaGraph* graphp, const string& name) : DfaVertex(graphp), m_name(name) {}
DfaTestVertex(DfaGraph* graphp, const string& name)
: DfaVertex(graphp)
, m_name(name) {}
virtual ~DfaTestVertex() {}
// ACCESSORS
virtual string name() const { return m_name; }
@@ -274,29 +282,31 @@ public:
DfaGraph* gp = &m_graph;
// NFA Pattern for ( (LR) | (L*R)) Z
DfaTestVertex* st = new DfaTestVertex(gp, "*START*"); st->start(true);
DfaTestVertex* sl = new DfaTestVertex(gp, "sL");
DfaTestVertex* srs = new DfaTestVertex(gp, "sR*");
DfaTestVertex* sls = new DfaTestVertex(gp, "sL*");
DfaTestVertex* sr = new DfaTestVertex(gp, "sR");
DfaTestVertex* sz = new DfaTestVertex(gp, "sZ");
DfaTestVertex* sac = new DfaTestVertex(gp, "*ACCEPT*"); sac->accepting(true);
DfaTestVertex* st = new DfaTestVertex(gp, "*START*");
st->start(true);
DfaTestVertex* sl = new DfaTestVertex(gp, "sL");
DfaTestVertex* srs = new DfaTestVertex(gp, "sR*");
DfaTestVertex* sls = new DfaTestVertex(gp, "sL*");
DfaTestVertex* sr = new DfaTestVertex(gp, "sR");
DfaTestVertex* sz = new DfaTestVertex(gp, "sZ");
DfaTestVertex* sac = new DfaTestVertex(gp, "*ACCEPT*");
sac->accepting(true);
VNUser L = VNUser::fromInt(0xaa);
VNUser R = VNUser::fromInt(0xbb);
VNUser Z = VNUser::fromInt(0xcc);
new DfaEdge(gp, st, sl, DfaEdge::EPSILON());
new DfaEdge(gp, sl, srs, L);
new DfaEdge(gp, st, sl, DfaEdge::EPSILON());
new DfaEdge(gp, sl, srs, L);
new DfaEdge(gp, srs, srs, R);
new DfaEdge(gp, srs, sz, Z);
new DfaEdge(gp, sz, sac, DfaEdge::EPSILON());
new DfaEdge(gp, srs, sz, Z);
new DfaEdge(gp, sz, sac, DfaEdge::EPSILON());
new DfaEdge(gp, st, sls, DfaEdge::EPSILON());
new DfaEdge(gp, st, sls, DfaEdge::EPSILON());
new DfaEdge(gp, sls, sls, L);
new DfaEdge(gp, sls, sr, R);
new DfaEdge(gp, sr, sz, Z);
new DfaEdge(gp, sz, sac, DfaEdge::EPSILON());
new DfaEdge(gp, sls, sr, R);
new DfaEdge(gp, sr, sz, Z);
new DfaEdge(gp, sz, sac, DfaEdge::EPSILON());
dump();
gp->nfaToDfa();
@@ -335,18 +345,22 @@ public:
}
};
// clang-format off
#ifdef GRAPH_IMPORT
# include "graph_export.cpp"
#endif
// clang-format on
//======================================================================
void V3Graph::selfTest() {
// Execute all of the tests
UINFO(2,__FUNCTION__<<": "<<endl);
UINFO(2, __FUNCTION__ << ": " << endl);
// clang-format off
{ V3GraphTestStrong test; test.run(); }
{ V3GraphTestAcyc test; test.run(); }
{ V3GraphTestVars test; test.run(); }
{ V3GraphTestDfa test; test.run(); }
{ V3GraphTestImport test; test.run(); }
// clang-format on
}