Add --emit-accessors (#5182) (#5227)

This commit is contained in:
Ryan Ziegler
2024-07-06 13:12:53 +01:00
committed by GitHub
parent de44ca8df3
commit 947b6fd23f
11 changed files with 111 additions and 0 deletions
+11
View File
@@ -118,6 +118,17 @@ class EmitCModel final : public EmitCFunc {
}
}
}
if(v3Global.opt.emitAccessors()) {
puts("\n// ACCESSORS\n"
"// The application code should use these methods to\n"
"// propagate new values into/out from the Verilated model\n"
"// instead of using signal variables directly.\n");
for (const AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) {
if (const AstVar* const varp = VN_CAST(nodep, Var)) {
if (varp->isPrimaryIO()) emitVarAccessors(varp);
}
}
}
if (optSystemC() && v3Global.usesTiming()) puts("sc_core::sc_event trigger_eval;\n");
// Cells instantiated by the top level (for access to /* verilator public */)