Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exception handling and move common logic to Instruction base #49

Merged
merged 10 commits into from
Apr 15, 2019

Conversation

hal-jones
Copy link
Contributor

Adds exception generation/handling logic to the Instruction class, to the Architecture interface, and to various pipeline stages. Also moves ISA-shared logic to the base Instruction class.

Summary of changes:

  • Common instruction-related operations have been made non-virtual and are defined in the base 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).
  • An exceptionEncountered member function has been added to Instruction, which returns true if an exception was encountered while handling the instruction (a failed decode or failed execution).
  • A new handleException function has been added to the Architecture 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.
  • Various pipeline stages now accept a function handle that they may call to raise exceptions to the core for handling at the end of the cycle. For the in-order core, this happens during the 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 an A64Instruction using such a metadata object will automatically set the exceptionEncountered flag.
  • Tests have been updated to reflect certain functions no longer being virtual, and the MockInstruction class has been extended to allow setting protected variables for tests.
  • Tests were added to check exception generation behaviour in the in-order pipeline.

src/A64Architecture.cc Outdated Show resolved Hide resolved
src/Architecture.hh Outdated Show resolved Hide resolved
src/inorder/ExecuteUnit.cc Show resolved Hide resolved
src/outoforder/Core.cc Show resolved Hide resolved
@hal-jones hal-jones merged commit 0b814c1 into master Apr 15, 2019
@jrprice jrprice deleted the instruction-base branch July 6, 2019 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tests Testing and CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move ISA-independent logic to the Instruction base class
3 participants