forked from Github_Repos/cvw
Branch predictor cleanup.
I think Ch 10 is now done except for BTB performance analysis and the section on running benchmarks and collecting data.
This commit is contained in:
parent
08a1153ae9
commit
e8744684cd
@ -33,7 +33,7 @@ module RASPredictor #(parameter int StackSize = 16 )(
|
||||
input logic clk,
|
||||
input logic reset,
|
||||
input logic StallF, StallD, StallE, StallM, FlushD, FlushE, FlushM,
|
||||
input logic WrongBPReturnD, // Prediction class is wrong
|
||||
input logic BPReturnWrongD, // Prediction class is wrong
|
||||
input logic ReturnD,
|
||||
input logic ReturnE, CallE, // Instr class
|
||||
input logic BPReturnF,
|
||||
@ -61,7 +61,7 @@ module RASPredictor #(parameter int StackSize = 16 )(
|
||||
assign PopF = BPReturnF & ~StallD & ~FlushD;
|
||||
assign PushE = CallE & ~StallM & ~FlushM;
|
||||
|
||||
assign WrongPredReturnD = (WrongBPReturnD) & ~StallE & ~FlushE;
|
||||
assign WrongPredReturnD = (BPReturnWrongD) & ~StallE & ~FlushE;
|
||||
assign FlushedReturnDE = (~StallE & FlushE & ReturnD) | (~StallM & FlushM & ReturnE); // flushed return
|
||||
|
||||
assign RepairD = WrongPredReturnD | FlushedReturnDE ;
|
||||
|
@ -95,7 +95,7 @@ module bpred (
|
||||
logic ReturnE, CallE;
|
||||
logic BranchM, JumpM, ReturnM, CallM;
|
||||
logic BranchW, JumpW, ReturnW, CallW;
|
||||
logic WrongBPReturnD;
|
||||
logic BPReturnWrongD;
|
||||
logic [`XLEN-1:0] BTAE;
|
||||
|
||||
|
||||
@ -163,12 +163,12 @@ module bpred (
|
||||
icpred #(`INSTR_CLASS_PRED) icpred(.clk, .reset, .StallF, .StallD, .StallE, .StallM, .StallW, .FlushD, .FlushE, .FlushM, .FlushW,
|
||||
.PostSpillInstrRawF, .InstrD, .BranchD, .BranchE, .JumpD, .JumpE, .BranchM, .BranchW, .JumpM, .JumpW,
|
||||
.CallD, .CallE, .CallM, .CallW, .ReturnD, .ReturnE, .ReturnM, .ReturnW, .BTBCallF, .BTBReturnF, .BTBJumpF,
|
||||
.BTBBranchF, .BPCallF, .BPReturnF, .BPJumpF, .BPBranchF, .IClassWrongM, .IClassWrongE, .WrongBPReturnD);
|
||||
.BTBBranchF, .BPCallF, .BPReturnF, .BPJumpF, .BPBranchF, .IClassWrongM, .IClassWrongE, .BPReturnWrongD);
|
||||
|
||||
// Part 3 RAS
|
||||
RASPredictor RASPredictor(.clk, .reset, .StallF, .StallD, .StallE, .StallM, .FlushD, .FlushE, .FlushM,
|
||||
.BPReturnF, .ReturnD, .ReturnE, .CallE,
|
||||
.WrongBPReturnD, .RASPCF, .PCLinkE);
|
||||
.BPReturnWrongD, .RASPCF, .PCLinkE);
|
||||
|
||||
// Check the prediction
|
||||
// if it is a CFI then check if the next instruction address (PCD) matches the branch's target or fallthrough address.
|
||||
|
@ -42,7 +42,7 @@ module icpred #(parameter INSTR_CLASS_PRED = 1)(
|
||||
output logic ReturnD, ReturnE, ReturnM, ReturnW,
|
||||
input logic BTBCallF, BTBReturnF, BTBJumpF, BTBBranchF,
|
||||
output logic BPCallF, BPReturnF, BPJumpF, BPBranchF,
|
||||
output logic IClassWrongM, WrongBPReturnD, IClassWrongE
|
||||
output logic IClassWrongM, BPReturnWrongD, IClassWrongE
|
||||
);
|
||||
|
||||
logic IClassWrongD;
|
||||
@ -101,6 +101,6 @@ module icpred #(parameter INSTR_CLASS_PRED = 1)(
|
||||
|
||||
// branch class prediction wrong.
|
||||
assign IClassWrongD = |({BPCallD, BPReturnD, BPJumpD, BPBranchD} ^ {CallD, ReturnD, JumpD, BranchD});
|
||||
assign WrongBPReturnD = BPReturnD ^ ReturnD;
|
||||
assign BPReturnWrongD = BPReturnD ^ ReturnD;
|
||||
|
||||
endmodule
|
||||
|
Loading…
Reference in New Issue
Block a user