Improve struct scopes when dumping structs to VCD (#2776)

This commit is contained in:
Àlex Torregrosa
2021-02-03 14:40:21 -05:00
committed by GitHub
parent 843ae2955e
commit e77e4e1fe6
7 changed files with 57 additions and 39 deletions
+11 -2
View File
@@ -401,13 +401,22 @@ void VerilatedVcd::dumpHeader() {
if (*np == ' ') np++;
if (*np == '\t') break; // tab means signal name starts
printIndent(1);
printStr("$scope module ");
// Find character after name end
const char* sp = np;
while(*sp && *sp != ' ' && *sp != '\t' && *sp != '\f') sp++;
if (*sp == '\f') {
printStr("$scope struct ");
} else {
printStr("$scope module ");
}
for (; *np && *np != ' ' && *np != '\t'; np++) {
if (*np == '[') {
printStr("(");
} else if (*np == ']') {
printStr(")");
} else {
} else if (*np != '\f'){
*m_writep++ = *np;
}
}