[verilator] Add shutdown request mechanism to prevent early UART closes in CI#240
Open
[verilator] Add shutdown request mechanism to prevent early UART closes in CI#240
Conversation
2bd05fd to
7cc8d71
Compare
dd56637 to
0be0b3c
Compare
matutem
reviewed
Apr 13, 2026
| tiny-keccak = {version = "2.0.2", features = ["cshake"]} | ||
| tokio = { version = "1", features = ["full"] } | ||
| typetag = "0.2" | ||
| wait-timeout = "0.2.1" |
Contributor
There was a problem hiding this comment.
Is this a version requirement on a dependency? I don't see what "wait-timeout" indicates, was it a pre-existing module/package/thing? It seems is not created in this PR.
Contributor
Author
There was a problem hiding this comment.
It is, it's the most recent version of an external package from crates.io which I had to introduce to properly handle waiting on the Verilator subprocess to close with a timeout (so that I could send kill and print a warning should the subprocess not respond to the REQUEST_EXIT pin being asserted in a reasonable amount of time).
8f42c46 to
d580419
Compare
Prior to this commit, Verilator tests would sometimes fail due to the chip simulation testbench calling $finish before `opentitantool console` could drain the UART buffer, triggering a test failure even after success was visibly reported over UART. To fix this, a 'virtual' REQUEST_EXIT pin has been added to the GPIO DPI to trigger a graceful shutdown of the verilated testbench, with the host then waiting a fixed timeout for the child subprocess to exit before killing it as before. Signed-off-by: Kat Fox <kat@zerorisc.com>
d580419 to
0686249
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a new shutdown request mechanism for Verilator tests to prevent spurious test failures from early UART closures.
Note that this PR only implements this change for the EarlGrey top, as this is the only top Verilator tests support at the moment. Analogous changes can be made later to
chip_sim_tb.svfor other tops as they become supported.Prior to this PR, Verilator tests would sometimes fail due to the chip simulation testbench calling
$finishbeforeopentitantool consolecould drain the UART buffer, triggering a test failure even after success was visibly reported over UART. To fix this, a 'virtual'REQUEST_EXITpin has been added to the GPIO DPI to trigger a graceful shutdown of the verilated testbench, with the host then waiting a fixed timeout for the child subprocess to exit before killing it as before.This PR introduces a dependency on
wait-timeout, which is a Rust crate allowing one process to wait on a child process to terminate with a timeout. License forwait-timeoutis standard MIT/Apache 2.0.