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

Refactor chip reset #597

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Refactor chip reset #597

wants to merge 1 commit into from

Conversation

Timmmm
Copy link
Collaborator

@Timmmm Timmmm commented Oct 15, 2024

This simplifies, clarifies and fixes the reset functionality.

Until now the model conflates reset and initialisation, and does way more than it should on reset. The RISC-V spec only requires a very small number of things to be reset.

This change:

  1. Renames the init functions to reset, to clarify that they correspond to resetting the chip.
  2. Removes the ext_init and ext_rvfi_init functions. The latter is not used and the former is only used by the old CHERI code.
  3. Removes the reset of the X and F registers. These are non-reset.
  4. Removes the reset of various CSRs that are non-reset (mip, mie, mideleg, mtvec, mepc, etc).
  5. Adds reset of mstatus[MIE] and mstatus[MPRV]. As far as I can see they were missing.
  6. Add one-time init of mhartid etc to 0.

I didn't remove the vector register resets yet. That needs a bigger refactor.

Also note that currently there is no way to actually do a chip reset mid-simulation, but that will be needed eventually.

This simplifies, clarifies and fixes the reset functionality.

Until now the model conflates reset and initialisation, and does way more than it should on reset. The RISC-V spec only requires a very small number of things to be reset.

This change:

1. Renames the `init` functions to `reset`, to clarify that they correspond to resetting the chip.
2. Removes the `ext_init` and `ext_rvfi_init` functions. The latter is not used and the former is only used by the old CHERI code.
2. Removes the reset of the X and F registers. These are non-reset.
3. Removes the reset of various CSRs that are non-reset (`mip`, `mie`, `mideleg`, `mtvec`, `mepc`, etc).
4. Adds reset of `mstatus[MIE]` and `mstatus[MPRV]`. As far as I can see they were missing.
5. Add one-time init of `mhartid` etc to 0.

I didn't remove the vector register resets yet. That needs a bigger refactor.

Also note that currently there is no way to actually do a chip reset mid-simulation, but that will be needed eventually.
Copy link

Test Results

396 tests  ±0   173 ✅  - 223   0s ⏱️ ±0s
  4 suites ±0     0 💤 ±  0 
  1 files   ±0   223 ❌ +223 

For more details on these failures, see this check.

Results for commit f2bf830. ± Comparison against base commit 2b65a0d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant