Repository navigation
fix unclock functionality (io / cp0) and tests for MIPS components - #117
Merged
Merged
Conversation
salon64
approved these changes
Sep 28, 2026
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.
This pull request introduces improvements and corrections to the interrupt handling and simulation replay mechanisms in the MIPS CPU and IO components. The main focus is on making the simulation of interrupts and their rollback (unclock) behavior more robust and testable, especially for the IO device. The changes include bug fixes, new and improved tests, and a refactor of the IO state management to ensure correct undo/redo of simulation steps.
Key changes include:
Interrupt and Simulation Replay Robustness:
MipsIODatato track all state changes relevant to simulation replay, replacing ad-hoc tracking with a dedicatedIOStatestruct and ahistorystack for robust unclock (rollback) support. This ensures IO state can be precisely restored when stepping backwards in the simulation. [1] [2] [3]un_clockmethod in bothCP0andMipsIOto correctly restore previous state based on simulation cycle, fixing off-by-one errors and ensuring that only actual state changes are reverted. [1] [2]MipsIOfor invalid addresses and data, replacingtodo!placeholders with proper error and warning conditions.Testing Improvements:
interrupt_test.rsfile for integration-style interrupt tests. [1] [2]Bug Fixes and Cleanups:
read_eq_end_cause,BitVec) and constants fromMipsIOData, simplifying the codebase. [1] [2]These changes collectively make the simulation of interrupts and their rollback more reliable and maintainable, and add thorough tests to prevent regressions.
References: