Fix wide structure VL_TOSTRING_W generation (#4188) (#4189)

* V3Common.cpp::makeVlToString: fix `VL_TOSTRING_W` statement generation to include width argument

* fix contribution name

* add testcase for long struct `VL_TO_STRING_W` bug
This commit is contained in:
Aylon Chaim Porat
2023-05-10 20:34:44 -04:00
committed by GitHub
parent 2267db093f
commit d5de67c6dc
4 changed files with 45 additions and 3 deletions
+5 -3
View File
@@ -82,11 +82,13 @@ static void makeVlToString(AstNodeUOrStructDType* nodep) {
}
stmt += VIdProtect::protect(itemp->prettyName()) + ":\" + ";
if (VN_IS(itemp->dtypep()->skipRefp(), BasicDType) && itemp->isWide()) {
stmt += "VL_TO_STRING_W";
stmt += "VL_TO_STRING_W(";
stmt += cvtToStr(itemp->widthWords());
stmt += ", ";
} else {
stmt += "VL_TO_STRING";
stmt += "VL_TO_STRING(";
}
stmt += "(obj." + itemp->nameProtect() + ");\n";
stmt += "obj." + itemp->nameProtect() + ");\n";
funcp->addStmtsp(new AstCStmt{nodep->fileline(), stmt});
}
funcp->addStmtsp(new AstCStmt{nodep->fileline(), "out += \"}\";\n"});