Skip to content

Commit

Permalink
util: support --bp-type=DecoupledBPUWithBTB in xiangshan.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jensen-yan committed Feb 28, 2025
1 parent 1d1c79d commit 7ee27fe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
16 changes: 13 additions & 3 deletions configs/example/xiangshan.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,25 @@ def build_test_system(np, args):
args.enable_loop_buffer = True

for i in range(np):
if args.bp_type is None or args.bp_type == 'DecoupledBPUWithFTB':
if args.bp_type is None or args.bp_type == 'DecoupledBPUWithFTB' or args.bp_type == 'DecoupledBPUWithBTB':
enable_bp_db = len(args.enable_bp_db) > 1
if enable_bp_db:
bp_db_switches = args.enable_bp_db[1] + ['basic']
print("BP db switches:", bp_db_switches)
else:
bp_db_switches = []

test_sys.cpu[i].branchPred = DecoupledBPUWithFTB(
# for DecoupledBPUWithBTB, loop predictor and jump ahead predictor are not supported
if args.bp_type == 'DecoupledBPUWithBTB':
if args.enable_loop_predictor or args.enable_loop_buffer:
print("loop predictor and loop buffer not supported for DecoupledBPUWithBTB")
args.enable_loop_predictor = False
args.enable_loop_buffer = False
if args.enable_jump_ahead_predictor:
print("jump ahead predictor not supported for DecoupledBPUWithBTB")
args.enable_jump_ahead_predictor = False

BPClass = ObjectList.bp_list.get(args.bp_type)
test_sys.cpu[i].branchPred = BPClass(
bpDBSwitches=bp_db_switches,
enableLoopBuffer=args.enable_loop_buffer,
enableLoopPredictor=args.enable_loop_predictor,
Expand Down
1 change: 1 addition & 0 deletions src/cpu/pred/BranchPredictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ class BTBTAGE(TimedBaseBTBPredictor):
cxx_class = 'gem5::branch_prediction::btb_pred::BTBTAGE'
cxx_header = "cpu/pred/btb/btb_tage.hh"

enableSC = Param.Bool(False, "Enable SC or not") # TODO: BTBTAGE doesn't support SC
numPredictors = Param.Unsigned(4, "Number of TAGE predictors")
tableSizes = VectorParam.Unsigned([4096]*4, "the ITTAGE T0~Tn length")
TTagBitSizes = VectorParam.Unsigned([8]*4, "the T0~Tn entry's tag bit size")
Expand Down
1 change: 1 addition & 0 deletions src/cpu/pred/btb/btb_tage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ tablePcShifts(p.TTagPcShifts),
histLengths(p.histLengths),
maxHistLen(p.maxHistLen),
numTablesToAlloc(p.numTablesToAlloc),
enableSC(p.enableSC),
tageStats(this, p.numPredictors)
{
DPRINTF(TAGE, "BTBTAGE constructor\n");
Expand Down

0 comments on commit 7ee27fe

Please sign in to comment.