Review fixes
This commit is contained in:
parent
99d3f600c0
commit
65aa539ff0
|
|
@ -1700,7 +1700,6 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
|
|||
if (m_reloopLimit < 2) fl->v3error("--reloop-limit must be >= 2: " << valp);
|
||||
});
|
||||
DECL_OPTION("-report-unoptflat", OnOff, &m_reportUnoptflat);
|
||||
DECL_OPTION("-runtime-zero-delay", OnOff, &m_runtimeZeroDelay);
|
||||
DECL_OPTION("-rr", CbCall, []() {}); // Processed only in bin/verilator shell
|
||||
DECL_OPTION("-runtime-debug", CbCall, [this, fl]() {
|
||||
decorations(fl, "node");
|
||||
|
|
@ -1717,6 +1716,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
|
|||
m_outFormatOk = true;
|
||||
m_systemC = true;
|
||||
});
|
||||
DECL_OPTION("-sched-zero-delay", OnOff, &m_schedZeroDelay);
|
||||
DECL_OPTION("-skip-identical", OnOff, &m_skipIdentical);
|
||||
DECL_OPTION("-stats", OnOff, &m_stats);
|
||||
DECL_OPTION("-stats-vars", CbOnOff, [this](bool flag) {
|
||||
|
|
|
|||
|
|
@ -284,8 +284,8 @@ private:
|
|||
bool m_quietStats = false; // main switch: --quiet-stats
|
||||
bool m_relativeIncludes = false; // main switch: --relative-includes
|
||||
bool m_reportUnoptflat = false; // main switch: --report-unoptflat
|
||||
VOptionBool m_runtimeZeroDelay; // main switch: --runtime-zero-delay
|
||||
bool m_savable = false; // main switch: --savable
|
||||
VOptionBool m_schedZeroDelay; // main switch: --sched-zero-delay
|
||||
bool m_stdPackage = true; // main switch: --std-package
|
||||
bool m_stdWaiver = true; // main switch: --std-waiver
|
||||
bool m_structsPacked = false; // main switch: --structs-packed
|
||||
|
|
@ -492,6 +492,7 @@ public:
|
|||
bool underlineZero() const { return m_underlineZero; }
|
||||
bool systemC() const VL_MT_SAFE { return m_systemC; }
|
||||
bool savable() const VL_MT_SAFE { return m_savable; }
|
||||
VOptionBool schedZeroDelay() const { return m_schedZeroDelay; }
|
||||
bool stats() const { return m_stats; }
|
||||
bool statsVars() const { return m_statsVars; }
|
||||
bool stdPackage() const { return m_stdPackage; }
|
||||
|
|
@ -583,7 +584,6 @@ public:
|
|||
bool quietExit() const VL_MT_SAFE { return m_quietExit; }
|
||||
bool quietStats() const VL_MT_SAFE { return m_quietStats; }
|
||||
bool reportUnoptflat() const { return m_reportUnoptflat; }
|
||||
VOptionBool runtimeZeroDelay() const { return m_runtimeZeroDelay; }
|
||||
bool verilate() const { return m_verilate; }
|
||||
bool vpi() const { return m_vpi; }
|
||||
bool waiverMultiline() const { return m_waiverMultiline; }
|
||||
|
|
|
|||
|
|
@ -690,8 +690,8 @@ void createEval(AstNetlist* netlistp, //
|
|||
const std::string& line = std::to_string(locp->lineno());
|
||||
stmtp->add(
|
||||
"VL_FATAL_MT(\"" + V3OutFormatter::quoteNameControls(file) + "\", " + line
|
||||
+ ", \"\", \"ZERODLY: Design verilated with '--no-runtime-zero-delay', "
|
||||
+ "but #0 delay encountered at runtime\");");
|
||||
+ ", \"\", \"ZERODLY: Design Verilated with '--no-sched-zero-delay', "
|
||||
+ "but #0 delay executed at runtime\");");
|
||||
return stmtp;
|
||||
}
|
||||
}());
|
||||
|
|
|
|||
|
|
@ -946,35 +946,35 @@ class TimingControlVisitor final : public VNVisitor {
|
|||
// Simplify
|
||||
valuep = V3Const::constifyEdit(valuep);
|
||||
}
|
||||
// Check if a #0 delay is used
|
||||
if (AstConst* const constp = VN_CAST(valuep, Const)) {
|
||||
// Delay statically known constant. Check if zero
|
||||
if (constp->num().isEqZero()) {
|
||||
m_hasStaticZeroDelay = true;
|
||||
if (v3Global.opt.runtimeZeroDelay().isSetFalse()) {
|
||||
// User promised there will not be #0 delays executed at runtime.
|
||||
// Trust them but warn a #0 delay statically exists.
|
||||
nodep->v3warn(
|
||||
ZERODLY,
|
||||
"Static #0 delay exists, but '--no-runtime-zero-delay' was given.\n"
|
||||
<< nodep->warnMore() //
|
||||
<< "... Can proceed, but this will fail at runtime if executed.");
|
||||
} else {
|
||||
// Sadly we have a #0
|
||||
v3Global.setUsesZeroDelay();
|
||||
}
|
||||
|
||||
if (v3Global.opt.schedZeroDelay().isSetTrue()) {
|
||||
// User said to schedule for #0 support, nothing else to do
|
||||
v3Global.setUsesZeroDelay();
|
||||
} else if (v3Global.opt.schedZeroDelay().isSetFalse()) {
|
||||
// User said to schedule without #0 support. Still warn if a static #0 delay exists
|
||||
if (valuep->isZero()) {
|
||||
nodep->v3warn(
|
||||
ZERODLY,
|
||||
"Static #0 delay exists, but '--no-sched-zero-delay' was given.\n"
|
||||
<< nodep->warnMore() //
|
||||
<< "... Can proceed, but this will fail at runtime if executed.");
|
||||
}
|
||||
} else {
|
||||
// Delay is not statically known
|
||||
if (v3Global.opt.runtimeZeroDelay().isSetFalse()) {
|
||||
// User promised there will not be #0 delays executed at runtime, trust them.
|
||||
} else {
|
||||
// Record location. We will warn if no static #0 delays used.
|
||||
m_unknownDelayFlps.push_back(nodep->fileline());
|
||||
// Assume it can be a #0
|
||||
// User did not express preference, decide based on presence of delays
|
||||
if (valuep->isZero()) {
|
||||
// Statically known #0 delay exists, schedule for #0 support
|
||||
v3Global.setUsesZeroDelay();
|
||||
m_hasStaticZeroDelay = true;
|
||||
// Don't warn on variable delays, as no point
|
||||
m_unknownDelayFlps.clear();
|
||||
} else if (!VN_IS(valuep, Const)) {
|
||||
// Delay is not known at compiile time. Conservatively schedule for #0 support,
|
||||
// but warn if no static #0 delays used as performance might be improved
|
||||
v3Global.setUsesZeroDelay();
|
||||
if (!m_hasStaticZeroDelay) m_unknownDelayFlps.push_back(nodep->fileline());
|
||||
}
|
||||
}
|
||||
|
||||
// Replace self with a 'co_await dlySched.delay(<valuep>)'
|
||||
AstCMethodHard* const delayMethodp = new AstCMethodHard{
|
||||
flp, new AstVarRef{flp, getCreateDelayScheduler(), VAccess::WRITE},
|
||||
|
|
@ -1366,24 +1366,19 @@ public:
|
|||
iterate(nodep);
|
||||
|
||||
// If there is no static #0 in the design, but an unknown delay was found,
|
||||
// and '--runtime-zero-delay' was not given, then warn on all unknown delays
|
||||
// and the user did not specify preference, then warn on all unknown delays
|
||||
// as we will be assuming they can be #0, which can cause performance degradation.
|
||||
if (!m_hasStaticZeroDelay //
|
||||
&& !v3Global.opt.runtimeZeroDelay().isSetTrue() //
|
||||
&& !m_unknownDelayFlps.empty()) {
|
||||
UASSERT_OBJ(v3Global.usesZeroDelay(), nodep, "Should have assumed can be #0");
|
||||
for (FileLine* const flp : m_unknownDelayFlps) {
|
||||
flp->v3warn(ZERODLY,
|
||||
"Value of # delay control statically unknown. Assuming it can be #0.\n"
|
||||
<< flp->warnMore() //
|
||||
<< "... If all # delays are non-zero at runtime,\n"
|
||||
<< flp->warnMore() //
|
||||
<< "... use '--no-runtime-zero-delay' for improved performance.\n"
|
||||
<< flp->warnMore() //
|
||||
<< "... If a real #0 is expected at runtime,\n"
|
||||
<< flp->warnMore() //
|
||||
<< "... use '--runtime-zero-delay' to suppress this warning.");
|
||||
}
|
||||
for (FileLine* const flp : m_unknownDelayFlps) {
|
||||
flp->v3warn(ZERODLY,
|
||||
"Value of # delay control statically unknown. Assuming it can be #0.\n"
|
||||
<< flp->warnMore() //
|
||||
<< "... If all # delays are non-zero at runtime,\n"
|
||||
<< flp->warnMore() //
|
||||
<< "... use '--no-sched-zero-delay' for improved performance.\n"
|
||||
<< flp->warnMore() //
|
||||
<< "... If a real #0 is expected at runtime,\n"
|
||||
<< flp->warnMore() //
|
||||
<< "... use '--sched-zero-delay' to suppress this warning.");
|
||||
}
|
||||
}
|
||||
~TimingControlVisitor() override = default;
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
%Warning-ZERODLY: t/t_flag_runtime_zero_delay_none_bad.v:12:5: Value of # delay control statically unknown. Assuming it can be #0.
|
||||
: ... If all # delays are non-zero at runtime,
|
||||
: ... use '--no-runtime-zero-delay' for improved performance.
|
||||
: ... If a real #0 is expected at runtime,
|
||||
: ... use '--runtime-zero-delay' to suppress this warning.
|
||||
12 | #a;
|
||||
| ^
|
||||
... For warning description see https://verilator.org/warn/ZERODLY?v=latest
|
||||
... Use "/* verilator lint_off ZERODLY */" and lint_on around source to disable this message.
|
||||
%Warning-ZERODLY: t/t_flag_runtime_zero_delay_none_bad.v:14:5: Value of # delay control statically unknown. Assuming it can be #0.
|
||||
: ... If all # delays are non-zero at runtime,
|
||||
: ... use '--no-runtime-zero-delay' for improved performance.
|
||||
: ... If a real #0 is expected at runtime,
|
||||
: ... use '--runtime-zero-delay' to suppress this warning.
|
||||
14 | #a;
|
||||
| ^
|
||||
%Error: Exiting due to
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
%Warning-ZERODLY: t/t_flag_runtime_zero_delay_off_run.v:17:9: Static #0 delay exists, but '--no-runtime-zero-delay' was given.
|
||||
: ... Can proceed, but this will fail at runtime if executed.
|
||||
17 | #0;
|
||||
| ^
|
||||
... For warning description see https://verilator.org/warn/ZERODLY?v=latest
|
||||
... Use "/* verilator lint_off ZERODLY */" and lint_on around source to disable this message.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
%Error-ZERODLY: t/t_flag_runtime_zero_delay_off_bad.v:9: Design verilated with '--no-runtime-zero-delay', but #0 delay encountered at runtime
|
||||
Aborting...
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
%Warning-ZERODLY: t/t_flag_sched_zero_delay_none_bad.v:12:5: Value of # delay control statically unknown. Assuming it can be #0.
|
||||
: ... If all # delays are non-zero at runtime,
|
||||
: ... use '--no-sched-zero-delay' for improved performance.
|
||||
: ... If a real #0 is expected at runtime,
|
||||
: ... use '--sched-zero-delay' to suppress this warning.
|
||||
12 | #a;
|
||||
| ^
|
||||
... For warning description see https://verilator.org/warn/ZERODLY?v=latest
|
||||
... Use "/* verilator lint_off ZERODLY */" and lint_on around source to disable this message.
|
||||
%Warning-ZERODLY: t/t_flag_sched_zero_delay_none_bad.v:14:5: Value of # delay control statically unknown. Assuming it can be #0.
|
||||
: ... If all # delays are non-zero at runtime,
|
||||
: ... use '--no-sched-zero-delay' for improved performance.
|
||||
: ... If a real #0 is expected at runtime,
|
||||
: ... use '--sched-zero-delay' to suppress this warning.
|
||||
14 | #a;
|
||||
| ^
|
||||
%Error: Exiting due to
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
%Warning-ZERODLY: t/t_flag_runtime_zero_delay_off_bad.v:10:11: Static #0 delay exists, but '--no-runtime-zero-delay' was given.
|
||||
: ... Can proceed, but this will fail at runtime if executed.
|
||||
%Warning-ZERODLY: t/t_flag_sched_zero_delay_off_bad.v:10:11: Static #0 delay exists, but '--no-sched-zero-delay' was given.
|
||||
: ... Can proceed, but this will fail at runtime if executed.
|
||||
10 | initial #0;
|
||||
| ^
|
||||
... For warning description see https://verilator.org/warn/ZERODLY?v=latest
|
||||
|
|
@ -11,7 +11,7 @@ import vltest_bootstrap
|
|||
|
||||
test.scenarios('vlt')
|
||||
|
||||
test.compile(verilator_flags2=["--binary", "--no-runtime-zero-delay"],
|
||||
test.compile(verilator_flags2=["--binary", "--no-sched-zero-delay"],
|
||||
fails=True,
|
||||
expect_filename=test.golden_filename)
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
%Warning-ZERODLY: t/t_flag_sched_zero_delay_off_run.v:17:9: Static #0 delay exists, but '--no-sched-zero-delay' was given.
|
||||
: ... Can proceed, but this will fail at runtime if executed.
|
||||
17 | #0;
|
||||
| ^
|
||||
... For warning description see https://verilator.org/warn/ZERODLY?v=latest
|
||||
... Use "/* verilator lint_off ZERODLY */" and lint_on around source to disable this message.
|
||||
|
|
@ -12,7 +12,7 @@ import vltest_bootstrap
|
|||
test.scenarios('vlt')
|
||||
|
||||
test.compile(verilator_flags2=[
|
||||
"--timing", "--main", "--exe", "--no-skip-identical", "--no-runtime-zero-delay", "-Wno-fatal"
|
||||
"--timing", "--main", "--exe", "--no-skip-identical", "--no-sched-zero-delay", "-Wno-fatal"
|
||||
],
|
||||
expect_filename=test.golden_filename)
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
%Error-ZERODLY: t/t_flag_sched_zero_delay_off_bad.v:9: Design Verilated with '--no-sched-zero-delay', but #0 delay executed at runtime
|
||||
Aborting...
|
||||
|
|
@ -11,9 +11,9 @@ import vltest_bootstrap
|
|||
|
||||
test.scenarios('vlt')
|
||||
|
||||
test.top_filename = "t_flag_runtime_zero_delay_off_bad.v"
|
||||
test.top_filename = "t_flag_sched_zero_delay_off_bad.v"
|
||||
|
||||
test.compile(verilator_flags2=["--binary", "--no-runtime-zero-delay", "-Wno-fatal"])
|
||||
test.compile(verilator_flags2=["--binary", "--no-sched-zero-delay", "-Wno-fatal"])
|
||||
|
||||
test.execute(fails=True, expect_filename=test.golden_filename)
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ import vltest_bootstrap
|
|||
|
||||
test.scenarios('vlt')
|
||||
|
||||
test.compile(verilator_flags2=["--binary", "--runtime-zero-delay"])
|
||||
test.compile(verilator_flags2=["--binary", "--sched-zero-delay"])
|
||||
|
||||
test.execute(check_finished=True)
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ import vltest_bootstrap
|
|||
|
||||
test.scenarios('simulator')
|
||||
|
||||
test.compile(verilator_flags2=["--binary", "--no-runtime-zero-delay"])
|
||||
test.compile(verilator_flags2=["--binary", "--no-sched-zero-delay"])
|
||||
|
||||
test.execute()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import vltest_bootstrap
|
|||
|
||||
test.scenarios('simulator')
|
||||
|
||||
test.compile(verilator_flags2=["--binary", "--no-runtime-zero-delay"])
|
||||
test.compile(verilator_flags2=["--binary", "--no-sched-zero-delay"])
|
||||
|
||||
test.execute(expect_filename=test.golden_filename)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import vltest_bootstrap
|
|||
|
||||
test.scenarios('simulator')
|
||||
|
||||
test.compile(verilator_flags2=["--binary", "--no-runtime-zero-delay"])
|
||||
test.compile(verilator_flags2=["--binary", "--no-sched-zero-delay"])
|
||||
|
||||
test.execute(expect_filename=test.golden_filename)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import vltest_bootstrap
|
|||
|
||||
test.scenarios('simulator')
|
||||
|
||||
test.compile(verilator_flags2=["--binary", "--no-runtime-zero-delay"])
|
||||
test.compile(verilator_flags2=["--binary", "--no-sched-zero-delay"])
|
||||
|
||||
test.execute()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue