[#73220] fix writing out empty net groups
This commit is contained in:
parent
ab9ee43f8d
commit
05fdfca5b1
|
|
@ -230,10 +230,10 @@ void VerilatedSaif::close() VL_MT_SAFE_EXCLUDES(m_mutex) {
|
|||
printStr(")\n");
|
||||
|
||||
incrementIndent();
|
||||
printInstance(0);
|
||||
recursivelyPrintScopes(TOP_SCOPE_INDEX);
|
||||
decrementIndent();
|
||||
|
||||
printStr(")\n"); // SAIFILE
|
||||
printStr(")\n"); // SAIFILE
|
||||
|
||||
// This function is on the flush() call path
|
||||
const VerilatedLockGuard lock{m_mutex};
|
||||
|
|
@ -244,7 +244,7 @@ void VerilatedSaif::close() VL_MT_SAFE_EXCLUDES(m_mutex) {
|
|||
Super::closeBase();
|
||||
}
|
||||
|
||||
void VerilatedSaif::printInstance(uint32_t scopeIndex) {
|
||||
void VerilatedSaif::recursivelyPrintScopes(uint32_t scopeIndex) {
|
||||
const SaifScope& saifScope = m_scopes.at(scopeIndex);
|
||||
|
||||
printIndent();
|
||||
|
|
@ -252,12 +252,11 @@ void VerilatedSaif::printInstance(uint32_t scopeIndex) {
|
|||
printStr(saifScope.scopeName.c_str());
|
||||
printStr("\n");
|
||||
|
||||
//NOTE: for now only care about NET, also PORT will be added
|
||||
incrementIndent();
|
||||
printIndent();
|
||||
printStr("(NET\n");
|
||||
|
||||
incrementIndent();
|
||||
bool anyNetValid{true};
|
||||
|
||||
//NOTE: for now only care about NET, also PORT will be added
|
||||
for (auto& childSignalCode : saifScope.childSignalCodes) {
|
||||
ActivityVar& activity = m_activity.at(childSignalCode);
|
||||
for (size_t i = 0; i < activity.width; i++) {
|
||||
|
|
@ -271,6 +270,14 @@ void VerilatedSaif::printInstance(uint32_t scopeIndex) {
|
|||
}
|
||||
assert(m_time >= bit.highTime);
|
||||
|
||||
if (!anyNetValid) {
|
||||
printIndent();
|
||||
printStr("(NET\n");
|
||||
anyNetValid = true;
|
||||
|
||||
incrementIndent();
|
||||
}
|
||||
|
||||
printIndent();
|
||||
printStr("(");
|
||||
printStr(activity.name.c_str());
|
||||
|
|
@ -292,13 +299,16 @@ void VerilatedSaif::printInstance(uint32_t scopeIndex) {
|
|||
}
|
||||
activity.lastTime = m_time;
|
||||
}
|
||||
decrementIndent();
|
||||
|
||||
printIndent();
|
||||
printStr(")\n"); // NET
|
||||
if (anyNetValid) {
|
||||
decrementIndent();
|
||||
|
||||
printIndent();
|
||||
printStr(")\n"); // NET
|
||||
}
|
||||
|
||||
for (uint32_t childScopeIndex : saifScope.childScopesIndices) {
|
||||
printInstance(childScopeIndex);
|
||||
recursivelyPrintScopes(childScopeIndex);
|
||||
}
|
||||
|
||||
decrementIndent();
|
||||
|
|
|
|||
|
|
@ -93,9 +93,9 @@ private:
|
|||
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
|
||||
|
||||
std::vector<SaifScope> m_scopes{};
|
||||
std::vector<uint32_t> m_topScopes{};
|
||||
static constexpr int32_t TOP_SCOPE_INDEX{0};
|
||||
int32_t m_currentScope{-1};
|
||||
std::vector<SaifScope> m_scopes{};
|
||||
|
||||
std::unordered_map<uint32_t, ActivityVar> m_activity;
|
||||
std::vector<std::vector<ActivityBit>> m_activityArena;
|
||||
|
|
@ -123,7 +123,7 @@ private:
|
|||
void declare(uint32_t code, const char* name, const char* wirep, bool array, int arraynum,
|
||||
bool bussed, int msb, int lsb);
|
||||
|
||||
void printInstance(uint32_t scopeIndex);
|
||||
void recursivelyPrintScopes(uint32_t scopeIndex);
|
||||
|
||||
// CONSTRUCTORS
|
||||
VL_UNCOPYABLE(VerilatedSaif);
|
||||
|
|
|
|||
Loading…
Reference in New Issue