[#73220] add support for multiple top scopes

This commit is contained in:
Mateusz Gancarz 2025-02-21 11:07:20 +01:00
parent dacad79fdf
commit 3ffee61df9
2 changed files with 6 additions and 2 deletions

View File

@ -230,7 +230,9 @@ void VerilatedSaif::close() VL_MT_SAFE_EXCLUDES(m_mutex) {
printStr(")\n"); printStr(")\n");
incrementIndent(); incrementIndent();
recursivelyPrintScopes(TOP_SCOPE_INDEX); for (uint32_t topScopeIndex : m_topScopes) {
recursivelyPrintScopes(topScopeIndex);
}
decrementIndent(); decrementIndent();
printStr(")\n"); // SAIFILE printStr(")\n"); // SAIFILE
@ -403,6 +405,8 @@ void VerilatedSaif::pushPrefix(const std::string& name, VerilatedTracePrefixType
if (m_currentScope >= 0) { if (m_currentScope >= 0) {
m_scopes.at(m_currentScope).childScopesIndices.emplace_back(newScopeIndex); m_scopes.at(m_currentScope).childScopesIndices.emplace_back(newScopeIndex);
newScope.parentScopeIndex = m_currentScope; newScope.parentScopeIndex = m_currentScope;
} else {
m_topScopes.emplace_back(newScopeIndex);
} }
m_currentScope = newScopeIndex; m_currentScope = newScopeIndex;
} }

View File

@ -92,9 +92,9 @@ private:
size_t m_maxSignalBytes = 0; // Upper bound on number of bytes a single signal can generate size_t m_maxSignalBytes = 0; // Upper bound on number of bytes a single signal can generate
uint64_t m_wroteBytes = 0; // Number of bytes written to this file uint64_t m_wroteBytes = 0; // Number of bytes written to this file
static constexpr int32_t TOP_SCOPE_INDEX{0};
int32_t m_currentScope{-1}; int32_t m_currentScope{-1};
std::vector<SaifScope> m_scopes{}; std::vector<SaifScope> m_scopes{};
std::vector<uint32_t> m_topScopes{};
std::unordered_map<uint32_t, ActivityVar> m_activity; std::unordered_map<uint32_t, ActivityVar> m_activity;
std::vector<std::vector<ActivityBit>> m_activityArena; std::vector<std::vector<ActivityBit>> m_activityArena;