Mirror ISA extension organization for CSRs - #422
Open
Luca Colagrande (colluca) wants to merge 5 commits into
Open
Mirror ISA extension organization for CSRs#422Luca Colagrande (colluca) wants to merge 5 commits into
Luca Colagrande (colluca) wants to merge 5 commits into
Conversation
Luca Colagrande (colluca)
marked this pull request as draft
June 22, 2026 12:55
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #422 +/- ##
==========================================
- Coverage 97.08% 96.81% -0.27%
==========================================
Files 14 14
Lines 926 942 +16
==========================================
+ Hits 899 912 +13
- Misses 27 30 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Luca Colagrande (colluca)
force-pushed
the
csr-org
branch
from
June 22, 2026 13:10
0ed764f to
41cf7e5
Compare
Luca Colagrande (colluca)
marked this pull request as ready for review
June 22, 2026 13:14
Member
|
Seems reasonable at first blush, but I'm hoping someone else has some time to do a code review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To support managing custom (and possibly conflicting) sets of CSRs, we propose to reorganize the CSR definitions, mirroring the organization of the ISA extensions.
Ratified CSR sets would live in the
csrs/folder, while custom CSR sets go incsrs/unratified.The list of desired CSR sets can be passed to the CLI, similar to how the CLI accepts a list of ISA extensions.
To this end, a new
--csrflag is provided.Usage
To add a custom CSR set, place a file under
csrs/unratified/:Then pass
--csr rv_myvendorto include only that set, or omit--csrto include all CSR sets, including ratified sets.Changes
read_linesis moved toresources.pyso it can be reused also inconstants.py, and in general by any file that needs to read some resourceread_int_map_csvis updated to useread_linesinstead of opening the CSV resource directly, enabling #-prefixed comment lines and blank lines in all CSV files, as supported in ISA extension filescsrsandcsrs32globals are removed entirely. Generators no longer import CSR data fromconstantsbut instead take a CSR dictionary as argument, which is populated with the CSR sets selected on the CLI (similar to how instructions are handled)csrs.csvandcsrs32.csvhave been moved to the newcsrs/subdirectory--csrCLI argument (repeatable) is added to specify which CSR sets to load. Omitting--csrincludes all sets.generate_extensionsgains acsrsparameter; it callscreate_csr_dictonce and passes the resultingcsr_dictto every generator.csr_dict: CsrDictparameter. Most generators are agnostic to which sets are present. The exception are Chisel'sallandall32arrays, which retain their semantics by readingcsr_dict.get("csrs", [])andcsr_dict.get("csrs32", [])respectively.