Skip to content

Optional modules #1576

@Timmmm

Description

@Timmmm

See the discussions on riscv/sail-riscv#910 - for the RISC-V model we want to be able to build the SV/Formal outputs with a subset of the model (e.g. without Smstateen). In order to make that work we can use scattered functions all over the place, but it feels a bit hacky. It would be nice if there was a built-in way to have optional modules. E.g. in the main reset() function you could write

  // "On reset, all writable mstateen bits are initialized by the hardware to zeros."
  if $module(stateen) then reset_stateen();

It would eliminate that code if the module is not being built. Similarly:

function clause currentlyEnabled(Ext_Zfinx) = hartSupports(Ext_Zfinx) & currentlyEnabled(Ext_Zicsr) &
   (not($module(stateen)) | is_zfinx_enabled_by_stateen())

Ideally with full type checking as if you did have all the modules enabled. That's probably super hard though.

Anyway something better than scattered functions would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions