Fix x assign vs init randomization (#6075)

This commit is contained in:
Todd Strader
2025-06-09 17:59:01 -04:00
committed by GitHub
parent a6bae7f196
commit d9534ec626
7 changed files with 47 additions and 55 deletions
+3 -1
View File
@@ -769,7 +769,8 @@ string EmitCFunc::emitVarResetRecurse(const AstVar* varp, bool constructing,
}
} else {
out += zeroit ? (slow ? "VL_ZERO_RESET_W(" : "VL_ZERO_W(")
: "VL_SCOPED_RAND_RESET_W(";
: (varp->isXTemp() ? "VL_SCOPED_RAND_RESET_ASSIGN_W("
: "VL_SCOPED_RAND_RESET_W(");
out += cvtToStr(dtypep->widthMin());
out += ", " + varNameProtected + suffix;
if (!zeroit) {
@@ -797,6 +798,7 @@ string EmitCFunc::emitVarResetRecurse(const AstVar* varp, bool constructing,
emitVarResetScopeHash();
const uint64_t salt = VString::hashMurmur(varp->prettyName());
out += " = VL_SCOPED_RAND_RESET_";
if (varp->isXTemp()) out += "ASSIGN_";
out += dtypep->charIQWN();
out += "(" + cvtToStr(dtypep->widthMin()) + ", "
+ (m_classOrPackage ? m_classOrPackageHash : "__VscopeHash") + ", "