From 785c51dd0b9e67b87b18b6c23a19934aa1937f2b Mon Sep 17 00:00:00 2001 From: Krzysztof Bieganski Date: Fri, 21 Oct 2022 20:56:44 +0000 Subject: [PATCH] Fix emitting timing debug info with `--protect-ids` (#3689) (#3701) --- include/verilated_timing.h | 16 +++-- src/V3SchedTiming.cpp | 4 +- src/V3Timing.cpp | 29 ++++---- test_regress/t/t_timing_debug2.out | 104 ++++++++++++++-------------- test_regress/t/t_timing_fork_join.v | 46 ++++++------ test_regress/t/t_timing_protect.pl | 43 ++++++++++++ 6 files changed, 147 insertions(+), 95 deletions(-) create mode 100755 test_regress/t/t_timing_protect.pl diff --git a/include/verilated_timing.h b/include/verilated_timing.h index 9b179341e..79eb1c0dd 100644 --- a/include/verilated_timing.h +++ b/include/verilated_timing.h @@ -53,6 +53,9 @@ #endif // clang-format on +// Placeholder for compiling with --protect-ids +#define VL_UNKNOWN "" + //============================================================================= // VlFileLineDebug stores a SystemVerilog source code location. Used in VlCoroutineHandle for // debugging purposes. @@ -170,7 +173,7 @@ public: void dump() const; #endif // Used by coroutines for co_awaiting a certain simulation time - auto delay(uint64_t delay, const char* filename, int lineno) { + auto delay(uint64_t delay, const char* filename = VL_UNKNOWN, int lineno = 0) { struct Awaitable { VlDelayedCoroutineQueue& queue; uint64_t delay; @@ -208,16 +211,17 @@ class VlTriggerScheduler final { public: // METHODS // Resumes all coroutines from the 'ready' stage - void resume(const char* eventDescription); + void resume(const char* eventDescription = VL_UNKNOWN); // Moves all coroutines from m_uncommitted to m_ready - void commit(const char* eventDescription); + void commit(const char* eventDescription = VL_UNKNOWN); // Are there no coroutines awaiting? bool empty() const { return m_ready.empty() && m_uncommitted.empty(); } #ifdef VL_DEBUG void dump(const char* eventDescription) const; #endif // Used by coroutines for co_awaiting a certain trigger - auto trigger(const char* eventDescription, const char* filename, int lineno) { + auto trigger(const char* eventDescription = VL_UNKNOWN, const char* filename = VL_UNKNOWN, + int lineno = 0) { VL_DEBUG_IF(VL_DBG_MSGF(" Suspending process waiting for %s at %s:%d\n", eventDescription, filename, lineno);); struct Awaitable { @@ -273,9 +277,9 @@ public: void init(size_t count) { m_join.reset(new VlJoin{count, {}}); } // Called whenever any of the forked processes finishes. If the join counter reaches 0, the // main process gets resumed - void done(const char* filename, int lineno); + void done(const char* filename = VL_UNKNOWN, int lineno = 0); // Used by coroutines for co_awaiting a join - auto join(const char* filename, int lineno) { + auto join(const char* filename = VL_UNKNOWN, int lineno = 0) { assert(m_join); VL_DEBUG_IF( VL_DBG_MSGF(" Awaiting join of fork at: %s:%d\n", filename, lineno);); diff --git a/src/V3SchedTiming.cpp b/src/V3SchedTiming.cpp index 36d9acd54..ac208122a 100644 --- a/src/V3SchedTiming.cpp +++ b/src/V3SchedTiming.cpp @@ -115,7 +115,7 @@ AstCCall* TimingKit::createCommit(AstNetlist* const netlistp) { // Create the commit call and put it in the commit function auto* const commitp = new AstCMethodHard{ flp, new AstVarRef{flp, schedulerp, VAccess::READWRITE}, "commit"}; - commitp->addPinsp(resumep->pinsp()->cloneTree(false)); + if (resumep->pinsp()) commitp->addPinsp(resumep->pinsp()->cloneTree(false)); commitp->statement(true); commitp->dtypeSetVoid(); newactp->addStmtsp(commitp); @@ -159,7 +159,7 @@ TimingKit prepareTiming(AstNetlist* const netlistp) { // Create a resume() call on the timing scheduler auto* const resumep = new AstCMethodHard{ flp, new AstVarRef{flp, schedulerp, VAccess::READWRITE}, "resume"}; - if (schedulerp->dtypep()->basicp()->isTriggerScheduler()) { + if (schedulerp->dtypep()->basicp()->isTriggerScheduler() && methodp->pinsp()) { resumep->addPinsp(methodp->pinsp()->cloneTree(false)); } resumep->statement(true); diff --git a/src/V3Timing.cpp b/src/V3Timing.cpp index 6eddfd97a..02cdee3e5 100644 --- a/src/V3Timing.cpp +++ b/src/V3Timing.cpp @@ -256,6 +256,19 @@ private: } return VN_AS(sensesp->user2p(), Text)->cloneTree(false); } + // Adds debug info to a hardcoded method call + void addDebugInfo(AstCMethodHard* const methodp) const { + if (v3Global.opt.protectIds()) return; + FileLine* const flp = methodp->fileline(); + methodp->addPinsp(new AstText{flp, '"' + flp->filename() + '"'}); + methodp->addPinsp(new AstText{flp, cvtToStr(flp->lineno())}); + } + // Adds debug info to a trigSched.trigger() call + void addEventDebugInfo(AstCMethodHard* const methodp, AstSenTree* const sensesp) const { + if (v3Global.opt.protectIds()) return; + methodp->addPinsp(createEventDescription(sensesp)); + addDebugInfo(methodp); + } // Creates the fork handle type and returns it AstBasicDType* getCreateForkSyncDTypep() { if (m_forkDtp) return m_forkDtp; @@ -287,9 +300,7 @@ private: beginp->fileline(), new AstVarRef{flp, forkVscp, VAccess::WRITE}, "done"}; donep->dtypeSetVoid(); donep->statement(true); - // Add debug info - donep->addPinsp(new AstText{flp, '"' + flp->filename() + '"'}); - donep->addPinsp(new AstText{flp, cvtToStr(flp->lineno())}); + addDebugInfo(donep); beginp->addStmtsp(donep); } // Handle the 'join' part of a fork..join @@ -317,9 +328,7 @@ private: auto* const joinp = new AstCMethodHard{flp, new AstVarRef{flp, forkVscp, VAccess::WRITE}, "join"}; joinp->dtypeSetVoid(); - // Add debug info - joinp->addPinsp(new AstText{flp, '"' + flp->filename() + '"'}); - joinp->addPinsp(new AstText{flp, cvtToStr(flp->lineno())}); + addDebugInfo(joinp); auto* const awaitp = new AstCAwait{flp, joinp}; awaitp->statement(true); forkp->addNextHere(awaitp); @@ -462,9 +471,7 @@ private: auto* const delayMethodp = new AstCMethodHard{ flp, new AstVarRef{flp, getCreateDelayScheduler(), VAccess::WRITE}, "delay", valuep}; delayMethodp->dtypeSetVoid(); - // Add debug info - delayMethodp->addPinsp(new AstText{flp, '"' + flp->filename() + '"'}); - delayMethodp->addPinsp(new AstText{flp, cvtToStr(flp->lineno())}); + addDebugInfo(delayMethodp); // Create the co_await auto* const awaitp = new AstCAwait{flp, delayMethodp, getCreateDelaySenTree()}; awaitp->statement(true); @@ -487,9 +494,7 @@ private: "trigger"}; triggerMethodp->dtypeSetVoid(); // Add debug info - triggerMethodp->addPinsp(createEventDescription(sensesp)); - triggerMethodp->addPinsp(new AstText{flp, '"' + flp->filename() + '"'}); - triggerMethodp->addPinsp(new AstText{flp, cvtToStr(flp->lineno())}); + addEventDebugInfo(triggerMethodp, sensesp); // Create the co_await auto* const awaitp = new AstCAwait{flp, triggerMethodp, sensesp}; awaitp->statement(true); diff --git a/test_regress/t/t_timing_debug2.out b/test_regress/t/t_timing_debug2.out index 1c26fcefc..4988bab73 100644 --- a/test_regress/t/t_timing_debug2.out +++ b/test_regress/t/t_timing_debug2.out @@ -240,7 +240,7 @@ -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:30 [64] main process -V{t#,#}+ Vt_timing_debug2___024root____Vfork_h########__0__0 --V{t#,#} Suspending process waiting for @([event] t.e1) at t/t_timing_fork_join.v:33 +-V{t#,#} Suspending process waiting for @([event] t.event1) at t/t_timing_fork_join.v:33 fork..join_any process 2 -V{t#,#} Process forked at t/t_timing_fork_join.v:37 finished -V{t#,#} Awaiting join of fork at: t/t_timing_fork_join.v:31 @@ -250,7 +250,7 @@ back in main process -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act -V{t#,#} No triggers active -V{t#,#}+ Vt_timing_debug2___024root___timing_commit --V{t#,#} Committing processes waiting for @([event] t.e1): +-V{t#,#} Committing processes waiting for @([event] t.event1): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:33 -V{t#,#}+ Vt_timing_debug2___024root___eval_nba -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act @@ -274,23 +274,23 @@ back in main process -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 1 is active: @([event] t.e1) +-V{t#,#} 'act' region trigger index 1 is active: @([event] t.event1) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} Ready processes waiting for @([event] t.e1): +-V{t#,#} Ready processes waiting for @([event] t.event1): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:33 --V{t#,#} Resuming processes waiting for @([event] t.e1) +-V{t#,#} Resuming processes waiting for @([event] t.event1) -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:33 fork..join_any process 1 -V{t#,#} Process forked at t/t_timing_fork_join.v:32 finished -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 1 is active: @([event] t.e1) +-V{t#,#} 'act' region trigger index 1 is active: @([event] t.event1) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} No ready processes waiting for @([event] t.e1) --V{t#,#} Resuming processes waiting for @([event] t.e1) +-V{t#,#} No ready processes waiting for @([event] t.event1) +-V{t#,#} Resuming processes waiting for @([event] t.event1) -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act @@ -317,14 +317,14 @@ fork..join_any process 1 -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:41 -V{t#,#}+ Vt_timing_debug2___024root____Vfork_h########__0__0 -V{t#,#}+ Vt_timing_debug2___024root____Vfork_h########__0__1 --V{t#,#} Suspending process waiting for @([event] t.e1) at t/t_timing_fork_join.v:44 +-V{t#,#} Suspending process waiting for @([event] t.event1) at t/t_timing_fork_join.v:44 -V{t#,#} Awaiting join of fork at: t/t_timing_fork_join.v:41 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act -V{t#,#} No triggers active -V{t#,#}+ Vt_timing_debug2___024root___timing_commit --V{t#,#} Committing processes waiting for @([event] t.e1): +-V{t#,#} Committing processes waiting for @([event] t.event1): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:44 -V{t#,#}+ Vt_timing_debug2___024root___eval_nba -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act @@ -373,50 +373,50 @@ back in main process -V{t#,#} Awaiting time 100: Process waiting at t/t_timing_fork_join.v:50 -V{t#,#} Resuming delayed processes -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:50 --V{t#,#} Suspending process waiting for @([event] t.e1) at t/t_timing_fork_join.v:51 +-V{t#,#} Suspending process waiting for @([event] t.event1) at t/t_timing_fork_join.v:51 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 1 is active: @([event] t.e1) +-V{t#,#} 'act' region trigger index 1 is active: @([event] t.event1) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} Ready processes waiting for @([event] t.e1): +-V{t#,#} Ready processes waiting for @([event] t.event1): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:44 --V{t#,#} Uncommitted processes waiting for @([event] t.e1): +-V{t#,#} Uncommitted processes waiting for @([event] t.event1): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:51 --V{t#,#} Resuming processes waiting for @([event] t.e1) +-V{t#,#} Resuming processes waiting for @([event] t.event1) -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:44 fork..join_any process 2 -V{t#,#} Process forked at t/t_timing_fork_join.v:43 finished --V{t#,#} Committing processes waiting for @([event] t.e1): +-V{t#,#} Committing processes waiting for @([event] t.event1): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:51 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 1 is active: @([event] t.e1) +-V{t#,#} 'act' region trigger index 1 is active: @([event] t.event1) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} Ready processes waiting for @([event] t.e1): +-V{t#,#} Ready processes waiting for @([event] t.event1): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:51 --V{t#,#} Resuming processes waiting for @([event] t.e1) +-V{t#,#} Resuming processes waiting for @([event] t.event1) -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:51 -V{t#,#}+ Vt_timing_debug2___024root____Vfork_h########__0__0 -V{t#,#}+ Vt_timing_debug2___024root____Vfork_h########__0__1 --V{t#,#} Suspending process waiting for @([event] t.e2) at t/t_timing_fork_join.v:62 +-V{t#,#} Suspending process waiting for @([event] t.event2) at t/t_timing_fork_join.v:62 -V{t#,#}+ Vt_timing_debug2___024root____Vfork_h########__0__2 --V{t#,#} Suspending process waiting for @([event] t.e3) at t/t_timing_fork_join.v:68 +-V{t#,#} Suspending process waiting for @([event] t.event3) at t/t_timing_fork_join.v:68 in main process --V{t#,#} Suspending process waiting for @([event] t.e1) at t/t_timing_fork_join.v:75 --V{t#,#} Committing processes waiting for @([event] t.e1): +-V{t#,#} Suspending process waiting for @([event] t.event1) at t/t_timing_fork_join.v:75 +-V{t#,#} Committing processes waiting for @([event] t.event1): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:75 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act -V{t#,#} No triggers active -V{t#,#}+ Vt_timing_debug2___024root___timing_commit --V{t#,#} Committing processes waiting for @([event] t.e2): +-V{t#,#} Committing processes waiting for @([event] t.event2): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:62 --V{t#,#} Committing processes waiting for @([event] t.e3): +-V{t#,#} Committing processes waiting for @([event] t.event3): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:68 -V{t#,#}+ Vt_timing_debug2___024root___eval_nba -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act @@ -438,21 +438,21 @@ in main process -V{t#,#} Resuming delayed processes -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:56 fork..join_none process 1 --V{t#,#} Suspending process waiting for @([event] t.e2) at t/t_timing_fork_join.v:58 +-V{t#,#} Suspending process waiting for @([event] t.event2) at t/t_timing_fork_join.v:58 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 2 is active: @([event] t.e2) +-V{t#,#} 'act' region trigger index 2 is active: @([event] t.event2) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} Ready processes waiting for @([event] t.e2): +-V{t#,#} Ready processes waiting for @([event] t.event2): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:62 --V{t#,#} Uncommitted processes waiting for @([event] t.e2): +-V{t#,#} Uncommitted processes waiting for @([event] t.event2): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:58 --V{t#,#} Resuming processes waiting for @([event] t.e2) +-V{t#,#} Resuming processes waiting for @([event] t.event2) -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:62 fork..join_none process 2 --V{t#,#} Committing processes waiting for @([event] t.e2): +-V{t#,#} Committing processes waiting for @([event] t.event2): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:58 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act @@ -478,21 +478,21 @@ fork..join_none process 2 -V{t#,#} Awaiting time 100: Process waiting at t/t_timing_fork_join.v:63 -V{t#,#} Resuming delayed processes -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:63 --V{t#,#} Suspending process waiting for @([event] t.e3) at t/t_timing_fork_join.v:64 +-V{t#,#} Suspending process waiting for @([event] t.event3) at t/t_timing_fork_join.v:64 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 3 is active: @([event] t.e3) +-V{t#,#} 'act' region trigger index 3 is active: @([event] t.event3) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} Ready processes waiting for @([event] t.e3): +-V{t#,#} Ready processes waiting for @([event] t.event3): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:68 --V{t#,#} Uncommitted processes waiting for @([event] t.e3): +-V{t#,#} Uncommitted processes waiting for @([event] t.event3): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:64 --V{t#,#} Resuming processes waiting for @([event] t.e3) +-V{t#,#} Resuming processes waiting for @([event] t.event3) -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:68 fork..join_none process 3 --V{t#,#} Committing processes waiting for @([event] t.e3): +-V{t#,#} Committing processes waiting for @([event] t.event3): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:64 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act @@ -518,21 +518,21 @@ fork..join_none process 3 -V{t#,#} Awaiting time 100: Process waiting at t/t_timing_fork_join.v:69 -V{t#,#} Resuming delayed processes -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:69 --V{t#,#} Suspending process waiting for @([event] t.e3) at t/t_timing_fork_join.v:70 +-V{t#,#} Suspending process waiting for @([event] t.event3) at t/t_timing_fork_join.v:70 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 3 is active: @([event] t.e3) +-V{t#,#} 'act' region trigger index 3 is active: @([event] t.event3) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} Ready processes waiting for @([event] t.e3): +-V{t#,#} Ready processes waiting for @([event] t.event3): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:64 --V{t#,#} Uncommitted processes waiting for @([event] t.e3): +-V{t#,#} Uncommitted processes waiting for @([event] t.event3): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:70 --V{t#,#} Resuming processes waiting for @([event] t.e3) +-V{t#,#} Resuming processes waiting for @([event] t.event3) -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:64 fork..join_none process 2 again --V{t#,#} Committing processes waiting for @([event] t.e3): +-V{t#,#} Committing processes waiting for @([event] t.event3): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:70 -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act @@ -561,12 +561,12 @@ fork..join_none process 2 again -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 2 is active: @([event] t.e2) +-V{t#,#} 'act' region trigger index 2 is active: @([event] t.event2) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} Ready processes waiting for @([event] t.e2): +-V{t#,#} Ready processes waiting for @([event] t.event2): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:58 --V{t#,#} Resuming processes waiting for @([event] t.e2) +-V{t#,#} Resuming processes waiting for @([event] t.event2) -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:58 fork..join_none process 1 again -V{t#,#}+ Vt_timing_debug2___024root___eval_act @@ -596,23 +596,23 @@ fork..join_none process 1 again -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 3 is active: @([event] t.e3) +-V{t#,#} 'act' region trigger index 3 is active: @([event] t.event3) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} Ready processes waiting for @([event] t.e3): +-V{t#,#} Ready processes waiting for @([event] t.event3): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:70 --V{t#,#} Resuming processes waiting for @([event] t.e3) +-V{t#,#} Resuming processes waiting for @([event] t.event3) -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:70 fork..join_none process 3 again -V{t#,#}+ Vt_timing_debug2___024root___eval_act -V{t#,#}+ Vt_timing_debug2___024root___eval_triggers__act -V{t#,#}+ Vt_timing_debug2___024root___dump_triggers__act --V{t#,#} 'act' region trigger index 1 is active: @([event] t.e1) +-V{t#,#} 'act' region trigger index 1 is active: @([event] t.event1) -V{t#,#}+ Vt_timing_debug2___024root___timing_commit -V{t#,#}+ Vt_timing_debug2___024root___timing_resume --V{t#,#} Ready processes waiting for @([event] t.e1): +-V{t#,#} Ready processes waiting for @([event] t.event1): -V{t#,#} - Process waiting at t/t_timing_fork_join.v:75 --V{t#,#} Resuming processes waiting for @([event] t.e1) +-V{t#,#} Resuming processes waiting for @([event] t.event1) -V{t#,#} Resuming: Process waiting at t/t_timing_fork_join.v:75 *-* All Finished *-* -V{t#,#}+ Vt_timing_debug2___024root___eval_act diff --git a/test_regress/t/t_timing_fork_join.v b/test_regress/t/t_timing_fork_join.v index 12ec14ef6..71865da6a 100644 --- a/test_regress/t/t_timing_fork_join.v +++ b/test_regress/t/t_timing_fork_join.v @@ -5,9 +5,9 @@ // SPDX-License-Identifier: CC0-1.0 module t; - event e1; - event e2; - event e3; + event event1; + event event2; + event event3; initial begin fork @@ -30,49 +30,49 @@ module t; #32 $write("[%0t] main process\n", $time); fork begin - @e1; + @event1; $write("fork..join_any process 1\n"); - ->e1; + ->event1; end $write("fork..join_any process 2\n"); join_any $write("back in main process\n"); - #1 ->e1; + #1 ->event1; #1 fork #2 $write("fork..join_any process 1\n"); begin - @e1; + @event1; $write("fork..join_any process 2\n"); - ->e1; + ->event1; end join_any $write("back in main process\n"); - #1 ->e1; - @e1; + #1 ->event1; + @event1; // Order of triggering: - // p1->e2 ==> p2->e3 ==> p3->e3 ==> p2->e2 ==> p1->e3 ==> p3->e1 + // p1->event2 ==> p2->event3 ==> p3->event3 ==> p2->event2 ==> p1->event3 ==> p3->event1 fork begin #1 $write("fork..join_none process 1\n"); - ->e2; - @e2 $write("fork..join_none process 1 again\n"); - #1 ->e3; + ->event2; + @event2 $write("fork..join_none process 1 again\n"); + #1 ->event3; end begin - @e2 $write("fork..join_none process 2\n"); - #1 ->e3; - @e3 $write("fork..join_none process 2 again\n"); - #1 ->e2; + @event2 $write("fork..join_none process 2\n"); + #1 ->event3; + @event3 $write("fork..join_none process 2 again\n"); + #1 ->event2; end begin - @e3 $write("fork..join_none process 3\n"); - #1 ->e3; - @e3 $write("fork..join_none process 3 again\n"); - ->e1; + @event3 $write("fork..join_none process 3\n"); + #1 ->event3; + @event3 $write("fork..join_none process 3 again\n"); + ->event1; end join_none $write("in main process\n"); - @e1; + @event1; $write("*-* All Finished *-*\n"); $finish; end diff --git a/test_regress/t/t_timing_protect.pl b/test_regress/t/t_timing_protect.pl new file mode 100755 index 000000000..96606c188 --- /dev/null +++ b/test_regress/t/t_timing_protect.pl @@ -0,0 +1,43 @@ +#!/usr/bin/env perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2022 by Antmicro Ltd. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +scenarios(vlt => 1); + +if (!$Self->have_coroutines) { + skip("No coroutine support"); +} +else { + top_filename("t/t_timing_fork_join.v"); # Contains all relevant constructs + + compile( + verilator_flags2 => ["--exe --main --timing --protect-ids"], + make_main => 0, + ); + + execute( + check_finished => 1, + ); + + if ($Self->{vlt_all}) { + # Check for secret in any outputs + my $any; + foreach my $filename (glob $Self->{obj_dir} . "/*.[ch]*") { + file_grep_not($filename, qr/event[123]/i); + file_grep_not($filename, qr/t_timing_fork_join/i); + $any = 1; + } + $any or $Self->error("No outputs found"); + +} + +} + +ok(1); +1;