mirror of
https://github.com/verilator/verilator.git
synced 2026-09-04 00:30:34 +02:00
Add stats on input size etc (#5017)
This commit is contained in:
+8
-1
@@ -113,6 +113,7 @@ class EmitCSyms final : EmitCBaseVisitorConst {
|
||||
int m_funcNum = 0; // CFunc split function number
|
||||
V3OutCFile* m_ofpBase = nullptr; // Base (not split) C file
|
||||
std::unordered_map<int, bool> m_usesVfinal; // Split method uses __Vfinal
|
||||
VDouble0 m_statVarScopeBytes; // Statistic tracking
|
||||
|
||||
// METHODS
|
||||
void emitSymHdr();
|
||||
@@ -367,6 +368,10 @@ class EmitCSyms final : EmitCBaseVisitorConst {
|
||||
iterateChildrenConst(nodep);
|
||||
if (nodep->isSigUserRdPublic() && !m_cfuncp) m_modVars.emplace_back(m_modp, nodep);
|
||||
}
|
||||
void visit(AstVarScope* nodep) override {
|
||||
iterateChildrenConst(nodep);
|
||||
m_statVarScopeBytes += nodep->varp()->dtypep()->widthTotalBytes();
|
||||
}
|
||||
void visit(AstCoverDecl* nodep) override {
|
||||
// Assign numbers to all bins, so we know how big of an array to use
|
||||
if (!nodep->dataDeclNullp()) { // else duplicate we don't need code for
|
||||
@@ -832,8 +837,10 @@ void EmitCSyms::emitSymImp() {
|
||||
puts(" // Check resources\n");
|
||||
uint64_t stackSize = V3StackCount::count(v3Global.rootp());
|
||||
if (v3Global.opt.debugStackCheck()) stackSize += 1024 * 1024 * 1024;
|
||||
V3Stats::addStat("Stack size prediction (bytes)", stackSize);
|
||||
V3Stats::addStat("Size prediction, Stack (bytes)", stackSize);
|
||||
puts(" Verilated::stackCheck(" + cvtToStr(stackSize) + ");\n");
|
||||
V3Stats::addStat("Size prediction, Heap, from Var Scopes (bytes)", m_statVarScopeBytes);
|
||||
V3Stats::addStat(V3Stats::STAT_MODEL_SIZE, stackSize + m_statVarScopeBytes);
|
||||
}
|
||||
|
||||
if (v3Global.opt.profPgo()) {
|
||||
|
||||
Reference in New Issue
Block a user