Optimize trace initialization code size (#6749)

This commit is contained in:
Geza Lore 2025-12-02 12:19:45 +00:00 committed by GitHub
parent e25c66de07
commit 60fe2c873c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 10 additions and 8 deletions

View File

@ -149,8 +149,9 @@ static std::pair<bool, fstScopeType> toFstScopeType(VerilatedTracePrefixType typ
}
}
void VerilatedFst::pushPrefix(const std::string& name, VerilatedTracePrefixType type) {
void VerilatedFst::pushPrefix(const char* namep, VerilatedTracePrefixType type) {
assert(!m_prefixStack.empty()); // Constructor makes an empty entry
const std::string name{namep};
// An empty name means this is the root of a model created with
// name()=="". The tools get upset if we try to pass this as empty, so
// we put the signals under a new $rootio scope, but the signals

View File

@ -110,7 +110,7 @@ public:
//=========================================================================
// Internal interface to Verilator generated code
void pushPrefix(const std::string&, VerilatedTracePrefixType);
void pushPrefix(const char*, VerilatedTracePrefixType);
void popPrefix();
void declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,

View File

@ -474,8 +474,9 @@ void VerilatedSaif::printIndent() {
printStr(std::string(m_indent, ' ')); // Must use () constructor
}
void VerilatedSaif::pushPrefix(const std::string& name, VerilatedTracePrefixType type) {
void VerilatedSaif::pushPrefix(const char* namep, VerilatedTracePrefixType type) {
assert(!m_prefixStack.empty()); // Constructor makes an empty entry
const std::string name{namep};
// An empty name means this is the root of a model created with
// name()=="". The tools get upset if we try to pass this as empty, so
// we put the signals under a new $rootio scope, but the signals

View File

@ -143,7 +143,7 @@ public:
//=========================================================================
// Internal interface to Verilator generated code
void pushPrefix(const std::string&, VerilatedTracePrefixType);
void pushPrefix(const char*, VerilatedTracePrefixType);
void popPrefix();
void declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,

View File

@ -321,8 +321,9 @@ void VerilatedVcd::printIndent(int level_change) {
if (level_change > 0) m_indent += level_change;
}
void VerilatedVcd::pushPrefix(const std::string& name, VerilatedTracePrefixType type) {
void VerilatedVcd::pushPrefix(const char* namep, VerilatedTracePrefixType type) {
assert(!m_prefixStack.empty()); // Constructor makes an empty entry
const std::string name{namep};
// An empty name means this is the root of a model created with
// name()=="". The tools get upset if we try to pass this as empty, so
// we put the signals under a new $rootio scope, but the signals

View File

@ -134,7 +134,7 @@ public:
//=========================================================================
// Internal interface to Verilator generated code
void pushPrefix(const std::string&, VerilatedTracePrefixType);
void pushPrefix(const char*, VerilatedTracePrefixType);
void popPrefix();
void declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,

View File

@ -549,8 +549,7 @@ class EmitCModel final : public EmitCFunc {
"0.\");\n");
puts("}\n");
puts("vlSymsp->__Vm_baseCode = code;\n");
puts("tracep->pushPrefix(std::string{vlSymsp->name()}, "
"VerilatedTracePrefixType::SCOPE_MODULE);\n");
puts("tracep->pushPrefix(vlSymsp->name(), VerilatedTracePrefixType::SCOPE_MODULE);\n");
puts(topModNameProtected + "__" + protect("trace_decl_types") + "(tracep);\n");
puts(topModNameProtected + "__" + protect("trace_init_top") + "(vlSelf, tracep);\n");
puts("tracep->popPrefix();\n");