-
Notifications
You must be signed in to change notification settings - Fork 22
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
In-order Early Halting Fix #294
Merged
Merged
Conversation
This file contains 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
dANW34V3R
requested review from
jj16791,
FinnWilkinson and
rahahahat
and removed request for
jj16791
February 28, 2023 16:07
FinnWilkinson
requested changes
Mar 22, 2023
jj16791
requested changes
Mar 23, 2023
jj16791
requested changes
May 19, 2023
FinnWilkinson
approved these changes
May 19, 2023
rahahahat
approved these changes
May 19, 2023
jj16791
approved these changes
May 19, 2023
jj16791
pushed a commit
that referenced
this pull request
May 19, 2023
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 adds:
This pull request fixes:
With the specific sequence of instructions: branch, multi-cycle instruction, branch, the in-order core would sometimes incorrectly halt.
This would only happen in the case that each branch instruction set knownTarget_ to a value outside the valid range defined by the program size. This is due to incorrectly setting the variable as the instruction's own address had not been initialised and so was some garbage value different on each run.
This caused a halt because the first mispredicted branch causes a bubble when the fetch unit halts not knowing what to fetch next. Once executed, a multicycle instruction is fetched and flows normally through the pipeline. This is immediately followed by another branch which mispredicts in the same way. This puts the pipeline in the state: write-back unit and completion slots empty due to bubble caused by first branch, execute unit stalled while multicycle instruction executes, front end buffers stalled waiting on the execute unit and fetch unit halted due to second branch mispredict.
The condition for the in-order core to halt was: the fetch unit has halted and the heads of the buffers are empty - in the above state this appears to be the case as, when stalled, the buffers do not swap the head and tail. Therefore, even after being decoded, the second branch is stuck in the tail of the decode to execute buffer and so it appears empty. The completion slots are empty due to the bubble from the first branch and the fetch to decode buffer is empty due to the bubble created by the second branch. The fetch unit has halted as the second branch has predicted outside the valid range. As all conditions are true, the in-order pipeline halts and the simulation ends.
A test has been created to force this state and fails sometimes before the fix is implemented.
To fix this, the halting condition is updated so that the head or tail of the buffer is checked depending on whether it is stalled or not and the execute unit is checked to see if there is an instruction currently executing. The test now always passes.