Add exception handling and move common logic to Instruction base #49
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.
Adds exception generation/handling logic to the
Instruction
class, to theArchitecture
interface, and to various pipeline stages. Also moves ISA-shared logic to the baseInstruction
class.Summary of changes:
Instruction
class; the underlying values for each of these operations have been made protected member variables. This reduces the code size of the definitions for ISAs, and will reduce code duplication (resolves Move ISA-independent logic to the Instruction base class #26).exceptionEncountered
member function has been added toInstruction
, which returnstrue
if an exception was encountered while handling the instruction (a failed decode or failed execution).handleException
function has been added to theArchitecture
interface. Upon an exception being raised during normal operation, the core model can call this function, passing the exception-generating instruction. Currently this only allows the ISA to print useful information regarding the exception before the simulation is halted; in future versions, the ISA will be able to choose whether to halt, or to manipulate the execution state and resume.A64Architecture
will print a useful summary of the exception, including what the cause was, and a description of the instruction that generated it.Execute
stage (the first guaranteed non-speculative stage) while the out-of-order core raises exceptions from the reorder buffer, during commit.A64InstructionMetadata
is now capable of representing a failed encoding. Creating anA64Instruction
using such a metadata object will automatically set theexceptionEncountered
flag.MockInstruction
class has been extended to allow setting protected variables for tests.