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