-
Notifications
You must be signed in to change notification settings - Fork 66
Fix/false load-use stall by gating rs1 amd rs2 hazard check #8
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
Open
jgw0915
wants to merge
1
commit into
sysprog21:main
Choose a base branch
from
jgw0915:Control-Hazard-Logic
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+19
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,13 +152,25 @@ class InstructionDecode extends Module { | |
| val clint_jump_address = Output(UInt(Parameters.AddrWidth)) // clint.io.jump_address | ||
| val if_jump_flag = Output(Bool()) // ctrl.io.jump_flag , inst_fetch.io.jump_flag_id | ||
| val if_jump_address = Output(UInt(Parameters.AddrWidth)) // inst_fetch.io.jump_address_id | ||
| val uses_rs1_id = Output(Bool()) // tells Control/Forwarding whether rs1 is valid for this instruction | ||
| val uses_rs2_id = Output(Bool()) // tells Control/Forwarding whether rs2 is valid for this instruction | ||
| }) | ||
| val opcode = io.instruction(6, 0) | ||
| val funct3 = io.instruction(14, 12) | ||
| val funct7 = io.instruction(31, 25) | ||
| val rd = io.instruction(11, 7) | ||
| val rs1 = io.instruction(19, 15) | ||
| val rs2 = io.instruction(24, 20) | ||
| val usesRs2 = (opcode === InstructionTypes.RM) || | ||
| (opcode === InstructionTypes.S) || | ||
| (opcode === InstructionTypes.B) | ||
|
|
||
| val usesRs1 = !(opcode === Instructions.jal) && | ||
| !(opcode === Instructions.lui) && | ||
| !(opcode === Instructions.auipc) | ||
|
Comment on lines
+168
to
+170
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing edge cases:
Suggested fix: val usesRs1 = !(opcode === Instructions.jal) &&
!(opcode === Instructions.lui) &&
!(opcode === Instructions.auipc) &&
!(opcode === Instructions.fence) &&
!(opcode === Instructions.csr &&
(funct3 === InstructionsTypeCSR.csrrwi ||
funct3 === InstructionsTypeCSR.csrrsi ||
funct3 === InstructionsTypeCSR.csrrci)) |
||
|
|
||
| io.uses_rs2_id := usesRs2 | ||
| io.uses_rs1_id := usesRs1 | ||
|
|
||
| io.regs_reg1_read_address := Mux(opcode === Instructions.lui, 0.U(Parameters.PhysicalRegisterAddrWidth), rs1) | ||
| io.regs_reg2_read_address := rs2 | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixed camelCase and snake_case:
Should be consistent - use snake_case per project conventions: