From f93eaeef8eb130d5524d462f0e9ff5592b2be29c Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Sun, 29 Jan 2023 00:33:40 -0600 Subject: [PATCH] Fixed another bug with the speculative gshare with instruction class prediction. --- pipelined/regression/wave.do | 6 ++++-- pipelined/src/ifu/brpred/speculativegshare.sv | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pipelined/regression/wave.do b/pipelined/regression/wave.do index cdae10c6b..a17bc502e 100644 --- a/pipelined/regression/wave.do +++ b/pipelined/regression/wave.do @@ -584,6 +584,8 @@ add wave -noupdate /testbench/dut/core/ifu/bpred/bpred/FallThroughWrongE add wave -noupdate /testbench/dut/core/ifu/bpred/bpred/PredInstrClassD add wave -noupdate /testbench/dut/core/ifu/bpred/bpred/InstrClassD add wave -noupdate -color Firebrick /testbench/dut/core/ifu/bpred/bpred/WrongPredInstrClassD +add wave -noupdate /testbench/dut/core/ifu/bpred/bpred/BPPredWrongE +add wave -noupdate /testbench/dut/core/ifu/bpred/bpred/BPPredWrongM add wave -noupdate -expand -group {branch direction} /testbench/dut/core/ifu/bpred/bpred/Predictor/DirPredictor/IndexNextF add wave -noupdate -expand -group {branch direction} -expand -group {branch outcome} /testbench/dut/core/ifu/bpred/bpred/Predictor/DirPredictor/PCSrcE add wave -noupdate -expand -group {branch direction} -expand -group {branch outcome} /testbench/dut/core/ifu/bpred/bpred/Predictor/DirPredictor/DirPredictionE @@ -625,7 +627,7 @@ add wave -noupdate /testbench/dut/core/ifu/bpred/bpred/Predictor/DirPredictor/Fl add wave -noupdate /testbench/dut/core/ifu/bpred/bpred/Predictor/DirPredictor/OldGHRF add wave -noupdate /testbench/dut/core/priv/priv/csr/counters/counters/HPMCOUNTER_REGW TreeUpdate [SetDefaultTree] -WaveRestoreCursors {{Cursor 2} {314596 ns} 1} {{Cursor 3} {314460 ns} 1} {{Cursor 4} {219681 ns} 1} {{Cursor 4} {5919 ns} 1} {{Cursor 5} {217131 ns} 0} +WaveRestoreCursors {{Cursor 2} {314596 ns} 1} {{Cursor 3} {314460 ns} 1} {{Cursor 4} {219681 ns} 1} {{Cursor 4} {5919 ns} 1} {{Cursor 5} {296884 ns} 0} quietly wave cursor active 5 configure wave -namecolwidth 250 configure wave -valuecolwidth 194 @@ -641,4 +643,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ns update -WaveRestoreZoom {135840 ns} {362253 ns} +WaveRestoreZoom {18545889 ns} {18546113 ns} diff --git a/pipelined/src/ifu/brpred/speculativegshare.sv b/pipelined/src/ifu/brpred/speculativegshare.sv index 7760cbef9..6cfb56894 100644 --- a/pipelined/src/ifu/brpred/speculativegshare.sv +++ b/pipelined/src/ifu/brpred/speculativegshare.sv @@ -112,7 +112,7 @@ module speculativegshare // GHRF; always_comb begin - if(FlushD) begin + if(FlushD | DirPredictionWrongE) begin GHRNextF = GHRNextD[k-1:0]; end else if(BranchInstrF) GHRNextF = {DirPredictionF[1], GHRF[k-1:1]}; else GHRNextF = GHRF; @@ -124,7 +124,7 @@ module speculativegshare // use with out instruction class prediction //assign GHRNextD = FlushD ? GHRNextE[k-1:0] : GHRF[k-1:0]; // with instruction class prediction - assign GHRNextD = FlushD ? GHRNextE[k-1:0] : + assign GHRNextD = (FlushD | DirPredictionWrongE) ? GHRNextE[k-1:0] : WrongPredInstrClassD[0] & BranchInstrD ? {DirPredictionD[1], GHRF[k-1:1]} : // shift right WrongPredInstrClassD[0] & ~BranchInstrD ? {OldGHRF[k-2:0], GHRExtraF}: // shift left GHRF[k-1:0];