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

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

Open
zchamski opened this issue Sep 13, 2023 · 12 comments
Open

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

zchamski opened this issue Sep 13, 2023 · 12 comments
Assignees
Labels
Component:SpikeTandem Issue that impacts Spike Tandem operation Component:Verif For issues in the verification environment or test cases (e.g. for testbench, C code, etc.) CV32A60AX Part: Application configuration (former "step1") CV32A65X Part: Embedded configuration Type:Task Project related task

Comments

@zchamski
Copy link
Contributor

zchamski commented Sep 13, 2023

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

  • Identify all points in RISC-V specification where the behavior is allowed to be implementation-defined
  • Identify all points in the specification of the Embedded CVA6 configuration which determine the implementation-defined behaviors identified in previous step
  • Extend Spike control interface (command line and/or configuration scripts) with parameters necessary to represent the properties of the Embedded configuration and constrain Spike behavior according to the values of these parameters.

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

  • Initial implementation of Spike parameterization done by @MarioOpenHWGroup
  • Initial identification of implementation-definable behaviors done by @zchamski

Risks

  • Specification of the Embedded configuration incomplete / imprecise

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.

@zchamski zchamski converted this from a draft issue Sep 13, 2023
@JeanRochCoulon JeanRochCoulon added CV32A60AX Part: Application configuration (former "step1") Component:Verif For issues in the verification environment or test cases (e.g. for testbench, C code, etc.) CV32A65X Part: Embedded configuration labels Sep 13, 2023
@JeanRochCoulon JeanRochCoulon changed the title [TASK] Modify Spike to match embedded configuration [TASK] Modify Spike to match core-specific configuration Sep 19, 2023
@JeanRochCoulon JeanRochCoulon moved this from Todo to In Progress in CVA6 Project Task Board Oct 9, 2023
@JeanRochCoulon JeanRochCoulon added the Type:Task Project related task label Oct 18, 2023
@MarioOpenHWGroup
Copy link
Contributor

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

@zchamski
Copy link
Contributor Author

We have three sources of discrepancies:

  • differences in interpretation of implementation-dependent "may"/"can" cases in the RISC-V specs
  • bugs in CVA6
  • (unlikely but possible) bugs in Spike.

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
Copy link
Contributor

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

@JeanRochCoulon
Copy link
Contributor

JeanRochCoulon commented Oct 26, 2023

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

@MarioOpenHWGroup
Copy link
Contributor

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

@MarioOpenHWGroup
Copy link
Contributor

MarioOpenHWGroup commented Nov 16, 2023

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

@MarioOpenHWGroup
Copy link
Contributor

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
Copy link
Contributor

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

@MarioOpenHWGroup
Copy link
Contributor

No updates done in this task.

@zchamski
Copy link
Contributor Author

zchamski commented Dec 12, 2023

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:

  • A default value of 4 is set in the constructor of the processor_t class.
  • If a device tree seen by Spike contains an explicit PMP granularity entry for the given core, the associated value will be used (if valid).

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
Copy link
Contributor

Agree, I will add the parameter

@zchamski
Copy link
Contributor Author

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?

@JeanRochCoulon JeanRochCoulon added the Component:SpikeTandem Issue that impacts Spike Tandem operation label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:SpikeTandem Issue that impacts Spike Tandem operation Component:Verif For issues in the verification environment or test cases (e.g. for testbench, C code, etc.) CV32A60AX Part: Application configuration (former "step1") CV32A65X Part: Embedded configuration Type:Task Project related task
Projects
Status: In Progress
Development

No branches or pull requests

3 participants