Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test termination: Delegate decision to testbench instead of using explicit $finish. #1125

Conversation

zchamski
Copy link
Contributor

@zchamski zchamski commented Mar 18, 2023

This PR replaces explicit use of $finish() in RVFI tracer with proper propagation of end-of-test information to the verification testbench:

  • Instread of executing a $finish() statement the RFVI tracer now outputs the end-of-test event and the test exit code on new output end_of_test_o.
  • The Verilator and VCS C++ testbenches were modified to detect the end-of-test event (write of 1'b1 into bit 0 of memory variable tohost) and to report the exit code of the test (bits [31:1] of the word written into tohost upon end-of-test). The Verilator testbench end-of-test messages were aligned on those of the VCS testbench.
  • The UVM handling of the end-of-test is implemented in the companion core-v-verif PR UVM test termination: Use end-of-test output of RVFI tracer iso. $finish. core-v-verif#1729.

Once the end-of-test condition is detected, the end_of_test_o output of RVFI tracer is set and held indefinitely.

FORNOW: Upon hitting the programmable timeout, the RVFI tracer raises an end-of-test condition with the test exit code value 31'h7fff_ffff, equivalent to writing 32'hffff_ffff into tohost. Once the timeout feature is moved outside of the RVFI tracer, this behavior may be removed.

* corev_apu/tb/rvfi_tracer.sv: Add output port 'end_of_test_o'.  Latch the
  value of the end-of-test signals once EOT is raised.  Keep only the lower
  32 bits of 'tohost' value for compatibility with JTAG and DTM termination
  setups.  Remove $finish calls upon detecting an end-of-test condition.
* Drive exit_o from RVFI tracer if RVFI tracer is enabled and JTAG ctrl is
  disabled.
* Break out of the main simulation loop if bit 0 of top.exit_o is set.
* Align log messages on the UVM ones.
@zchamski zchamski requested a review from zarubaf as a code owner March 18, 2023 13:33
@zchamski zchamski changed the title Test termination: Delegate decision to test harness instead of using explicit $finish. Test termination: Delegate decision to testbench instead of using explicit $finish. Mar 18, 2023
@JeanRochCoulon JeanRochCoulon merged commit 849419f into openhwgroup:master Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants