mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Updated global history predictor.
This commit is contained in:
parent
0d271130b9
commit
df4a27a2e3
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
`include "wally-config.vh"
|
`include "wally-config.vh"
|
||||||
|
|
||||||
module speculativeglobalhistory #(parameter int k = 10 ) (
|
module speculativegshare #(parameter int k = 10 ) (
|
||||||
input logic clk,
|
input logic clk,
|
||||||
input logic reset,
|
input logic reset,
|
||||||
input logic StallF, StallD, StallE, StallM, StallW,
|
input logic StallF, StallD, StallE, StallM, StallW,
|
||||||
@ -58,8 +58,8 @@ module speculativeglobalhistory #(parameter int k = 10 ) (
|
|||||||
|
|
||||||
assign IndexNextF = GHRNextF;
|
assign IndexNextF = GHRNextF;
|
||||||
assign IndexF = GHRF ;
|
assign IndexF = GHRF ;
|
||||||
assign IndexD = GHRD;
|
assign IndexD = GHRD[k-1:0] ;
|
||||||
assign IndexE = GHRE;
|
assign IndexE = GHRE[k-1:0] ;
|
||||||
|
|
||||||
ram2p1r1wbe #(2**k, 2) PHT(.clk(clk),
|
ram2p1r1wbe #(2**k, 2) PHT(.clk(clk),
|
||||||
.ce1(~StallF | reset), .ce2(~StallM & ~FlushM),
|
.ce1(~StallF | reset), .ce2(~StallM & ~FlushM),
|
||||||
@ -100,9 +100,16 @@ module speculativeglobalhistory #(parameter int k = 10 ) (
|
|||||||
// If the front end is flushed or the direction prediction is wrong, reset to
|
// If the front end is flushed or the direction prediction is wrong, reset to
|
||||||
// most recent valid GHR. For a BP wrong this is GHRD with the correct prediction shifted in.
|
// most recent valid GHR. For a BP wrong this is GHRD with the correct prediction shifted in.
|
||||||
// For FlushE this is GHRE. GHRNextE is both.
|
// For FlushE this is GHRE. GHRNextE is both.
|
||||||
|
logic [k-1:0] GHRClassWrongAndPredF;
|
||||||
|
logic [k-1:0] GHRClassWrong;
|
||||||
|
mux2 #(k) GHRClassWrongAndPredFMux({DirPredictionF[1], DirPredictionD[1], GHRF[k-1:2]}, {DirPredictionF[1], GHRF[k-2:0]}, ~InstrClassD[0], GHRClassWrongAndPredF);
|
||||||
|
|
||||||
assign FlushDOrDirWrong = FlushD | DirPredictionWrongE;
|
assign FlushDOrDirWrong = FlushD | DirPredictionWrongE;
|
||||||
mux3 #(k) GHRFMux(GHRF, {DirPredictionF[1], GHRF[k-1:1]}, GHRNextE[k-1:0],
|
// mux3 #(k) GHRFMux(GHRF, {DirPredictionF[1], GHRF[k-1:1]}, GHRNextE[k-1:0],
|
||||||
{FlushDOrDirWrong, PredInstrClassF[0]}, GHRNextF);
|
// {FlushDOrDirWrong, PredInstrClassF[0]}, GHRNextF);
|
||||||
|
|
||||||
|
mux5 #(k) GHRFMux(GHRF, {DirPredictionF[1], GHRF[k-1:1]}, GHRClassWrong, GHRClassWrongAndPredF, GHRNextE[k-1:0],
|
||||||
|
{FlushDOrDirWrong, WrongPredInstrClassD[0], PredInstrClassF[0]}, GHRNextF);
|
||||||
|
|
||||||
// Need 1 extra bit to store the shifted out GHRF if repair needs to back shift.
|
// Need 1 extra bit to store the shifted out GHRF if repair needs to back shift.
|
||||||
flopenr #(k) GHRFReg(clk, reset, ~StallF | FlushDOrDirWrong, GHRNextF, GHRF);
|
flopenr #(k) GHRFReg(clk, reset, ~StallF | FlushDOrDirWrong, GHRNextF, GHRF);
|
||||||
@ -111,7 +118,6 @@ module speculativeglobalhistory #(parameter int k = 10 ) (
|
|||||||
// With instruction class prediction, the class could be wrong and is checked in Decode.
|
// With instruction class prediction, the class could be wrong and is checked in Decode.
|
||||||
// If it is wrong and branch does exist then shift right and insert the prediction.
|
// If it is wrong and branch does exist then shift right and insert the prediction.
|
||||||
// If the branch does not exist then shift left and use GHRLastF to restore the LSB.
|
// If the branch does not exist then shift left and use GHRLastF to restore the LSB.
|
||||||
logic [k-1:0] GHRClassWrong;
|
|
||||||
mux2 #(k) GHRClassWrongMux({DirPredictionD[1], GHRF[k-1:1]}, {GHRF[k-2:0], GHRLastF}, ~InstrClassD[0], GHRClassWrong);
|
mux2 #(k) GHRClassWrongMux({DirPredictionD[1], GHRF[k-1:1]}, {GHRF[k-2:0], GHRLastF}, ~InstrClassD[0], GHRClassWrong);
|
||||||
// As with GHRF FlushD and wrong direction prediction flushes the pipeline and restores to GHRNextE.
|
// As with GHRF FlushD and wrong direction prediction flushes the pipeline and restores to GHRNextE.
|
||||||
mux3 #(k) GHRDMux(GHRF, GHRClassWrong, GHRNextE, {FlushDOrDirWrong, WrongPredInstrClassD[0]}, GHRNextD);
|
mux3 #(k) GHRDMux(GHRF, GHRClassWrong, GHRNextE, {FlushDOrDirWrong, WrongPredInstrClassD[0]}, GHRNextD);
|
||||||
|
Loading…
Reference in New Issue
Block a user