mirror of
https://github.com/verilator/verilator.git
synced 2026-08-30 09:48:22 +02:00
Fixes #7408.
This commit is contained in:
+8
-2
@@ -5061,8 +5061,14 @@ AstFunc* V3Randomize::newSRandomFunc(VMemberMap& memberMap, AstClass* nodep) {
|
||||
funcp->isVirtual(false);
|
||||
basep->addMembersp(funcp);
|
||||
memberMap.insert(nodep, funcp);
|
||||
funcp->addStmtsp(new AstCStmt{basep->fileline(), "__Vm_rng.srandom(seed);"});
|
||||
basep->needRNG(true);
|
||||
// For std::process, seed the per-process RNG via m_process->srandom()
|
||||
// For regular classes, seed the per-object RNG via __Vm_rng
|
||||
if (basep->name() == "process") {
|
||||
funcp->addStmtsp(new AstCStmt{basep->fileline(), "__PVT__m_process->srandom(seed);"});
|
||||
} else {
|
||||
funcp->addStmtsp(new AstCStmt{basep->fileline(), "__Vm_rng.srandom(seed);"});
|
||||
basep->needRNG(true);
|
||||
}
|
||||
}
|
||||
return funcp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user