refactor: make extensions accept processor as an argument#1949
Merged
aswaterman merged 1 commit intoriscv-software-src:masterfrom Apr 8, 2025
Merged
refactor: make extensions accept processor as an argument#1949aswaterman merged 1 commit intoriscv-software-src:masterfrom
aswaterman merged 1 commit intoriscv-software-src:masterfrom
Conversation
Collaborator
Author
|
@jerryz123 Can you take a look please |
jerryz123
requested changes
Apr 7, 2025
ci-tests/custom-csr.cc
Outdated
| xdummycsr_t() {} | ||
|
|
||
| std::vector<insn_desc_t> get_instructions() override { | ||
| std::vector<insn_desc_t> get_instructions(processor_t &) override { |
Collaborator
There was a problem hiding this comment.
Should/can these be const?
riscv/extension.h
Outdated
| virtual ~extension_t(); | ||
| virtual std::vector<insn_desc_t> get_instructions(processor_t &proc) = 0; | ||
| virtual std::vector<disasm_insn_t *> | ||
| get_disasms(processor_t *proc = nullptr) = 0; |
Collaborator
There was a problem hiding this comment.
Can you split the formatting into a different commit? Or omit it altogether from this PR (This didn't seem to do the right thing here I think)
f63dcdd to
5c8d087
Compare
jerryz123
approved these changes
Apr 8, 2025
aswaterman
approved these changes
Apr 8, 2025
This was referenced Aug 29, 2025
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.
As discussed in #1863 we consider a good idea to refactor custom extensions and make their handling of processor more explicit. In this commit I make all extensions's methods accept processor as an argument.
This change also makes it possible to configure instructions and disasms depending on isa info (e.g. now it is possible to add certain instructions only if we are running RV32). Previously it was not possible due to
extension_t::pbeing set only after requesting the instructions from extension.