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.22k stars 673 forks source link

[TASK] Modify Spike to match core-specific configuration #1403

Open zchamski opened 1 year ago

zchamski commented 1 year ago

Background

Spike implements a complete set of functionality corresponding to the RISC-V specifications. At times this set can be a superset of features of an implementation, in particular in the areas where the specification allows behaviors ("an implementation can" or "may" ...) without enforcing their presence.

In such situations Spike behavior needs to be constrained to match the exact set of features provided by the implementation so that behaviors not supported by the implementation will be duly rejected by Spike.

What (objective description)

Add extra controls to Spike in the areas where the RISC-V specification allows an implementation to choose a specific behjavior so that Spike behaves as described in the specification of the "Embedded" CVA6 configuration.

How To

Ideally this would be a set of class extensions for each CVA6 configuration. We can use the "step 1" and "embedded" cores as the examples.

Current Status

Risks

Prerequisites

None

KPI

TBD

Description of DONE

Spike simulations using parameter values for Embedded configuration yield identical results as RTL simulations of the Embedded configuration on all CI tests.

MarioOpenHWGroup commented 11 months ago

Further exploration is needed to catch all the discrepancies between spike and cva6

zchamski commented 11 months ago

We have three sources of discrepancies:

We need to capture formally the "may" and "can" cases in RISC-V specs. From there we need a systematic review of how these are implemented on both sides.

MarioOpenHWGroup commented 11 months ago

tval value is not matching between core and spike, this needs to be discussed or fixed in spike side

JeanRochCoulon commented 11 months ago

GitHub issue need to be open to speicify which value to assign to tval

MarioOpenHWGroup commented 10 months ago

Tval has been reverted to the original state and the instr field of the scoreboard_entry_t has been removed

MarioOpenHWGroup commented 10 months ago

Issues are appearing regarding specific cva6 config #1625 #1599 #1145

MarioOpenHWGroup commented 10 months ago

It is mandatory in this task that we know what we have the specification to rely when changing the Reference Model. Many issues above exist because unspecified parts or inconsistencies between the spec and the current environment implementation.

MarioOpenHWGroup commented 10 months ago

I am making some notes about the can/may parts of the spec to implement (some of them) in Spike.

MarioOpenHWGroup commented 9 months ago

No updates done in this task.

zchamski commented 9 months ago

The behavior of bit 0 in the PMPADDRn CSRs depends on the address matching mode in effect (encoded in the associated PMPCFG register) and the PMP granularity set for each core.

The corresponding logic appears to be present in Spike and the determination of the PMP granularity is affected by the Device Tree specification used by Spike:

By default, Spike reads the built-in device tree which specifies a hard-coded PMP granularity of 4 (a compile-time constant).

On CVA6 the PMP granularity is hardwired to 8, and therefore, any device tree-suppllied values will be silently ignored. The best solution seems thus to be a new Param entry that overrides the default PMP granularity set by Spike.

MarioOpenHWGroup commented 9 months ago

Agree, I will add the parameter

zchamski commented 5 months ago

Agree, I will add the parameter

@MarioOpenHWGroup, I can see Spike params /top/.../pmpregions (number of PMP regions), /top/.../pmpaddr0 (reset value of PMPADDR0), and /top/.../pmpcfg0 (reset value of PMPCFG0), but none that can directly set PMP granularity. Do you (plan to) have a specific parameter for this purpose?