feat(idl): add execute_instruction builtin for dynamic instruction di…#1820
Open
ayosher wants to merge 3 commits intoriscv:mainfrom
Open
feat(idl): add execute_instruction builtin for dynamic instruction di…#1820ayosher wants to merge 3 commits intoriscv:mainfrom
ayosher wants to merge 3 commits intoriscv:mainfrom
Conversation
…spatch Add a new IDL builtin function execute_instruction(Bits<32> encoding) that allows an instruction's operation() body to dynamically fetch and execute a sub-instruction by encoding value. Motivation: instructions like qc.cm.ilut fetch instruction encodings from a memory table and execute them. Previously this had to be expressed as unpredictable(), which crashes the simulator. This builtin provides a proper implementation path. Semantics: - Decodes and executes the given 32-bit encoding in the current hart context - PC is NOT advanced (the calling instruction manages PC) - Exceptions from the sub-instruction propagate normally to the caller Changes: - spec/std/isa/isa/builtin_functions.idl: declare execute_instruction builtin - backends/cpp_hart_gen/templates/hart.hxx.erb: implement execute_instruction() method on the generated hart class using a dedicated instruction storage buffer (m_execute_instruction_storage) to avoid aliasing the outer instruction's storage during nested execution
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1820 +/- ##
=======================================
Coverage 72.18% 72.18%
=======================================
Files 52 52
Lines 27744 27744
Branches 6002 6002
=======================================
Hits 20028 20028
Misses 7716 7716
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
…spatch
Add a new IDL builtin function execute_instruction(Bits<32> encoding) that allows an instruction's operation() body to dynamically fetch and execute a sub-instruction by encoding value.
Motivation: instructions like qc.cm.ilut fetch instruction encodings from a memory table and execute them. Previously this had to be expressed as unpredictable(), which crashes the simulator. This builtin provides a proper implementation path.
Semantics:
Changes: