cva6 icon indicating copy to clipboard operation
cva6 copied to clipboard

[TASK] Compare Spike and RTL in tandem

Open zchamski opened this issue 1 year ago • 9 comments

Background

Lockstep ("tandem") co-simulation allows early detection of divergences between behaviors of different simulation models on the same test case. Typically, an Instruction Set Simulator (ISS) and an RTL simulator are fed with the same binary program. The simulation can be stopped as soon as a divergence is detected, or can be pursued for a controlled amount of steps (instruction commits + exceptions) to observe the consequences of the divergence.

For CVA6, the current ISS simulator is Spike and the primary RTL simulator is VCS, set up in either "test harness" or full UVM mode.

What (objective description)

Build a software system in which Spike and VCS simulations are executed concurrently and the observable state of both models is compared at every instruction commit and at every exception triggered.

How To

  • extend CVA6 RVFI implemented in SystemVerilog with the information on CSR state (or state changes), cf. #1402.
  • extend/adapt Spike RVFI information to match CVA6-side CSR information, cf. #1384.
  • connect the Spike simulator as a slave of the RTL simulation model
  • feed instruction commits and exceptions raised on the RTL side to the Spike model
  • compare state changes reported by Spike with those reported by the RTL.

Current Status

In progress. Working prototype available for vcs-testharness and vcs-uvm, but it only compares PC values, instruction content, and GPR and memory writes.

Risks

TBD

Prerequisites

Dependency on completion of #1402 and #1384. For the Embedded configuration additional dependency on #1403.

KPI

TBD

Description of DONE

Identical set of PASS and FAIL results on CI tests between full trace comparison and lockstep simulation.

zchamski avatar Sep 13 '23 14:09 zchamski

A working version of the Tandem has been pushed to my repo that implements the following:

  • Tandem comparing exceptions, interrupts, destination GPR, instruction and pc.
  • Common package that implements the functionality for the testharness and UVM implementation

MarioOpenHWGroup avatar Oct 10 '23 08:10 MarioOpenHWGroup

Tandem rebased to last cva6/master commit. It is working on Centos 7 and Debian 10.

Some discussion needed regarding integration corev_apu/tb/common/Sim*.cc into riscv-isa-sim

MarioOpenHWGroup avatar Oct 19 '23 11:10 MarioOpenHWGroup

Fixing Github CI in order to merge. Also fixing the issues commented in both PRs.

MarioOpenHWGroup avatar Oct 26 '23 11:10 MarioOpenHWGroup

CI has been fixed and it shows green on Thales CI and on Github

MarioOpenHWGroup avatar Nov 09 '23 11:11 MarioOpenHWGroup

PR has been merged already

MarioOpenHWGroup avatar Nov 16 '23 13:11 MarioOpenHWGroup

On going efforts to make the tandem available on verilator

MarioOpenHWGroup avatar Nov 23 '23 12:11 MarioOpenHWGroup

I am working on make verilator work on 64bits but it has issues in the DPI interface

MarioOpenHWGroup avatar Dec 07 '23 12:12 MarioOpenHWGroup

This task is mostly finished, CSRs need to be integrated too.

MarioOpenHWGroup avatar Dec 14 '23 12:12 MarioOpenHWGroup

Needs to be discussed correctly if we want to compare all the csrs or just the modified ones.

MarioOpenHWGroup avatar Jan 04 '24 12:01 MarioOpenHWGroup