Skip to content

Commit

Permalink
Merge pull request #69 from rsd-devel/flush-on-stld-fwmiss
Browse files Browse the repository at this point in the history
feat: flush on store load forwarding miss
  • Loading branch information
reo-pon committed Nov 14, 2023
2 parents c04ab9c + d094dba commit 3d13af1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Processor/Src/Pipeline/CommitStage.sv
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ function automatic void DecideCommit(
REFETCH_TYPE_NEXT_PC
);
end
else if (execState[i] == EXEC_STATE_REFETCH_THIS) begin
else if (execState[i] inside {
EXEC_STATE_REFETCH_THIS,
EXEC_STATE_STORE_LOAD_FORWARDING_MISS
}) begin
recovery[i] = TRUE;
recoveryPoint[i] = headOfThisInsn[i];
opRefetchType[i] = REFETCH_TYPE_THIS_PC;
Expand Down Expand Up @@ -192,6 +195,7 @@ function automatic void DecideCommit(
commit[i] =
( ((execState[i] inside {
EXEC_STATE_REFETCH_THIS,
EXEC_STATE_STORE_LOAD_FORWARDING_MISS,
EXEC_STATE_FAULT_LOAD_MISALIGNED,
EXEC_STATE_FAULT_LOAD_VIOLATION,
EXEC_STATE_FAULT_STORE_MISALIGNED,
Expand Down
6 changes: 4 additions & 2 deletions Processor/Src/Pipeline/MemoryBackEnd/MemoryTagAccessStage.sv
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ module MemoryTagAccessStage(
`ifdef RSD_ENABLE_REISSUE_ON_CACHE_MISS
if (isLoad[i]) begin
if (loadStoreUnit.storeLoadForwarded[i]) begin
ldRegValid[i] = loadStoreUnit.forwardMiss[i] ? FALSE : ldPipeReg[i].regValid;
ldRegValid[i] = ldPipeReg[i].regValid;
end
else if (ldRecordData[i].hasAllocatedMSHR) begin
// When the load has allocated an MSHR entry,
Expand Down Expand Up @@ -271,8 +271,10 @@ module MemoryTagAccessStage(
// そのロード命令からやり直す
if ( loadStoreUnit.storeLoadForwarded[i] ) begin
// フォワードされた場合
// A load instruction that caused a store-load forwarding miss is not replayed but flushed to prevent a deadlock due to replay.
// To wait for the commit of the dependent store instruction, The flush is performed in commit stage.
ldNextStage[i].execState =
loadStoreUnit.forwardMiss[i] ? EXEC_STATE_REFETCH_THIS : EXEC_STATE_SUCCESS;
loadStoreUnit.forwardMiss[i] ? EXEC_STATE_STORE_LOAD_FORWARDING_MISS : EXEC_STATE_SUCCESS;
end
else if (ldRecordData[i].hasAllocatedMSHR) begin
ldNextStage[i].execState =
Expand Down
1 change: 1 addition & 0 deletions Processor/Src/Scheduler/SchedulerTypes.sv
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ typedef enum logic [3:0] // ExecutionState
EXEC_STATE_FAULT_LOAD_VIOLATION = 4'b1001, // Load access violation
EXEC_STATE_FAULT_STORE_MISALIGNED = 4'b1010, // Misaligned store is executed
EXEC_STATE_FAULT_STORE_VIOLATION = 4'b1011, // Store access violation
EXEC_STATE_STORE_LOAD_FORWARDING_MISS = 4'b1111, // Store load forwarding miss

EXEC_STATE_FAULT_INSN_ILLEGAL = 4'b1100, // Illegal instruction
EXEC_STATE_FAULT_INSN_VIOLATION = 4'b1101, // Illegal instruction
Expand Down

0 comments on commit 3d13af1

Please sign in to comment.