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

Make CSR definitions scattered #543

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Conversation

Timmmm
Copy link
Collaborator

@Timmmm Timmmm commented Sep 9, 2024

Resolve the strange split between read_CSR (which is not scattered) and ext_read_CSR (which is). Same for write_CSR and is_CSR_defined.

I changed the return type of read_CSR from option(xlenbits) to xlenbits since the code must already check is_CSR_defined before calling read_CSR. The only function that returned None() was the seed CSR in write_seed_csr, which actually meant you would get a weird "Unhandled write to CSR" if you wrote to seed.

I renamed & reordered the files slightly to make the scattered mapping work, but I haven't moved any of the actual definitions yet. In future we should actually scatter them.

Fixes #410

Copy link

github-actions bot commented Sep 9, 2024

Test Results

396 tests  ±0   396 ✅ ±0   0s ⏱️ ±0s
  4 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 73f7467. ± Comparison against base commit 07a5036.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@arichardson arichardson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not reviewed this in detail - but the result is much cleaner IMO. Having two methods for the same thing is weird, and I believe extensions can just override the existing definitions by placing their clause first.

Copy link
Collaborator

@arichardson arichardson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at the whole diff now. LGTM. Removing all the Some( is quite nice as well.

model/riscv_insts_zicsr.sail Show resolved Hide resolved
@billmcspadden-riscv
Copy link
Collaborator

billmcspadden-riscv commented Sep 13, 2024 via email

@Timmmm
Copy link
Collaborator Author

Timmmm commented Sep 23, 2024

I'll merge this in a few days if nobody objects. I think it's uncontroversial.

Copy link
Collaborator

@Alasdair Alasdair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this is rebased I think it can be merged

Resolve the strange split between `read_CSR` (which is not `scattered`) and `ext_read_CSR` (which is). Same for `write_CSR` and `is_CSR_defined`.

I changed the return type of `read_CSR` from `option(xlenbits)` to `xlenbits` since the code must already check `is_CSR_defined` before calling `read_CSR`. The only function that returned `None()` was the `seed` CSR in `write_seed_csr`, which actually meant you would get a weird "Unhandled write to CSR" if you wrote to `seed`.

I renamed & reordered the files slightly to make the scattered mapping work, but I haven't moved any of the actual definitions yet. In future we should actually scatter them.

Fixes riscv#410
@Timmmm Timmmm merged commit b63b12f into riscv:master Sep 25, 2024
2 checks passed
@Timmmm Timmmm deleted the user/timh/scattered_csrs branch September 30, 2024 19:04
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.

CSRs should use scattered functions
4 participants