Add performance information to --stats file.

This commit is contained in:
Wilson Snyder 2017-09-17 22:52:57 -04:00
parent 1e9e334929
commit 63361fc56e
64 changed files with 172 additions and 90 deletions

View File

@ -10,6 +10,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Support module port parameters without defaults, bug 1213. [Mike Popoloski] **** Support module port parameters without defaults, bug 1213. [Mike Popoloski]
**** Add performance information to --stats file.
**** Fix LITENDIAN warning on arrayed cells, bug1202. [Mike Popoloski] **** Fix LITENDIAN warning on arrayed cells, bug1202. [Mike Popoloski]
**** Fix enum ranges without colons, bug1204. [Mike Popoloski] **** Fix enum ranges without colons, bug1204. [Mike Popoloski]

View File

@ -438,5 +438,5 @@ public:
void V3Active::activeAll(AstNetlist* nodep) { void V3Active::activeAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ActiveVisitor visitor (nodep); ActiveVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("active.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("active", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -160,5 +160,5 @@ public:
void V3ActiveTop::activeTopAll(AstNetlist* nodep) { void V3ActiveTop::activeTopAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ActiveTopVisitor visitor (nodep); ActiveTopVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("activetop.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("activetop", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -344,5 +344,5 @@ public:
void V3Assert::assertAll(AstNetlist* nodep) { void V3Assert::assertAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
AssertVisitor visitor (nodep); AssertVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("assert.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("assert", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -137,5 +137,5 @@ public:
void V3AssertPre::assertPreAll(AstNetlist* nodep) { void V3AssertPre::assertPreAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
AssertPreVisitor visitor (nodep); AssertPreVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("assertpre.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("assertpre", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -979,7 +979,7 @@ void AstNode::dumpTreeGdb() { // For GDB only
dumpTree(cout); dumpTree(cout);
} }
void AstNode::dumpTreeFileGdb(const char* filenamep) { // For GDB only void AstNode::dumpTreeFileGdb(const char* filenamep) { // For GDB only
string filename = filenamep ? filenamep : v3Global.debugFilename("debug.tree",98); string filename = filenamep ? filenamep : v3Global.debugFilename("debug",98);
v3Global.rootp()->dumpTreeFile(filename); v3Global.rootp()->dumpTreeFile(filename);
} }

View File

@ -296,5 +296,5 @@ void V3Begin::debeginAll(AstNetlist* nodep) {
if (state.anyFuncInBegin()) { if (state.anyFuncInBegin()) {
BeginRelinkVisitor brvisitor (nodep,&state); BeginRelinkVisitor brvisitor (nodep,&state);
} }
V3Global::dumpCheckGlobalTree("begin.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("begin", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -489,7 +489,7 @@ public:
void V3Case::caseAll(AstNetlist* nodep) { void V3Case::caseAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
CaseVisitor visitor (nodep); CaseVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("case.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("case", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
void V3Case::caseLint(AstNodeCase* nodep) { void V3Case::caseLint(AstNodeCase* nodep) {
UINFO(4,__FUNCTION__<<": "<<endl); UINFO(4,__FUNCTION__<<": "<<endl);

View File

@ -188,5 +188,5 @@ public:
void V3Cast::castAll(AstNetlist* nodep) { void V3Cast::castAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
CastVisitor visitor (nodep); CastVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("cast.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("cast", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -302,5 +302,5 @@ void V3Changed::changedAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ChangedState state; ChangedState state;
ChangedVisitor visitor (nodep, &state); ChangedVisitor visitor (nodep, &state);
V3Global::dumpCheckGlobalTree("changed.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("changed", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -297,5 +297,5 @@ public:
void V3Clean::cleanAll(AstNetlist* nodep) { void V3Clean::cleanAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
CleanVisitor visitor (nodep); CleanVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("clean.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("clean", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -915,5 +915,5 @@ void V3ClkGater::clkGaterAll(AstNetlist* nodep) {
// While the gater does well at some modules, it seems to slow down many others // While the gater does well at some modules, it seems to slow down many others
UINFO(5,"ClkGater is disabled due to performance issues\n"); UINFO(5,"ClkGater is disabled due to performance issues\n");
//GaterVisitor visitor (nodep); //GaterVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("clkgater.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("clkgater", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -413,5 +413,5 @@ public:
void V3Clock::clockAll(AstNetlist* nodep) { void V3Clock::clockAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ClockVisitor visitor (nodep); ClockVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("clock.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("clock", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -474,5 +474,5 @@ public:
void V3Combine::combineAll(AstNetlist* nodep) { void V3Combine::combineAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
CombineVisitor visitor (nodep); CombineVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("combine.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("combine", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -2408,14 +2408,14 @@ void V3Const::constifyAllLint(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ConstVisitor visitor (ConstVisitor::PROC_V_WARN); ConstVisitor visitor (ConstVisitor::PROC_V_WARN);
(void)visitor.mainAcceptEdit(nodep); (void)visitor.mainAcceptEdit(nodep);
V3Global::dumpCheckGlobalTree("const.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("const", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
void V3Const::constifyCpp(AstNetlist* nodep) { void V3Const::constifyCpp(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ConstVisitor visitor (ConstVisitor::PROC_CPP); ConstVisitor visitor (ConstVisitor::PROC_CPP);
(void)visitor.mainAcceptEdit(nodep); (void)visitor.mainAcceptEdit(nodep);
V3Global::dumpCheckGlobalTree("const_cpp.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("const_cpp", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
AstNode* V3Const::constifyEdit(AstNode* nodep) { AstNode* V3Const::constifyEdit(AstNode* nodep) {
@ -2431,7 +2431,7 @@ void V3Const::constifyAllLive(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ConstVisitor visitor (ConstVisitor::PROC_LIVE); ConstVisitor visitor (ConstVisitor::PROC_LIVE);
(void)visitor.mainAcceptEdit(nodep); (void)visitor.mainAcceptEdit(nodep);
V3Global::dumpCheckGlobalTree("const.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("const", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
void V3Const::constifyAll(AstNetlist* nodep) { void V3Const::constifyAll(AstNetlist* nodep) {
@ -2439,7 +2439,7 @@ void V3Const::constifyAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ConstVisitor visitor (ConstVisitor::PROC_V_EXPENSIVE); ConstVisitor visitor (ConstVisitor::PROC_V_EXPENSIVE);
(void)visitor.mainAcceptEdit(nodep); (void)visitor.mainAcceptEdit(nodep);
V3Global::dumpCheckGlobalTree("const.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("const", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
AstNode* V3Const::constifyExpensiveEdit(AstNode* nodep) { AstNode* V3Const::constifyExpensiveEdit(AstNode* nodep) {

View File

@ -395,5 +395,5 @@ public:
void V3Coverage::coverage(AstNetlist* rootp) { void V3Coverage::coverage(AstNetlist* rootp) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
CoverageVisitor visitor (rootp); CoverageVisitor visitor (rootp);
V3Global::dumpCheckGlobalTree("coverage.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("coverage", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -135,5 +135,5 @@ public:
void V3CoverageJoin::coverageJoin(AstNetlist* rootp) { void V3CoverageJoin::coverageJoin(AstNetlist* rootp) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
CoverageJoinVisitor visitor (rootp); CoverageJoinVisitor visitor (rootp);
V3Global::dumpCheckGlobalTree("coveragejoin.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("coveragejoin", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -422,29 +422,29 @@ public:
void V3Dead::deadifyModules(AstNetlist* nodep) { void V3Dead::deadifyModules(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
DeadVisitor visitor (nodep, false, false, false, false); DeadVisitor visitor (nodep, false, false, false, false);
V3Global::dumpCheckGlobalTree("deadModules.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("deadModules", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }
void V3Dead::deadifyDTypes(AstNetlist* nodep) { void V3Dead::deadifyDTypes(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
DeadVisitor visitor (nodep, false, true, false, false); DeadVisitor visitor (nodep, false, true, false, false);
V3Global::dumpCheckGlobalTree("deadDtypes.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("deadDtypes", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
void V3Dead::deadifyDTypesScoped(AstNetlist* nodep) { void V3Dead::deadifyDTypesScoped(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
DeadVisitor visitor (nodep, false, true, true, false); DeadVisitor visitor (nodep, false, true, true, false);
V3Global::dumpCheckGlobalTree("deadDtypesScoped.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("deadDtypesScoped", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
void V3Dead::deadifyAll(AstNetlist* nodep) { void V3Dead::deadifyAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
DeadVisitor visitor (nodep, true, true, false, true); DeadVisitor visitor (nodep, true, true, false, true);
V3Global::dumpCheckGlobalTree("deadAll.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("deadAll", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
void V3Dead::deadifyAllScoped(AstNetlist* nodep) { void V3Dead::deadifyAllScoped(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
DeadVisitor visitor (nodep, true, true, true, true); DeadVisitor visitor (nodep, true, true, true, true);
V3Global::dumpCheckGlobalTree("deadAllScoped.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("deadAllScoped", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -471,5 +471,5 @@ public:
void V3Delayed::delayedAll(AstNetlist* nodep) { void V3Delayed::delayedAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
DelayedVisitor visitor (nodep); DelayedVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("delayed.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("delayed", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -175,5 +175,5 @@ public:
void V3Depth::depthAll(AstNetlist* nodep) { void V3Depth::depthAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
DepthVisitor visitor (nodep); DepthVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("depth.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("depth", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }

View File

@ -140,5 +140,5 @@ public:
void V3DepthBlock::depthBlockAll(AstNetlist* nodep) { void V3DepthBlock::depthBlockAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
DepthBlockVisitor visitor (nodep); DepthBlockVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("deepblock.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("deepblock", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -263,5 +263,5 @@ public:
void V3Descope::descopeAll(AstNetlist* nodep) { void V3Descope::descopeAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
DescopeVisitor visitor (nodep); DescopeVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("descope.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("descope", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -215,7 +215,7 @@ void V3Error::v3errorEnd (ostringstream& sstr) {
} }
#ifndef _V3ERROR_NO_GLOBAL_ #ifndef _V3ERROR_NO_GLOBAL_
if (debug()) { if (debug()) {
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("final.tree",990)); v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("final",990));
if (s_errorExitCb) s_errorExitCb(); if (s_errorExitCb) s_errorExitCb();
V3Stats::statsFinalAll(v3Global.rootp()); V3Stats::statsFinalAll(v3Global.rootp());
V3Stats::statsReport(); V3Stats::statsReport();

View File

@ -937,5 +937,5 @@ public:
void V3Expand::expandAll(AstNetlist* nodep) { void V3Expand::expandAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ExpandVisitor visitor (nodep); ExpandVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("expand.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("expand", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -1488,5 +1488,5 @@ void V3Gate::gateAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
GateVisitor visitor (nodep); GateVisitor visitor (nodep);
GateDeassignVisitor deassign (nodep); GateDeassignVisitor deassign (nodep);
V3Global::dumpCheckGlobalTree("gate.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("gate", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -228,5 +228,5 @@ public:
void V3GenClk::genClkAll(AstNetlist* nodep) { void V3GenClk::genClkAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
GenClkReadVisitor visitor (nodep); GenClkReadVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("genclk.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("genclk", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -97,7 +97,7 @@ public:
// METHODS // METHODS
void readFiles(); void readFiles();
void checkTree(); void checkTree();
static void dumpCheckGlobalTree(const string& filename, int newNumber=0, bool doDump=true); static void dumpCheckGlobalTree(const string& stagename, int newNumber=0, bool doDump=true);
void assertDTypesResolved(bool flag) { m_assertDTypesResolved = flag; } void assertDTypesResolved(bool flag) { m_assertDTypesResolved = flag; }
void widthMinUsage(const VWidthMinUsage& flag) { m_widthMinUsage = flag; } void widthMinUsage(const VWidthMinUsage& flag) { m_widthMinUsage = flag; }
bool constRemoveXs() const { return m_constRemoveXs; } bool constRemoveXs() const { return m_constRemoveXs; }

View File

@ -587,5 +587,5 @@ void V3Inline::inlineAll(AstNetlist* nodep) {
modp->unlinkFrBack()->deleteTree(); VL_DANGLING(modp); modp->unlinkFrBack()->deleteTree(); VL_DANGLING(modp);
} }
} }
V3Global::dumpCheckGlobalTree("inline.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("inline", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -583,11 +583,11 @@ AstAssignW* V3Inst::pinReconnectSimple(AstPin* pinp, AstCell* cellp, AstNodeModu
void V3Inst::instAll(AstNetlist* nodep) { void V3Inst::instAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
InstVisitor visitor (nodep); InstVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("inst.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("inst", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
void V3Inst::dearrayAll(AstNetlist* nodep) { void V3Inst::dearrayAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
InstDeVisitor visitor (nodep); InstDeVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("dearray.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("dearray", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }

View File

@ -515,5 +515,5 @@ void V3Life::lifeAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
LifeState state; LifeState state;
LifeTopVisitor visitor (nodep, &state); LifeTopVisitor visitor (nodep, &state);
V3Global::dumpCheckGlobalTree("life.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("life", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -193,5 +193,5 @@ void V3LifePost::lifepostAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
// Mark redundant AssignPost // Mark redundant AssignPost
LifePostDlyVisitor visitor (nodep); LifePostDlyVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("life_post.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("life_post", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -161,7 +161,7 @@ public:
if (!diddump && v3Global.opt.dumpTree()) { if (!diddump && v3Global.opt.dumpTree()) {
diddump = true; diddump = true;
dump("linkdot-preerr",true); dump("linkdot-preerr",true);
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("linkdot-preerr.tree")); v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("linkdot-preerr"));
} }
} }
@ -2258,21 +2258,21 @@ public:
int V3LinkDot::debug() { return LinkDotState::debug(); } int V3LinkDot::debug() { return LinkDotState::debug(); }
void V3LinkDot::linkDotGuts(AstNetlist* rootp, VLinkDotStep step) { void V3LinkDot::linkDotGuts(AstNetlist* rootp, VLinkDotStep step) {
if (LinkDotState::debug()>=5 || v3Global.opt.dumpTree()>=9) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("prelinkdot.tree")); if (LinkDotState::debug()>=5 || v3Global.opt.dumpTree()>=9) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("prelinkdot"));
LinkDotState state (rootp, step); LinkDotState state (rootp, step);
LinkDotFindVisitor visitor(rootp,&state); LinkDotFindVisitor visitor(rootp,&state);
if (LinkDotState::debug()>=5 || v3Global.opt.dumpTree()>=9) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("prelinkdot-find.tree")); if (LinkDotState::debug()>=5 || v3Global.opt.dumpTree()>=9) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("prelinkdot-find"));
if (step == LDS_PRIMARY || step == LDS_PARAMED) { if (step == LDS_PRIMARY || step == LDS_PARAMED) {
// Initial link stage, resolve parameters // Initial link stage, resolve parameters
LinkDotParamVisitor visitors(rootp,&state); LinkDotParamVisitor visitors(rootp,&state);
if (LinkDotState::debug()>=5 || v3Global.opt.dumpTree()>=9) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("prelinkdot-param.tree")); if (LinkDotState::debug()>=5 || v3Global.opt.dumpTree()>=9) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("prelinkdot-param"));
} }
else if (step == LDS_ARRAYED) {} else if (step == LDS_ARRAYED) {}
else if (step == LDS_SCOPED) { else if (step == LDS_SCOPED) {
// Well after the initial link when we're ready to operate on the flat design, // Well after the initial link when we're ready to operate on the flat design,
// process AstScope's. This needs to be separate pass after whole hierarchy graph created. // process AstScope's. This needs to be separate pass after whole hierarchy graph created.
LinkDotScopeVisitor visitors(rootp,&state); LinkDotScopeVisitor visitors(rootp,&state);
if (LinkDotState::debug()>=5 || v3Global.opt.dumpTree()>=9) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("prelinkdot-scoped.tree")); if (LinkDotState::debug()>=5 || v3Global.opt.dumpTree()>=9) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("prelinkdot-scoped"));
} }
else v3fatalSrc("Bad case"); else v3fatalSrc("Bad case");
state.dump(); state.dump();

View File

@ -36,19 +36,19 @@ private:
public: public:
static void linkDotPrimary(AstNetlist* nodep) { static void linkDotPrimary(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); linkDotGuts(nodep,LDS_PRIMARY); UINFO(2,__FUNCTION__<<": "<<endl); linkDotGuts(nodep,LDS_PRIMARY);
V3Global::dumpCheckGlobalTree("linkdot.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("linkdot", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }
static void linkDotParamed(AstNetlist* nodep) { static void linkDotParamed(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); linkDotGuts(nodep,LDS_PARAMED); UINFO(2,__FUNCTION__<<": "<<endl); linkDotGuts(nodep,LDS_PARAMED);
V3Global::dumpCheckGlobalTree("paramlink.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("paramlink", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
static void linkDotArrayed(AstNetlist* nodep) { static void linkDotArrayed(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); linkDotGuts(nodep,LDS_ARRAYED); UINFO(2,__FUNCTION__<<": "<<endl); linkDotGuts(nodep,LDS_ARRAYED);
V3Global::dumpCheckGlobalTree("linkdot.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("linkdot", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }
static void linkDotScope(AstNetlist* nodep) { static void linkDotScope(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); linkDotGuts(nodep,LDS_SCOPED); UINFO(2,__FUNCTION__<<": "<<endl); linkDotGuts(nodep,LDS_SCOPED);
V3Global::dumpCheckGlobalTree("linkdot.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("linkdot", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
}; };

View File

@ -263,5 +263,5 @@ public:
void V3LinkJump::linkJump(AstNetlist* nodep) { void V3LinkJump::linkJump(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
LinkJumpVisitor bvisitor (nodep); LinkJumpVisitor bvisitor (nodep);
V3Global::dumpCheckGlobalTree("link.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("link", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -279,7 +279,7 @@ public:
void V3LinkLValue::linkLValue(AstNetlist* rootp) { void V3LinkLValue::linkLValue(AstNetlist* rootp) {
UINFO(4,__FUNCTION__<<": "<<endl); UINFO(4,__FUNCTION__<<": "<<endl);
LinkLValueVisitor visitor(rootp, false); LinkLValueVisitor visitor(rootp, false);
V3Global::dumpCheckGlobalTree("linklvalue.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("linklvalue", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }
void V3LinkLValue::linkLValueSet(AstNode* nodep) { void V3LinkLValue::linkLValueSet(AstNode* nodep) {
// Called by later link functions when it is known a node needs // Called by later link functions when it is known a node needs

View File

@ -80,7 +80,7 @@ void V3LinkLevel::modSortByLevel() {
v3Global.rootp()->addModulep(nodep); v3Global.rootp()->addModulep(nodep);
} }
UINFO(9,"modSortByLevel() done\n"); // Comment required for gcc4.6.3 / bug666 UINFO(9,"modSortByLevel() done\n"); // Comment required for gcc4.6.3 / bug666
V3Global::dumpCheckGlobalTree("cells.tree", false, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("cells", false, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
//###################################################################### //######################################################################

View File

@ -431,5 +431,5 @@ public:
void V3LinkParse::linkParse(AstNetlist* rootp) { void V3LinkParse::linkParse(AstNetlist* rootp) {
UINFO(4,__FUNCTION__<<": "<<endl); UINFO(4,__FUNCTION__<<": "<<endl);
LinkParseVisitor visitor(rootp); LinkParseVisitor visitor(rootp);
V3Global::dumpCheckGlobalTree("linkparse.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("linkparse", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }

View File

@ -516,5 +516,5 @@ void V3LinkResolve::linkResolve(AstNetlist* rootp) {
UINFO(4,__FUNCTION__<<": "<<endl); UINFO(4,__FUNCTION__<<": "<<endl);
LinkResolveVisitor visitor(rootp); LinkResolveVisitor visitor(rootp);
LinkBotupVisitor visitorb(rootp); LinkBotupVisitor visitorb(rootp);
V3Global::dumpCheckGlobalTree("linkresolve.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("linkresolve", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }

View File

@ -250,5 +250,5 @@ void V3Localize::localizeAll(AstNetlist* nodep) {
LocalizeVisitor visitor (nodep); LocalizeVisitor visitor (nodep);
// Fix up hiernames // Fix up hiernames
LocalizeDehierVisitor dvisitor (nodep); LocalizeDehierVisitor dvisitor (nodep);
V3Global::dumpCheckGlobalTree("localize.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("localize", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }

View File

@ -149,5 +149,5 @@ public:
void V3Name::nameAll(AstNetlist* nodep) { void V3Name::nameAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
NameVisitor visitor (nodep); NameVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("name.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("name", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }

View File

@ -1645,7 +1645,7 @@ void OrderVisitor::process() {
// Dump data // Dump data
m_graph.dumpDotFilePrefixed("orderg_done"); m_graph.dumpDotFilePrefixed("orderg_done");
if (0 && debug()) { if (0 && debug()) {
string dfilename = v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"_INT_order.tree"; string dfilename = v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"_INT_order";
const VL_UNIQUE_PTR<ofstream> logp (V3File::new_ofstream(dfilename)); const VL_UNIQUE_PTR<ofstream> logp (V3File::new_ofstream(dfilename));
if (logp->fail()) v3fatalSrc("Can't write "<<dfilename); if (logp->fail()) v3fatalSrc("Can't write "<<dfilename);
m_graph.dump(*logp); m_graph.dump(*logp);
@ -1660,5 +1660,5 @@ void V3Order::orderAll(AstNetlist* nodep) {
OrderClkMarkVisitor markVisitor(nodep); OrderClkMarkVisitor markVisitor(nodep);
OrderVisitor visitor; OrderVisitor visitor;
visitor.main(nodep); visitor.main(nodep);
V3Global::dumpCheckGlobalTree("order.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("order", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -22,6 +22,7 @@
#include "verilatedos.h" #include "verilatedos.h"
#include <cstdarg> #include <cstdarg>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
@ -186,3 +187,36 @@ void V3Os::unlinkRegexp(const string& dir, const string& regexp) {
closedir(dirp); closedir(dirp);
} }
} }
//######################################################################
// METHODS (performance)
uint64_t V3Os::timeUsecs() {
#if defined(_WIN32) || defined(__MINGW32__)
return 0;
#else
timeval tv;
if (gettimeofday(&tv, NULL) < 0) return 0;
return static_cast<uint64_t>(tv.tv_sec)*1000000 + tv.tv_usec;
#endif
}
uint64_t V3Os::memUsageBytes() {
#if defined(_WIN32) || defined(__MINGW32__)
return 0;
#else
// Highly unportable. Sorry
const char* statmFilename = "/proc/self/statm";
FILE* fp = fopen(statmFilename,"r");
if (!fp) {
return 0;
}
uint64_t size, resident, share, text, lib, data, dt; // All in pages
if (7 != fscanf(fp, "%" VL_PRI64 "d %" VL_PRI64 "d %" VL_PRI64 "d %"
VL_PRI64 "d %" VL_PRI64 "d %" VL_PRI64 "d %" VL_PRI64 "d",
&size, &resident, &share, &text, &lib, &data, &dt)) {
return 0;
}
return (text + data) * getpagesize();
#endif
}

View File

@ -47,6 +47,10 @@ public:
// METHODS (directory utilities) // METHODS (directory utilities)
static void createDir(const string& dirname); static void createDir(const string& dirname);
static void unlinkRegexp(const string& dir, const string& regexp); static void unlinkRegexp(const string& dir, const string& regexp);
// METHODS (performance)
static uint64_t timeUsecs(); ///< Return wall time since epoch in microseconds, or 0 if not implemented
static uint64_t memUsageBytes(); ///< Return memory usage in bytes, or 0 if not implemented
}; };
#endif // Guard #endif // Guard

View File

@ -744,7 +744,7 @@ void ParamVisitor::visitCell(AstCell* nodep) {
// Delete the parameters from the cell; they're not relevant any longer. // Delete the parameters from the cell; they're not relevant any longer.
if (nodep->paramsp()) nodep->paramsp()->unlinkFrBackWithNext()->deleteTree(); if (nodep->paramsp()) nodep->paramsp()->unlinkFrBackWithNext()->deleteTree();
UINFO(8," Done with "<<nodep<<endl); UINFO(8," Done with "<<nodep<<endl);
//if (debug()>=10) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("param-out.tree")); //if (debug()>=10) v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("param-out"));
} }
// Now remember to process the child module at the end of the module // Now remember to process the child module at the end of the module
@ -757,5 +757,5 @@ void ParamVisitor::visitCell(AstCell* nodep) {
void V3Param::param(AstNetlist* rootp) { void V3Param::param(AstNetlist* rootp) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ParamVisitor visitor (rootp); ParamVisitor visitor (rootp);
V3Global::dumpCheckGlobalTree("param.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("param", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }

View File

@ -412,5 +412,5 @@ public:
void V3Premit::premitAll(AstNetlist* nodep) { void V3Premit::premitAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
PremitVisitor visitor (nodep); PremitVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("premit.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("premit", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -418,5 +418,5 @@ void V3Scope::scopeAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
ScopeVisitor visitor (nodep); ScopeVisitor visitor (nodep);
ScopeCleanupVisitor cleanVisitor (nodep); ScopeCleanupVisitor cleanVisitor (nodep);
V3Global::dumpCheckGlobalTree("scope.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("scope", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -548,5 +548,5 @@ public:
void V3Slice::sliceAll(AstNetlist* rootp) { void V3Slice::sliceAll(AstNetlist* rootp) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
SliceVisitor visitor(rootp); SliceVisitor visitor(rootp);
V3Global::dumpCheckGlobalTree("slice.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("slice", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -579,10 +579,10 @@ public:
void V3Split::splitReorderAll(AstNetlist* nodep) { void V3Split::splitReorderAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
SplitVisitor visitor (nodep, true); SplitVisitor visitor (nodep, true);
V3Global::dumpCheckGlobalTree("reorder.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("reorder", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
void V3Split::splitAlwaysAll(AstNetlist* nodep) { void V3Split::splitAlwaysAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
SplitVisitor visitor (nodep, false); SplitVisitor visitor (nodep, false);
V3Global::dumpCheckGlobalTree("split.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("split", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }

View File

@ -216,5 +216,5 @@ public:
void V3SplitAs::splitAsAll(AstNetlist* nodep) { void V3SplitAs::splitAsAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
SplitAsVisitor visitor (nodep); SplitAsVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("splitas.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("splitas", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -56,6 +56,7 @@ class V3Statistic {
double m_count; ///< Count of occurrences/ value double m_count; ///< Count of occurrences/ value
string m_stage; ///< Runtime stage string m_stage; ///< Runtime stage
bool m_sumit; ///< Do summation of similar stats bool m_sumit; ///< Do summation of similar stats
bool m_perf; ///< Performance section
bool m_printit; ///< Print the results bool m_printit; ///< Print the results
public: public:
// METHODS // METHODS
@ -63,6 +64,7 @@ public:
string name() const { return m_name; } string name() const { return m_name; }
double count() const { return m_count; } double count() const { return m_count; }
bool sumit() const { return m_sumit; } bool sumit() const { return m_sumit; }
bool perf() const { return m_perf; }
bool printit() const { return m_printit; } bool printit() const { return m_printit; }
virtual void dump(ofstream& os) const; virtual void dump(ofstream& os) const;
void combineWith(V3Statistic* otherp) { void combineWith(V3Statistic* otherp) {
@ -70,8 +72,8 @@ public:
otherp->m_printit = false; otherp->m_printit = false;
} }
// CONSTRUCTORS // CONSTRUCTORS
V3Statistic(const string& stage, const string& name, double count, bool sumit=false) V3Statistic(const string& stage, const string& name, double count, bool sumit=false, bool perf=false)
: m_name(name), m_count(count), m_stage(stage), m_sumit(sumit) : m_name(name), m_count(count), m_stage(stage), m_sumit(sumit), m_perf(perf)
, m_printit(true) {} , m_printit(true) {}
virtual ~V3Statistic() {} virtual ~V3Statistic() {}
}; };
@ -87,6 +89,10 @@ public:
addStat(V3Statistic("*",name,count)); } addStat(V3Statistic("*",name,count)); }
static void addStatSum(const string& name, double count) { static void addStatSum(const string& name, double count) {
addStat(V3Statistic("*",name,count,true)); } addStat(V3Statistic("*",name,count,true)); }
static void addStatPerf(const string& name, double count) {
addStat(V3Statistic("*",name,count,true,true)); }
/// Called each stage
static void statsStage(const string& name);
/// Called by the top level to collect statistics /// Called by the top level to collect statistics
static void statsStageAll(AstNetlist* nodep, const string& stage, bool fast=false); static void statsStageAll(AstNetlist* nodep, const string& stage, bool fast=false);
static void statsFinalAll(AstNetlist* nodep); static void statsFinalAll(AstNetlist* nodep);

View File

@ -30,6 +30,7 @@
#include "V3Stats.h" #include "V3Stats.h"
#include "V3Ast.h" #include "V3Ast.h"
#include "V3File.h" #include "V3File.h"
#include "V3Os.h"
//###################################################################### //######################################################################
// Stats dumping // Stats dumping
@ -75,9 +76,6 @@ class StatsReport {
} }
void stars() { void stars() {
os<<"Global Statistics:\n";
os<<endl;
// Find all stages // Find all stages
size_t maxWidth = 0; size_t maxWidth = 0;
typedef multimap<string,const V3Statistic*> ByName; typedef multimap<string,const V3Statistic*> ByName;
@ -92,8 +90,23 @@ class StatsReport {
} }
// Print organized by stage // Print organized by stage
os<<"Global Statistics:\n";
os<<endl;
for (ByName::iterator it = byName.begin(); it!=byName.end(); ++it) { for (ByName::iterator it = byName.begin(); it!=byName.end(); ++it) {
const V3Statistic* repp = it->second; const V3Statistic* repp = it->second;
if (repp->perf()) continue;
os<<" "<<left<<setw(maxWidth)<<repp->name();
repp->dump(os);
os<<endl;
}
os<<endl;
// Print organized by stage
os<<"Peformance Statistics:\n";
os<<endl;
for (ByName::iterator it = byName.begin(); it!=byName.end(); ++it) {
const V3Statistic* repp = it->second;
if (!repp->perf()) continue;
os<<" "<<left<<setw(maxWidth)<<repp->name(); os<<" "<<left<<setw(maxWidth)<<repp->name();
repp->dump(os); repp->dump(os);
os<<endl; os<<endl;
@ -193,7 +206,11 @@ StatsReport::StatColl StatsReport::s_allStats;
// V3Statstic class // V3Statstic class
void V3Statistic::dump (ofstream& os) const { void V3Statistic::dump (ofstream& os) const {
os<<" "<<right<<fixed<<setprecision(0)<<setw(9)<<count(); if (perf()) {
os<<" "<<right<<fixed<<setprecision(6)<<setw(9)<<count();
} else {
os<<" "<<right<<fixed<<setprecision(0)<<setw(9)<<count();
}
} }
//###################################################################### //######################################################################
@ -203,6 +220,23 @@ void V3Stats::addStat(const V3Statistic& stat) {
StatsReport::addStat(stat); StatsReport::addStat(stat);
} }
void V3Stats::statsStage(const string& name) {
static double lastWallTime = -1;
static int fileNumber = 0;
char digits[100]; sprintf(digits, "%03d", ++fileNumber);
const string digitName = string(digits)+"_"+name;
double wallTime = V3Os::timeUsecs() / 1.0e6;
if (lastWallTime<0) lastWallTime = wallTime;
double wallTimeDelta = wallTime - lastWallTime;
lastWallTime = wallTime;
V3Stats::addStatPerf("Stage, Elapsed time (sec), "+digitName, wallTimeDelta);
double memory = V3Os::memUsageBytes()/1024.0/1024.0;
V3Stats::addStatPerf("Stage, Memory (MB), "+digitName, memory);
}
void V3Stats::statsReport() { void V3Stats::statsReport() {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);

View File

@ -401,5 +401,5 @@ public:
void V3Subst::substituteAll(AstNetlist* nodep) { void V3Subst::substituteAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
SubstVisitor visitor (nodep); SubstVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("subst.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("subst", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -466,5 +466,5 @@ void TableSimulateVisitor::varRefCb(AstVarRef* nodep) {
void V3Table::tableAll(AstNetlist* nodep) { void V3Table::tableAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
TableVisitor visitor (nodep); TableVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("table.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("table", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -1311,5 +1311,5 @@ void V3Task::taskAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
TaskStateVisitor visitors (nodep); TaskStateVisitor visitors (nodep);
TaskVisitor visitor (nodep, &visitors); TaskVisitor visitor (nodep, &visitors);
V3Global::dumpCheckGlobalTree("task.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("task", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -713,5 +713,5 @@ public:
void V3Trace::traceAll(AstNetlist* nodep) { void V3Trace::traceAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
TraceVisitor visitor (nodep); TraceVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("trace.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("trace", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -326,5 +326,5 @@ public:
void V3TraceDecl::traceDeclAll(AstNetlist* nodep) { void V3TraceDecl::traceDeclAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
TraceDeclVisitor visitor (nodep); TraceDeclVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("tracedecl.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("tracedecl", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -1325,5 +1325,5 @@ public:
void V3Tristate::tristateAll(AstNetlist* nodep) { void V3Tristate::tristateAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
TristateVisitor visitor (nodep); TristateVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("tristate.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("tristate", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -477,5 +477,5 @@ public:
void V3Unknown::unknownAll(AstNetlist* nodep) { void V3Unknown::unknownAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
UnknownVisitor visitor (nodep); UnknownVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("unknown.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("unknown", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }

View File

@ -478,7 +478,7 @@ public:
void V3Unroll::unrollAll(AstNetlist* nodep) { void V3Unroll::unrollAll(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
UnrollVisitor visitor (nodep, false, ""); UnrollVisitor visitor (nodep, false, "");
V3Global::dumpCheckGlobalTree("unroll.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("unroll", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
void V3Unroll::unrollGen(AstNodeFor* nodep, string beginName) { void V3Unroll::unrollGen(AstNodeFor* nodep, string beginName) {

View File

@ -3704,7 +3704,7 @@ void V3Width::width(AstNetlist* nodep) {
(void)visitor.mainAcceptEdit(nodep); (void)visitor.mainAcceptEdit(nodep);
WidthRemoveVisitor rvisitor; WidthRemoveVisitor rvisitor;
(void)rvisitor.mainAcceptEdit(nodep); (void)rvisitor.mainAcceptEdit(nodep);
V3Global::dumpCheckGlobalTree("width.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("width", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
} }
//! Single node parameter propagation //! Single node parameter propagation
@ -3740,5 +3740,5 @@ AstNode* V3Width::widthGenerateParamsEdit(
void V3Width::widthCommit(AstNetlist* nodep) { void V3Width::widthCommit(AstNetlist* nodep) {
UINFO(2,__FUNCTION__<<": "<<endl); UINFO(2,__FUNCTION__<<": "<<endl);
WidthCommitVisitor visitor (nodep); WidthCommitVisitor visitor (nodep);
V3Global::dumpCheckGlobalTree("widthcommit.tree", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6); V3Global::dumpCheckGlobalTree("widthcommit", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
} }

View File

@ -144,8 +144,9 @@ void V3Global::readFiles() {
} }
} }
void V3Global::dumpCheckGlobalTree(const string& filename, int newNumber, bool doDump) { void V3Global::dumpCheckGlobalTree(const string& stagename, int newNumber, bool doDump) {
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename(filename, newNumber), false, doDump); v3Global.rootp()->dumpTreeFile(v3Global.debugFilename(stagename+".tree", newNumber), false, doDump);
if (v3Global.opt.stats()) V3Stats::statsStage(stagename);
} }
//###################################################################### //######################################################################
@ -603,7 +604,7 @@ int main(int argc, char** argv, char** env) {
} }
// Final steps // Final steps
V3Global::dumpCheckGlobalTree("final.tree", 990, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); V3Global::dumpCheckGlobalTree("final", 990, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
V3Error::abortIfWarnings(); V3Error::abortIfWarnings();
if (!v3Global.opt.lintOnly() && !v3Global.opt.cdc() if (!v3Global.opt.lintOnly() && !v3Global.opt.cdc()

View File

@ -8,11 +8,12 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
# Version 2.0. # Version 2.0.
compile ( compile (
); v_flags2 => ["--stats"],
);
execute ( execute (
check_finished=>1, check_finished=>1,
); );
ok(1); ok(1);
1; 1;

View File

@ -15,12 +15,12 @@ $Self->{cycles} = 100 if $Self->{cycles}<100;
$Self->{sim_time} = $Self->{cycles}*100; $Self->{sim_time} = $Self->{cycles}*100;
compile ( compile (
v_flags2 => ["+define+SIM_CYCLES=$Self->{cycles}"], v_flags2 => ["+define+SIM_CYCLES=$Self->{cycles} --stats"],
); );
execute ( execute (
check_finished=>1, check_finished=>1,
); );
ok(1); ok(1);
1; 1;

View File

@ -40,7 +40,7 @@ if (!-r "$root/.git") {
$hit = 1 if $line =~ /\bstdio\.h/; $hit = 1 if $line =~ /\bstdio\.h/;
$hit = 1 if $line =~ /\bstdlib\.h/; $hit = 1 if $line =~ /\bstdlib\.h/;
$hit = 1 if $line =~ /\bstring\.h/; $hit = 1 if $line =~ /\bstring\.h/;
$hit = 1 if $line =~ /\btime\.h/; $hit = 1 if $line =~ /\btime\.h/ && $line !~ m!sys/time.h!;
next if !$hit; next if !$hit;
print "$line\n"; print "$line\n";
$names{$1} = 1 if $line =~ /^([^:]+)/; $names{$1} = 1 if $line =~ /^([^:]+)/;