openhwgroup / cva6

The CORE-V CVA6 is an Application class 6-stage RISC-V CPU capable of booting Linux
https://docs.openhwgroup.org/projects/cva6-user-manual/
Other
2.23k stars 675 forks source link

[TASK] Compare Spike and RTL in tandem #1404

Closed zchamski closed 1 week ago

zchamski commented 1 year ago

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

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.

MarioOpenHWGroup commented 11 months ago

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

MarioOpenHWGroup commented 11 months ago

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 commented 11 months ago

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

MarioOpenHWGroup commented 10 months ago

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

MarioOpenHWGroup commented 10 months ago

PR has been merged already

MarioOpenHWGroup commented 10 months ago

On going efforts to make the tandem available on verilator

MarioOpenHWGroup commented 9 months ago

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

MarioOpenHWGroup commented 9 months ago

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

MarioOpenHWGroup commented 9 months ago

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

zchamski commented 1 week ago

Task completed for CV32A65X. Adding other configurations is a matter of providing the necessary configuration files for Spike, and possibly, of adding futher configurability if needed.