mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Fixed the valid bit issue. Now the branch predictor is actually predicting instructions.
This commit is contained in:
parent
49348d734b
commit
4fb7a1e0a6
@ -48,6 +48,8 @@ module BTBPredictor
|
|||||||
localparam TotalDepth = 2 ** Depth;
|
localparam TotalDepth = 2 ** Depth;
|
||||||
logic [TotalDepth-1:0] ValidBits;
|
logic [TotalDepth-1:0] ValidBits;
|
||||||
logic [Depth-1:0] LookUpPCIndex, UpdatePCIndex, LookUpPCIndexQ, UpdatePCIndexQ;
|
logic [Depth-1:0] LookUpPCIndex, UpdatePCIndex, LookUpPCIndexQ, UpdatePCIndexQ;
|
||||||
|
logic UpdateENQ;
|
||||||
|
|
||||||
|
|
||||||
// hashing function for indexing the PC
|
// hashing function for indexing the PC
|
||||||
// We have Depth bits to index, but XLEN bits as the input.
|
// We have Depth bits to index, but XLEN bits as the input.
|
||||||
@ -68,7 +70,7 @@ module BTBPredictor
|
|||||||
if (reset) begin
|
if (reset) begin
|
||||||
ValidBits <= #1 {TotalDepth{1'b0}};
|
ValidBits <= #1 {TotalDepth{1'b0}};
|
||||||
end else
|
end else
|
||||||
if (UpdateEN) begin
|
if (UpdateENQ) begin
|
||||||
ValidBits[UpdatePCIndexQ] <= #1 1'b1;
|
ValidBits[UpdatePCIndexQ] <= #1 1'b1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -86,6 +88,12 @@ module BTBPredictor
|
|||||||
.WEN1(UpdateEN));
|
.WEN1(UpdateEN));
|
||||||
-----/\----- EXCLUDED -----/\----- */
|
-----/\----- EXCLUDED -----/\----- */
|
||||||
|
|
||||||
|
flopenr #() UpdateENReg(.clk(clk),
|
||||||
|
.reset(reset),
|
||||||
|
.en(~StallF),
|
||||||
|
.d(UpdateEN),
|
||||||
|
.q(UpdateENQ));
|
||||||
|
|
||||||
|
|
||||||
flopenr #(Depth) LookupPCIndexReg(.clk(clk),
|
flopenr #(Depth) LookupPCIndexReg(.clk(clk),
|
||||||
.reset(reset),
|
.reset(reset),
|
||||||
|
Loading…
Reference in New Issue
Block a user