Feature/formally parse riscv isa #2028
Open
+151
−57
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.
Detailed description
This is a cherry-pick of a couple commits from #1399 that stand on their own as general improvements.
This adds more compreensive parsing of the RISC-V ISA from the misa register when available, this is used to show a more complete ISA when a target is probed.
Example with a RP2350 which is the only RISC-V target I have on hand:
before:
after:
The RP2350's formal ISA according to the datasheet is
rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb
(orrv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb_zcmp
with the most recent interpretation), so the BMP's parsing is correct.It's important to note, this only interprets the ISA standard ratified extensions, reserved extension bits are ignored for now, and since Z/X/S extensions cannot easily be detected (There's no CSR for them) they are "ignored" too.
Technically the presence of the 'B' extension can be interpreted as the
Zba
,Zbb
, andZbs
extensions being available, but in the interest of a cleaner ISA string we ignore it too.The 'I' is not directly intepreted because it is a base ISA, and is implicit unless the 'E' base ISA is set which we do check for. The 'E' bit is always the complement of 'I' only one is ever set, and one must be set.
This implementation could be cleaned up and be made much more efficient, but it works as is and can be improved later, submitting as is in the interest of getting merged before the v2.0 release
Your checklist for this pull request
Closing issues