From 4031b89f183ce5650c50e00922263d037e3a6e01 Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Fri, 24 Feb 2023 18:36:41 -0600 Subject: [PATCH] Possible fix to btb performance issue. --- src/ifu/bpred/bpred.sv | 2 +- src/ifu/bpred/btb.sv | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/ifu/bpred/bpred.sv b/src/ifu/bpred/bpred.sv index 599b8853f..c802ffb21 100644 --- a/src/ifu/bpred/bpred.sv +++ b/src/ifu/bpred/bpred.sv @@ -285,7 +285,7 @@ module bpred ( // **** Fix me assign InstrClassM = {JalM, RetM, JumpM, BranchM}; flopenr #(`XLEN) PCWReg(clk, reset, ~StallW, PCM, PCW); - flopenrc #(`XLEN) IEUAdrWReg(clk, reset, FlushW, ~StallW, IEUAdrM, IEUAdrW); + flopenr #(`XLEN) IEUAdrWReg(clk, reset, ~StallW, IEUAdrM, IEUAdrW); endmodule diff --git a/src/ifu/bpred/btb.sv b/src/ifu/bpred/btb.sv index e70716144..d2f0cb77b 100644 --- a/src/ifu/bpred/btb.sv +++ b/src/ifu/bpred/btb.sv @@ -51,7 +51,7 @@ module btb #(parameter Depth = 10 ) ( logic [Depth-1:0] PCNextFIndex, PCFIndex, PCDIndex, PCEIndex, PCMIndex, PCWIndex; logic [`XLEN-1:0] ResetPC; - logic MatchF, MatchD, MatchE, MatchM, MatchW, MatchX; + logic MatchD, MatchE, MatchM, MatchW, MatchX; logic [`XLEN+3:0] ForwardBTBPrediction, ForwardBTBPredictionF; logic [`XLEN+3:0] TableBTBPredictionF; logic UpdateEn; @@ -73,7 +73,6 @@ module btb #(parameter Depth = 10 ) ( assign ResetPC = `RESET_VECTOR; assign PCNextFIndex = reset ? ResetPC[Depth+1:2] : {PCNextF[Depth+1] ^ PCNextF[1], PCNextF[Depth:2]}; - assign MatchF = PCNextFIndex == PCFIndex; assign MatchD = PCFIndex == PCDIndex; assign MatchE = PCFIndex == PCEIndex; assign MatchM = PCFIndex == PCMIndex; @@ -81,9 +80,9 @@ module btb #(parameter Depth = 10 ) ( assign MatchX = MatchD | MatchE | MatchM | MatchW; assign ForwardBTBPredictionF = MatchD ? {InstrClassD, BTAD} : - MatchE ? {InstrClassE, IEUAdrE} : - MatchM ? {InstrClassM, IEUAdrM} : - {InstrClassW, IEUAdrW} ; + MatchE ? {InstrClassE, IEUAdrE} : + MatchM ? {InstrClassM, IEUAdrM} : + {InstrClassW, IEUAdrW} ; assign {BTBPredInstrClassF, BTAF} = MatchX ? ForwardBTBPredictionF : {TableBTBPredictionF};