diff --git a/bin/parseTest.py b/bin/parseTest.py index ba3309aff..c24fbe3fe 100755 --- a/bin/parseTest.py +++ b/bin/parseTest.py @@ -32,6 +32,10 @@ import math import numpy as np 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): '''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 = { } elif(len(lineToken) > 4 and lineToken[1][0:3] == 'Cnt'): countToken = line.split('=')[1].split() - value = int(countToken[0]) + value = int(countToken[0]) if countToken[0] != 'x' else 0 name = ' '.join(countToken[1:]) HPMClist[name] = value elif ('is done' in line): @@ -111,7 +115,7 @@ def ComputeGeometricAverage(benchmarks): benchmarks.append(('Mean', '', AllAve)) 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] elif(predictorParams == 'local'): return predictorType + predictorParams[0] + '_' + predictorParams[1] @@ -120,7 +124,7 @@ def GenerateName(predictorType, predictorParams): sys.exit(-1) 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]) elif(predictorParams == 'local'): return 2**int(predictorParams[0]) * int(predictorParams[1]) + 2**int(predictorParams[1]) @@ -286,7 +290,7 @@ def ReportAsGraph(benchmarkDict, bar): 'ClassMPR': 'Class Misprediction'} if(args.summary): 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'] # 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 benchmarkDict = ExtractSelectedData(benchmarkFirstList) # filters to just the desired performance counter metric +if(args.reference): benchmarkDict['Mean'].extend(RefData) #print(benchmarkDict['Mean']) #print(benchmarkDict['aha-mont64Speed']) #print(benchmarkDict) diff --git a/config/buildroot/config.vh b/config/buildroot/config.vh index 38960c735..79ee99f3c 100644 --- a/config/buildroot/config.vh +++ b/config/buildroot/config.vh @@ -142,6 +142,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS localparam BPRED_SIZE = 32'd10; localparam BPRED_NUM_LHR = 32'd6; localparam BTB_SIZE = 32'd10; +localparam RAS_SIZE = 32'd16; localparam SVADU_SUPPORTED = 1; diff --git a/config/fpga/config.vh b/config/fpga/config.vh index 7e582fabb..27903d0be 100644 --- a/config/fpga/config.vh +++ b/config/fpga/config.vh @@ -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_SIZE = 32'd12; localparam BTB_SIZE = 32'd10; +localparam RAS_SIZE = 32'd16; localparam SVADU_SUPPORTED = 1; localparam ZMMUL_SUPPORTED = 0; diff --git a/config/rv32e/config.vh b/config/rv32e/config.vh index e1cbdab0f..c67e71c13 100644 --- a/config/rv32e/config.vh +++ b/config/rv32e/config.vh @@ -144,6 +144,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS localparam BPRED_SIZE = 32'd10; localparam BPRED_NUM_LHR = 32'd6; localparam BTB_SIZE = 32'd10; +localparam RAS_SIZE = 32'd16; localparam SVADU_SUPPORTED = 0; localparam ZMMUL_SUPPORTED = 0; diff --git a/config/rv32gc/config.vh b/config/rv32gc/config.vh index 46d3ed22a..de966b1f2 100644 --- a/config/rv32gc/config.vh +++ b/config/rv32gc/config.vh @@ -150,7 +150,13 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS localparam BPRED_SIZE = 32'd10; `endif 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 RAS_SIZE = 32'd16; +`endif localparam SVADU_SUPPORTED = 1; localparam ZMMUL_SUPPORTED = 0; diff --git a/config/rv32i/config.vh b/config/rv32i/config.vh index e1c5a6a5d..a31e034df 100644 --- a/config/rv32i/config.vh +++ b/config/rv32i/config.vh @@ -144,6 +144,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS localparam BPRED_SIZE = 32'd10; localparam BPRED_NUM_LHR = 32'd6; localparam BTB_SIZE = 32'd10; +localparam RAS_SIZE = 32'd16; localparam SVADU_SUPPORTED = 0; localparam ZMMUL_SUPPORTED = 0; diff --git a/config/rv32imc/config.vh b/config/rv32imc/config.vh index a9123cbb4..61eea7325 100644 --- a/config/rv32imc/config.vh +++ b/config/rv32imc/config.vh @@ -143,6 +143,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS localparam BPRED_SIZE = 32'd10; localparam BPRED_NUM_LHR = 32'd6; localparam BTB_SIZE = 32'd10; +localparam RAS_SIZE = 32'd16; localparam SVADU_SUPPORTED = 0; localparam ZMMUL_SUPPORTED = 0; diff --git a/config/rv64fpquad/config.vh b/config/rv64fpquad/config.vh index 2533dbc21..d8bf3e6fc 100644 --- a/config/rv64fpquad/config.vh +++ b/config/rv64fpquad/config.vh @@ -146,6 +146,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS localparam BPRED_SIZE = 32'd10; localparam BPRED_NUM_LHR = 32'd6; localparam BTB_SIZE = 32'd10; +localparam RAS_SIZE = 32'd16; localparam SVADU_SUPPORTED = 0; localparam ZMMUL_SUPPORTED = 0; diff --git a/config/rv64gc/config.vh b/config/rv64gc/config.vh index 16e50b899..36d99020e 100644 --- a/config/rv64gc/config.vh +++ b/config/rv64gc/config.vh @@ -147,8 +147,9 @@ localparam PLIC_SDC_ID = 32'd9; localparam BPRED_SUPPORTED = 1; localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BASIC, BP_TWOBIT localparam BPRED_NUM_LHR = 32'd6; -localparam BPRED_SIZE = 32'd10; +localparam BPRED_SIZE = 32'd6; localparam BTB_SIZE = 32'd10; +localparam RAS_SIZE = 32'd16; localparam SVADU_SUPPORTED = 1; localparam ZMMUL_SUPPORTED = 0; diff --git a/config/rv64i/config.vh b/config/rv64i/config.vh index c27f7faf0..6add96e78 100644 --- a/config/rv64i/config.vh +++ b/config/rv64i/config.vh @@ -146,6 +146,7 @@ localparam BPRED_TYPE = `BP_GSHARE; // BP_GSHARE_BASIC, BP_GLOBAL, BP_GLOBAL_BAS localparam BPRED_SIZE = 32'd10; localparam BPRED_NUM_LHR = 32'd6; localparam BTB_SIZE = 32'd10; +localparam RAS_SIZE = 32'd16; localparam SVADU_SUPPORTED = 0; localparam ZMMUL_SUPPORTED = 0; diff --git a/config/shared/parameter-defs.vh b/config/shared/parameter-defs.vh index 340668466..4921f6a3d 100644 --- a/config/shared/parameter-defs.vh +++ b/config/shared/parameter-defs.vh @@ -89,6 +89,7 @@ localparam cvw_t P = '{ BPRED_SIZE : BPRED_SIZE, BPRED_NUM_LHR : BPRED_NUM_LHR, BTB_SIZE : BTB_SIZE, + RAS_SIZE : RAS_SIZE, RADIX : RADIX, DIVCOPIES : DIVCOPIES, ZBA_SUPPORTED : ZBA_SUPPORTED, diff --git a/sim/bpred-sim.py b/sim/bpred-sim.py index 4ec9324a3..9a59e8866 100755 --- a/sim/bpred-sim.py +++ b/sim/bpred-sim.py @@ -46,19 +46,41 @@ configs = [ ) ] -bpdSize = [6, 8, 10, 12, 14, 16] -bpdType = ['twobit', 'gshare', 'global', 'gshare_basic', 'global_basic', 'local_basic'] -for CurrBPType in bpdType: - for CurrBPSize in bpdSize: - 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) - tc = TestCase( - name=name, - variant="rv32gc", - cmd="vsim > {} -c < {} -c < {} -c < {} -c <= 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; flopenr #(Depth) PTR(clk, reset, CounterEn, NextPtr, Ptr);