mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Actually fixed non-power of 2 issue with RAS.
Added RAS swapping to branch predictor scripts and configurations.
This commit is contained in:
parent
9ec2bfd052
commit
1a003019d6
@ -32,6 +32,10 @@ import math
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
RefData = [('twobitCModel6', 'twobitCModel', 64, 9.65280765420711), ('twobitCModel8', 'twobitCModel', 256, 8.75120245829945), ('twobitCModel10', 'twobitCModel', 1024, 8.1318382397263),
|
||||||
|
('twobitCModel12', 'twobitCModel', 4096, 7.53026646633342), ('twobitCModel14', 'twobitCModel', 16384, 6.07679338544009), ('twobitCModel16', 'twobitCModel', 65536, 6.07679338544009),
|
||||||
|
('gshareCModel6', 'gshareCModel', 64, 10.6602835418646), ('gshareCModel8', 'gshareCModel', 256, 8.38384710559667), ('gshareCModel10', 'gshareCModel', 1024, 6.36847432155534),
|
||||||
|
('gshareCModel12', 'gshareCModel', 4096, 3.91108491151983), ('gshareCModel14', 'gshareCModel', 16384, 2.83926519215395), ('gshareCModel16', 'gshareCModel', 65536, .60213659066941)]
|
||||||
|
|
||||||
def ParseBranchListFile(path):
|
def ParseBranchListFile(path):
|
||||||
'''Take the path to the list of Questa Sim log files containing the performance counters outputs. File
|
'''Take the path to the list of Questa Sim log files containing the performance counters outputs. File
|
||||||
@ -65,7 +69,7 @@ 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 = int(countToken[0])
|
value = int(countToken[0]) if countToken[0] != 'x' else 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):
|
||||||
@ -111,7 +115,7 @@ def ComputeGeometricAverage(benchmarks):
|
|||||||
benchmarks.append(('Mean', '', AllAve))
|
benchmarks.append(('Mean', '', AllAve))
|
||||||
|
|
||||||
def GenerateName(predictorType, predictorParams):
|
def GenerateName(predictorType, predictorParams):
|
||||||
if(predictorType == 'gshare' or predictorType == 'twobit'):
|
if(predictorType == 'gshare' or predictorType == 'twobit' or predictorType == 'btb' or predictorType == 'class'):
|
||||||
return predictorType + predictorParams[0]
|
return predictorType + predictorParams[0]
|
||||||
elif(predictorParams == 'local'):
|
elif(predictorParams == 'local'):
|
||||||
return predictorType + predictorParams[0] + '_' + predictorParams[1]
|
return predictorType + predictorParams[0] + '_' + predictorParams[1]
|
||||||
@ -120,7 +124,7 @@ def GenerateName(predictorType, predictorParams):
|
|||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
def ComputePredNumEntries(predictorType, predictorParams):
|
def ComputePredNumEntries(predictorType, predictorParams):
|
||||||
if(predictorType == 'gshare' or predictorType == 'twobit'):
|
if(predictorType == 'gshare' or predictorType == 'twobit' or predictorType == 'btb' or predictorType == 'class'):
|
||||||
return 2**int(predictorParams[0])
|
return 2**int(predictorParams[0])
|
||||||
elif(predictorParams == 'local'):
|
elif(predictorParams == 'local'):
|
||||||
return 2**int(predictorParams[0]) * int(predictorParams[1]) + 2**int(predictorParams[1])
|
return 2**int(predictorParams[0]) * int(predictorParams[1]) + 2**int(predictorParams[1])
|
||||||
@ -286,7 +290,7 @@ def ReportAsGraph(benchmarkDict, bar):
|
|||||||
'ClassMPR': 'Class Misprediction'}
|
'ClassMPR': 'Class Misprediction'}
|
||||||
if(args.summary):
|
if(args.summary):
|
||||||
markers = ['x', '.', '+', '*', '^', 'o', ',', 's']
|
markers = ['x', '.', '+', '*', '^', 'o', ',', 's']
|
||||||
colors = ['black', 'blue', 'dodgerblue', 'turquoise', 'lightsteelblue', 'gray', 'black', 'blue']
|
colors = ['blue', 'black', 'dodgerblue', 'gray', 'lightsteelblue', 'turquoise', 'black', 'blue']
|
||||||
temp = benchmarkDict['Mean']
|
temp = benchmarkDict['Mean']
|
||||||
|
|
||||||
# the benchmarkDict['Mean'] contains sequencies of results for multiple
|
# the benchmarkDict['Mean'] contains sequencies of results for multiple
|
||||||
@ -429,6 +433,7 @@ performanceCounterList = BuildDataBase(predictorLogs) # builds a databas
|
|||||||
benchmarkFirstList = ReorderDataBase(performanceCounterList) # reorder first by benchmark then trace
|
benchmarkFirstList = ReorderDataBase(performanceCounterList) # reorder first by benchmark then trace
|
||||||
benchmarkDict = ExtractSelectedData(benchmarkFirstList) # filters to just the desired performance counter metric
|
benchmarkDict = ExtractSelectedData(benchmarkFirstList) # filters to just the desired performance counter metric
|
||||||
|
|
||||||
|
if(args.reference): benchmarkDict['Mean'].extend(RefData)
|
||||||
#print(benchmarkDict['Mean'])
|
#print(benchmarkDict['Mean'])
|
||||||
#print(benchmarkDict['aha-mont64Speed'])
|
#print(benchmarkDict['aha-mont64Speed'])
|
||||||
#print(benchmarkDict)
|
#print(benchmarkDict)
|
||||||
|
@ -142,6 +142,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS
|
|||||||
localparam BPRED_SIZE = 32'd10;
|
localparam BPRED_SIZE = 32'd10;
|
||||||
localparam BPRED_NUM_LHR = 32'd6;
|
localparam BPRED_NUM_LHR = 32'd6;
|
||||||
localparam BTB_SIZE = 32'd10;
|
localparam BTB_SIZE = 32'd10;
|
||||||
|
localparam RAS_SIZE = 32'd16;
|
||||||
|
|
||||||
|
|
||||||
localparam SVADU_SUPPORTED = 1;
|
localparam SVADU_SUPPORTED = 1;
|
||||||
|
@ -156,6 +156,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS
|
|||||||
localparam BPRED_NUM_LHR = 32'd6;
|
localparam BPRED_NUM_LHR = 32'd6;
|
||||||
localparam BPRED_SIZE = 32'd12;
|
localparam BPRED_SIZE = 32'd12;
|
||||||
localparam BTB_SIZE = 32'd10;
|
localparam BTB_SIZE = 32'd10;
|
||||||
|
localparam RAS_SIZE = 32'd16;
|
||||||
|
|
||||||
localparam SVADU_SUPPORTED = 1;
|
localparam SVADU_SUPPORTED = 1;
|
||||||
localparam ZMMUL_SUPPORTED = 0;
|
localparam ZMMUL_SUPPORTED = 0;
|
||||||
|
@ -144,6 +144,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS
|
|||||||
localparam BPRED_SIZE = 32'd10;
|
localparam BPRED_SIZE = 32'd10;
|
||||||
localparam BPRED_NUM_LHR = 32'd6;
|
localparam BPRED_NUM_LHR = 32'd6;
|
||||||
localparam BTB_SIZE = 32'd10;
|
localparam BTB_SIZE = 32'd10;
|
||||||
|
localparam RAS_SIZE = 32'd16;
|
||||||
|
|
||||||
localparam SVADU_SUPPORTED = 0;
|
localparam SVADU_SUPPORTED = 0;
|
||||||
localparam ZMMUL_SUPPORTED = 0;
|
localparam ZMMUL_SUPPORTED = 0;
|
||||||
|
@ -150,7 +150,13 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS
|
|||||||
localparam BPRED_SIZE = 32'd10;
|
localparam BPRED_SIZE = 32'd10;
|
||||||
`endif
|
`endif
|
||||||
localparam BPRED_NUM_LHR = 32'd6;
|
localparam BPRED_NUM_LHR = 32'd6;
|
||||||
|
`ifdef BTB_OVERRIDE
|
||||||
|
localparam BTB_SIZE = `BTB_SIZE;
|
||||||
|
localparam RAS_SIZE = `RAS_SIZE;
|
||||||
|
`else
|
||||||
localparam BTB_SIZE = 32'd10;
|
localparam BTB_SIZE = 32'd10;
|
||||||
|
localparam RAS_SIZE = 32'd16;
|
||||||
|
`endif
|
||||||
|
|
||||||
localparam SVADU_SUPPORTED = 1;
|
localparam SVADU_SUPPORTED = 1;
|
||||||
localparam ZMMUL_SUPPORTED = 0;
|
localparam ZMMUL_SUPPORTED = 0;
|
||||||
|
@ -144,6 +144,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS
|
|||||||
localparam BPRED_SIZE = 32'd10;
|
localparam BPRED_SIZE = 32'd10;
|
||||||
localparam BPRED_NUM_LHR = 32'd6;
|
localparam BPRED_NUM_LHR = 32'd6;
|
||||||
localparam BTB_SIZE = 32'd10;
|
localparam BTB_SIZE = 32'd10;
|
||||||
|
localparam RAS_SIZE = 32'd16;
|
||||||
|
|
||||||
localparam SVADU_SUPPORTED = 0;
|
localparam SVADU_SUPPORTED = 0;
|
||||||
localparam ZMMUL_SUPPORTED = 0;
|
localparam ZMMUL_SUPPORTED = 0;
|
||||||
|
@ -143,6 +143,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS
|
|||||||
localparam BPRED_SIZE = 32'd10;
|
localparam BPRED_SIZE = 32'd10;
|
||||||
localparam BPRED_NUM_LHR = 32'd6;
|
localparam BPRED_NUM_LHR = 32'd6;
|
||||||
localparam BTB_SIZE = 32'd10;
|
localparam BTB_SIZE = 32'd10;
|
||||||
|
localparam RAS_SIZE = 32'd16;
|
||||||
|
|
||||||
localparam SVADU_SUPPORTED = 0;
|
localparam SVADU_SUPPORTED = 0;
|
||||||
localparam ZMMUL_SUPPORTED = 0;
|
localparam ZMMUL_SUPPORTED = 0;
|
||||||
|
@ -146,6 +146,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS
|
|||||||
localparam BPRED_SIZE = 32'd10;
|
localparam BPRED_SIZE = 32'd10;
|
||||||
localparam BPRED_NUM_LHR = 32'd6;
|
localparam BPRED_NUM_LHR = 32'd6;
|
||||||
localparam BTB_SIZE = 32'd10;
|
localparam BTB_SIZE = 32'd10;
|
||||||
|
localparam RAS_SIZE = 32'd16;
|
||||||
|
|
||||||
localparam SVADU_SUPPORTED = 0;
|
localparam SVADU_SUPPORTED = 0;
|
||||||
localparam ZMMUL_SUPPORTED = 0;
|
localparam ZMMUL_SUPPORTED = 0;
|
||||||
|
@ -147,8 +147,9 @@ localparam PLIC_SDC_ID = 32'd9;
|
|||||||
localparam BPRED_SUPPORTED = 1;
|
localparam BPRED_SUPPORTED = 1;
|
||||||
localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BASIC, BP_TWOBIT
|
localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BASIC, BP_TWOBIT
|
||||||
localparam BPRED_NUM_LHR = 32'd6;
|
localparam BPRED_NUM_LHR = 32'd6;
|
||||||
localparam BPRED_SIZE = 32'd10;
|
localparam BPRED_SIZE = 32'd6;
|
||||||
localparam BTB_SIZE = 32'd10;
|
localparam BTB_SIZE = 32'd10;
|
||||||
|
localparam RAS_SIZE = 32'd16;
|
||||||
|
|
||||||
localparam SVADU_SUPPORTED = 1;
|
localparam SVADU_SUPPORTED = 1;
|
||||||
localparam ZMMUL_SUPPORTED = 0;
|
localparam ZMMUL_SUPPORTED = 0;
|
||||||
|
@ -146,6 +146,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS
|
|||||||
localparam BPRED_SIZE = 32'd10;
|
localparam BPRED_SIZE = 32'd10;
|
||||||
localparam BPRED_NUM_LHR = 32'd6;
|
localparam BPRED_NUM_LHR = 32'd6;
|
||||||
localparam BTB_SIZE = 32'd10;
|
localparam BTB_SIZE = 32'd10;
|
||||||
|
localparam RAS_SIZE = 32'd16;
|
||||||
|
|
||||||
localparam SVADU_SUPPORTED = 0;
|
localparam SVADU_SUPPORTED = 0;
|
||||||
localparam ZMMUL_SUPPORTED = 0;
|
localparam ZMMUL_SUPPORTED = 0;
|
||||||
|
@ -89,6 +89,7 @@ localparam cvw_t P = '{
|
|||||||
BPRED_SIZE : BPRED_SIZE,
|
BPRED_SIZE : BPRED_SIZE,
|
||||||
BPRED_NUM_LHR : BPRED_NUM_LHR,
|
BPRED_NUM_LHR : BPRED_NUM_LHR,
|
||||||
BTB_SIZE : BTB_SIZE,
|
BTB_SIZE : BTB_SIZE,
|
||||||
|
RAS_SIZE : RAS_SIZE,
|
||||||
RADIX : RADIX,
|
RADIX : RADIX,
|
||||||
DIVCOPIES : DIVCOPIES,
|
DIVCOPIES : DIVCOPIES,
|
||||||
ZBA_SUPPORTED : ZBA_SUPPORTED,
|
ZBA_SUPPORTED : ZBA_SUPPORTED,
|
||||||
|
@ -46,19 +46,41 @@ configs = [
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
bpdSize = [6, 8, 10, 12, 14, 16]
|
# bpdSize = [6, 8, 10, 12, 14, 16]
|
||||||
bpdType = ['twobit', 'gshare', 'global', 'gshare_basic', 'global_basic', 'local_basic']
|
# bpdType = ['twobit', 'gshare', 'global', 'gshare_basic', 'global_basic', 'local_basic']
|
||||||
for CurrBPType in bpdType:
|
# for CurrBPType in bpdType:
|
||||||
for CurrBPSize in bpdSize:
|
# for CurrBPSize in bpdSize:
|
||||||
name = CurrBPType+str(CurrBPSize)
|
# name = CurrBPType+str(CurrBPSize)
|
||||||
configOptions = "+define+INSTR_CLASS_PRED=0 +define+BPRED_OVERRIDE +define+BPRED_TYPE=" + str(bpdType.index(CurrBPType)) + "+define+BPRED_SIZE=" + str(CurrBPSize)
|
# configOptions = "+define+INSTR_CLASS_PRED=0 +define+BPRED_OVERRIDE +define+BPRED_TYPE=" + str(bpdType.index(CurrBPType)) + "+define+BPRED_SIZE=" + str(CurrBPSize)
|
||||||
tc = TestCase(
|
# tc = TestCase(
|
||||||
name=name,
|
# name=name,
|
||||||
variant="rv32gc",
|
# variant="rv32gc",
|
||||||
cmd="vsim > {} -c <<!\ndo wally-batch.do rv32gc configOptions " + name + " embench " + configOptions,
|
# cmd="vsim > {} -c <<!\ndo wally-batch.do rv32gc configOptions " + name + " embench " + configOptions,
|
||||||
grepstr="")
|
# grepstr="")
|
||||||
configs.append(tc)
|
# configs.append(tc)
|
||||||
|
|
||||||
|
# bpdSize = [6, 8, 10, 12, 14, 16]
|
||||||
|
# for CurrBPSize in bpdSize:
|
||||||
|
# name = 'BTB'+str(CurrBPSize)
|
||||||
|
# configOptions = "+define+INSTR_CLASS_PRED=1 +define+BPRED_OVERRIDE +define+BPRED_TYPE=\`BP_GSHARE" + "+define+BPRED_SIZE=16" + "+define+BTB_SIZE=" + str(CurrBPSize) + "+define+BTB_OVERRIDE"
|
||||||
|
# tc = TestCase(
|
||||||
|
# name=name,
|
||||||
|
# variant="rv32gc",
|
||||||
|
# cmd="vsim > {} -c <<!\ndo wally-batch.do rv32gc configOptions " + name + " embench " + configOptions,
|
||||||
|
# grepstr="")
|
||||||
|
# configs.append(tc)
|
||||||
|
|
||||||
|
bpdSize = [2, 3, 4, 6, 10, 16]
|
||||||
|
for CurrBPSize in bpdSize:
|
||||||
|
name = 'RAS'+str(CurrBPSize)
|
||||||
|
configOptions = "+define+INSTR_CLASS_PRED=0 +define+BPRED_OVERRIDE +define+BPRED_TYPE=\`BP_GSHARE" + "+define+BPRED_SIZE=16" + "+define+BTB_SIZE=16" + "+define+RAS_SIZE=" + str(CurrBPSize) + "+define+BTB_OVERRIDE+define+RAS_OVERRIDE"
|
||||||
|
tc = TestCase(
|
||||||
|
name=name,
|
||||||
|
variant="rv32gc",
|
||||||
|
cmd="vsim > {} -c <<!\ndo wally-batch.do rv32gc configOptions " + name + " embench " + configOptions,
|
||||||
|
grepstr="")
|
||||||
|
configs.append(tc)
|
||||||
|
|
||||||
# bpdSize = [6, 8, 10, 12, 14, 16]
|
# bpdSize = [6, 8, 10, 12, 14, 16]
|
||||||
# LHRSize = [4, 8, 10]
|
# LHRSize = [4, 8, 10]
|
||||||
# bpdType = ['local_repair']
|
# bpdType = ['local_repair']
|
||||||
|
@ -149,6 +149,7 @@ typedef struct packed {
|
|||||||
int BPRED_NUM_LHR;
|
int BPRED_NUM_LHR;
|
||||||
int BPRED_SIZE;
|
int BPRED_SIZE;
|
||||||
int BTB_SIZE;
|
int BTB_SIZE;
|
||||||
|
int RAS_SIZE;
|
||||||
|
|
||||||
// FPU division architecture
|
// FPU division architecture
|
||||||
int RADIX;
|
int RADIX;
|
||||||
|
@ -77,7 +77,10 @@ module RASPredictor import cvw::*; #(parameter cvw_t P)(
|
|||||||
mux2 #(Depth) PtrMux(P1, M1, DecrementPtr, IncDecPtr);
|
mux2 #(Depth) PtrMux(P1, M1, DecrementPtr, IncDecPtr);
|
||||||
logic [Depth-1:0] Sum;
|
logic [Depth-1:0] Sum;
|
||||||
assign Sum = Ptr + IncDecPtr;
|
assign Sum = Ptr + IncDecPtr;
|
||||||
assign NextPtr = Sum == P.RAS_SIZE[Depth-1:0] ? 0 : Sum; // wrap back around if our stack is not a power of 2
|
if(|P.RAS_SIZE[Depth-1:0])
|
||||||
|
assign NextPtr = Sum >= P.RAS_SIZE[Depth-1:0] ? 0 : Sum; // wrap back around if our stack is not a power of 2
|
||||||
|
else
|
||||||
|
assign NextPtr = Sum;
|
||||||
//assign NextPtr = Ptr + IncDecPtr;
|
//assign NextPtr = Ptr + IncDecPtr;
|
||||||
|
|
||||||
flopenr #(Depth) PTR(clk, reset, CounterEn, NextPtr, Ptr);
|
flopenr #(Depth) PTR(clk, reset, CounterEn, NextPtr, Ptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user