Updated branch predictor.

This commit is contained in:
Ross Thompson 2023-01-11 17:00:45 -06:00
parent d1bfdddd8c
commit 6999b4562e
2 changed files with 14 additions and 18 deletions

View File

@ -91,13 +91,24 @@ def ProcessFile(fileName):
HPMClist = { } HPMClist = { }
elif(len(lineToken) > 4 and lineToken[1][0:3] == 'Cnt'): elif(len(lineToken) > 4 and lineToken[1][0:3] == 'Cnt'):
countToken = line.split('=')[1].split() countToken = line.split('=')[1].split()
value = countToken[0] value = int(countToken[0])
name = ' '.join(countToken[1:]) name = ' '.join(countToken[1:])
HPMClist[name] = value HPMClist[name] = value
elif ('is done' in line): elif ('is done' in line):
benchmarks.append((testName, opt, HPMClist)) benchmarks.append((testName, opt, HPMClist))
return benchmarks return benchmarks
def ComputeAverage(benchmarks):
average = {}
for (testName, opt, HPMClist) in benchmarks:
for field in HPMClist:
value = HPMClist[field]
if field not in average:
average[field] = value
else:
average[field] += value
benchmarks.append(('All', '', average))
def FormatToPlot(currBenchmark): def FormatToPlot(currBenchmark):
names = [] names = []
values = [] values = []
@ -111,6 +122,7 @@ if(sys.argv[1] == '-b'):
configList = [] configList = []
for config in sys.argv[2::]: for config in sys.argv[2::]:
benchmarks = ProcessFile(config) benchmarks = ProcessFile(config)
ComputeAverage(benchmarks)
ComputeAll(benchmarks) ComputeAll(benchmarks)
configList.append((config.split('.')[0], benchmarks)) configList.append((config.split('.')[0], benchmarks))
@ -152,6 +164,7 @@ if(sys.argv[1] == '-b'):
else: else:
# steps 1 and 2 # steps 1 and 2
benchmarks = ProcessFile(sys.argv[1]) benchmarks = ProcessFile(sys.argv[1])
ComputeAverage(benchmarks)
# 3 process into useful data # 3 process into useful data
# cache hit rates # cache hit rates
# cache fill time # cache fill time

View File

@ -103,29 +103,12 @@ module bpred (
.PCNextF, .PCM, .DirPredictionF, .DirPredictionWrongE, .PCNextF, .PCM, .DirPredictionF, .DirPredictionWrongE,
.BranchInstrE(InstrClassE[0]), .BranchInstrM(InstrClassM[0]), .PCSrcE); .BranchInstrE(InstrClassE[0]), .BranchInstrM(InstrClassM[0]), .PCSrcE);
end else if (`BPTYPE == "BPFOLDEDGSHARE") begin:Predictor
foldedgshare #(16, 10) DirPredictor(.clk, .reset, .StallF, .StallD, .StallE, .StallM, .StallW, .FlushD, .FlushE, .FlushM, .FlushW,
.PCNextF, .PCF, .PCD, .PCE, .PCM, .DirPredictionF, .DirPredictionWrongE,
.BranchInstrF(BPInstrClassF[0]), .BranchInstrD(BPInstrClassD[0]), .BranchInstrE(InstrClassE[0]), .BranchInstrM(InstrClassM[0]),
.BranchInstrW(InstrClassW[0]), .PCSrcE);
end else if (`BPTYPE == "BPSPECULATIVEGSHARE") begin:Predictor end else if (`BPTYPE == "BPSPECULATIVEGSHARE") begin:Predictor
speculativegshare DirPredictor(.clk, .reset, .StallF, .StallD, .StallE, .StallM, .StallW, .FlushD, .FlushE, .FlushM, .FlushW, speculativegshare DirPredictor(.clk, .reset, .StallF, .StallD, .StallE, .StallM, .StallW, .FlushD, .FlushE, .FlushM, .FlushW,
.PCNextF, .PCF, .PCD, .PCE, .PCM, .DirPredictionF, .DirPredictionWrongE, .PCNextF, .PCF, .PCD, .PCE, .PCM, .DirPredictionF, .DirPredictionWrongE,
.BranchInstrF(BPInstrClassF[0]), .BranchInstrD(BPInstrClassD[0]), .BranchInstrE(InstrClassE[0]), .BranchInstrM(InstrClassM[0]), .BranchInstrF(BPInstrClassF[0]), .BranchInstrD(BPInstrClassD[0]), .BranchInstrE(InstrClassE[0]), .BranchInstrM(InstrClassM[0]),
.BranchInstrW(InstrClassW[0]), .PCSrcE); .BranchInstrW(InstrClassW[0]), .PCSrcE);
end else if (`BPTYPE == "BPOLDGSHARE") begin:Predictor
oldgsharepredictor DirPredictor(.clk, .reset, .StallF, .StallD, .StallE, .StallM, .StallW, .FlushD, .FlushE, .FlushM, .FlushW,
.PCNextF, .PCF, .PCD, .PCE, .PCM, .DirPredictionF, .DirPredictionWrongE,
.BPInstrClassF, .BPInstrClassD, .BPInstrClassE,
.InstrClassE, .PCSrcE);
end else if (`BPTYPE == "BPOLDGSHARE2") begin:Predictor
oldgsharepredictor2 DirPredictor(.clk, .reset, .StallF, .StallD, .StallE, .StallM, .StallW, .FlushD, .FlushE, .FlushM, .FlushW,
.PCNextF, .PCF, .PCD, .PCE, .PCM, .DirPredictionF, .DirPredictionWrongE,
.BPInstrClassF, .BPInstrClassD, .BPInstrClassE,
.InstrClassE, .PCSrcE);
end else if (`BPTYPE == "BPLOCALPAg") begin:Predictor end else if (`BPTYPE == "BPLOCALPAg") begin:Predictor
// *** Fix me // *** Fix me
/* -----\/----- EXCLUDED -----\/----- /* -----\/----- EXCLUDED -----\/-----