From 4fb7a1e0a62825c0cef51732d66b80e406f4b3da Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Tue, 23 Mar 2021 20:20:23 -0500 Subject: [PATCH] Fixed the valid bit issue. Now the branch predictor is actually predicting instructions. --- wally-pipelined/src/ifu/BTBPredictor.sv | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wally-pipelined/src/ifu/BTBPredictor.sv b/wally-pipelined/src/ifu/BTBPredictor.sv index 9b459e61..104d8dc7 100644 --- a/wally-pipelined/src/ifu/BTBPredictor.sv +++ b/wally-pipelined/src/ifu/BTBPredictor.sv @@ -48,6 +48,8 @@ module BTBPredictor localparam TotalDepth = 2 ** Depth; logic [TotalDepth-1:0] ValidBits; logic [Depth-1:0] LookUpPCIndex, UpdatePCIndex, LookUpPCIndexQ, UpdatePCIndexQ; + logic UpdateENQ; + // hashing function for indexing the PC // We have Depth bits to index, but XLEN bits as the input. @@ -68,7 +70,7 @@ module BTBPredictor if (reset) begin ValidBits <= #1 {TotalDepth{1'b0}}; end else - if (UpdateEN) begin + if (UpdateENQ) begin ValidBits[UpdatePCIndexQ] <= #1 1'b1; end end @@ -86,6 +88,12 @@ module BTBPredictor .WEN1(UpdateEN)); -----/\----- EXCLUDED -----/\----- */ + flopenr #() UpdateENReg(.clk(clk), + .reset(reset), + .en(~StallF), + .d(UpdateEN), + .q(UpdateENQ)); + flopenr #(Depth) LookupPCIndexReg(.clk(clk), .reset(reset),