From 1af7b8051e875533c93268bf07551f0ba19fbcc1 Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Wed, 22 Feb 2023 12:54:46 -0600 Subject: [PATCH] Fixed bug in basic gshare. --- src/ifu/bpred/gsharebasic.sv | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ifu/bpred/gsharebasic.sv b/src/ifu/bpred/gsharebasic.sv index ccad0e3c..cb0bbe9e 100644 --- a/src/ifu/bpred/gsharebasic.sv +++ b/src/ifu/bpred/gsharebasic.sv @@ -42,7 +42,7 @@ module gsharebasic #(parameter k = 10, input logic BranchInstrE, BranchInstrM, PCSrcE ); - logic [k-1:0] IndexNextF, IndexE; + logic [k-1:0] IndexNextF, IndexM; logic [1:0] DirPredictionD, DirPredictionE; logic [1:0] NewDirPredictionE, NewDirPredictionM; @@ -52,19 +52,19 @@ module gsharebasic #(parameter k = 10, if(TYPE == 1) begin assign IndexNextF = GHR ^ {PCNextF[k+1] ^ PCNextF[1], PCNextF[k:2]}; - assign IndexE = GHRM ^ {PCM[k+1] ^ PCM[1], PCM[k:2]}; + assign IndexM = GHRM ^ {PCM[k+1] ^ PCM[1], PCM[k:2]}; end else if(TYPE == 0) begin assign IndexNextF = GHRNext; - assign IndexE = GHRE; + assign IndexM = GHRM; end ram2p1r1wbe #(2**k, 2) PHT(.clk(clk), - .ce1(~StallF), .ce2(~StallM & ~FlushM), + .ce1(~StallF), .ce2(~StallW & ~FlushW), .ra1(IndexNextF), .rd1(DirPredictionF), - .wa2(IndexE), + .wa2(IndexM), .wd2(NewDirPredictionM), - .we2(BranchInstrM & ~StallW & ~FlushW), + .we2(BranchInstrM), .bwe2(1'b1)); flopenrc #(2) PredictionRegD(clk, reset, FlushD, ~StallD, DirPredictionF, DirPredictionD);