Fixed bug in the two bit sat counter branch predictor. The SRAM needs to be read enabled by StallF.

This commit is contained in:
Ross Thompson 2021-05-24 23:24:54 -05:00
parent c5310e85c1
commit 16e037b8e9
2 changed files with 4 additions and 2 deletions

View File

@ -75,6 +75,7 @@ module bpred
if (`BPTYPE == "BPTWOBIT") begin:Predictor if (`BPTYPE == "BPTWOBIT") begin:Predictor
twoBitPredictor DirPredictor(.clk(clk), twoBitPredictor DirPredictor(.clk(clk),
.reset(reset), .reset(reset),
.StallF(StallF),
.LookUpPC(PCNextF), .LookUpPC(PCNextF),
.Prediction(BPPredF), .Prediction(BPPredF),
// update // update

View File

@ -32,6 +32,7 @@ module twoBitPredictor
) )
(input logic clk, (input logic clk,
input logic reset, input logic reset,
input logic StallF,
input logic [`XLEN-1:0] LookUpPC, input logic [`XLEN-1:0] LookUpPC,
output logic [1:0] Prediction, output logic [1:0] Prediction,
// update // update
@ -54,11 +55,11 @@ module twoBitPredictor
assign LookUpPCIndex = {LookUpPC[Depth+1] ^ LookUpPC[1], LookUpPC[Depth:2]}; assign LookUpPCIndex = {LookUpPC[Depth+1] ^ LookUpPC[1], LookUpPC[Depth:2]};
SRAM2P1R1W #(Depth, 2) memory(.clk(clk), SRAM2P1R1W #(Depth, 2) PHT(.clk(clk),
.reset(reset), .reset(reset),
.RA1(LookUpPCIndex), .RA1(LookUpPCIndex),
.RD1(PredictionMemory), .RD1(PredictionMemory),
.REN1(1'b1), .REN1(~StallF),
.WA1(UpdatePCIndex), .WA1(UpdatePCIndex),
.WD1(UpdatePrediction), .WD1(UpdatePrediction),
.WEN1(UpdateEN), .WEN1(UpdateEN),