From efc1d732d800b87128480d977d1b8e7480dcc43d Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Tue, 14 Nov 2023 12:57:44 -0600 Subject: [PATCH 01/14] Fixed the imperas testbench to be compatible with the config changes. --- testbench/testbench-imperas.sv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testbench/testbench-imperas.sv b/testbench/testbench-imperas.sv index b503372d4..c27722f9f 100644 --- a/testbench/testbench-imperas.sv +++ b/testbench/testbench-imperas.sv @@ -237,7 +237,7 @@ module testbench; assign HRDATAEXT = 0; end - if(P.FPGA) begin : sdcard + if(P.SDC_SUPPORTED) begin : sdcard // *** fix later /* -----\/----- EXCLUDED -----\/----- sdModel sdcard From 1c54a5698b2ce1f30ac85263b7117d9ec56e7ef6 Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Tue, 14 Nov 2023 13:54:16 -0600 Subject: [PATCH 02/14] Modified the device trees to include all the minor extensions. --- linux/devicetree/wally-artya7.dts | 1 + linux/devicetree/wally-virt.dts | 1 + 2 files changed, 2 insertions(+) diff --git a/linux/devicetree/wally-artya7.dts b/linux/devicetree/wally-artya7.dts index 6dab66c7b..1ad559bbc 100644 --- a/linux/devicetree/wally-artya7.dts +++ b/linux/devicetree/wally-artya7.dts @@ -31,6 +31,7 @@ status = "okay"; compatible = "riscv"; riscv,isa = "rv64imafdcsu"; + riscv,isa-extensions = "imafdc", "sstc", "svinval", "svnapot", "svpbmt", "zba", "zbb", "zbc", "zbs", "zicbom", "zicbop", "zicbopz", "zicntr", "zicsr", "zifencei", "zihpm"; mmu-type = "riscv,sv48"; interrupt-controller { diff --git a/linux/devicetree/wally-virt.dts b/linux/devicetree/wally-virt.dts index 7cc0f757a..edf602df3 100644 --- a/linux/devicetree/wally-virt.dts +++ b/linux/devicetree/wally-virt.dts @@ -31,6 +31,7 @@ status = "okay"; compatible = "riscv"; riscv,isa = "rv64imafdcsu"; + riscv,isa-extensions = "svadu"; mmu-type = "riscv,sv48"; interrupt-controller { From feb45b9b591e0848c81184d34468f12bb1798565 Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Tue, 14 Nov 2023 14:20:13 -0600 Subject: [PATCH 03/14] Patched up linux imperas testbench. --- sim/wally-linux-imperas.do | 2 + testbench/testbench-linux-imperas.sv | 63 ++++++++++++++-------------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/sim/wally-linux-imperas.do b/sim/wally-linux-imperas.do index fcf6ceec4..f173f67c9 100644 --- a/sim/wally-linux-imperas.do +++ b/sim/wally-linux-imperas.do @@ -55,11 +55,13 @@ if {$2 eq "buildroot" || $2 eq "buildroot-checkpoint"} { +incdir+$env(IMPERAS_HOME)/ImpProprietary/include/host \ $env(IMPERAS_HOME)/ImpPublic/source/host/rvvi/rvviApiPkg.sv \ $env(IMPERAS_HOME)/ImpPublic/source/host/rvvi/rvviTrace.sv \ + $env(IMPERAS_HOME)/ImpProprietary/source/host/idv/idvApiPkg.sv \ $env(IMPERAS_HOME)/ImpProprietary/source/host/idv/idvPkg.sv \ $env(IMPERAS_HOME)/ImpProprietary/source/host/idv/idvApiPkg.sv \ $env(IMPERAS_HOME)/ImpProprietary/source/host/idv/trace2api.sv \ $env(IMPERAS_HOME)/ImpProprietary/source/host/idv/trace2log.sv \ $env(IMPERAS_HOME)/ImpProprietary/source/host/idv/trace2cov.sv \ + $env(IMPERAS_HOME)/ImpProprietary/source/host/idv/trace2bin.sv \ ../src/cvw.sv \ ../testbench/testbench-linux-imperas.sv \ ../testbench/common/*.sv ../src/*/*.sv \ diff --git a/testbench/testbench-linux-imperas.sv b/testbench/testbench-linux-imperas.sv index d38535003..501682fa8 100644 --- a/testbench/testbench-linux-imperas.sv +++ b/testbench/testbench-linux-imperas.sv @@ -226,21 +226,6 @@ module testbench; - /////////////////////////////////////////////////////////////////////////////// - /////////////////////////////// Cache Issue /////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - // Duplicate copy of pipeline registers that are optimized out of some configurations - logic [31:0] NextInstrE, InstrM; - mux2 #(32) FlushInstrMMux(dut.core.ifu.InstrE, dut.core.ifu.nop, dut.core.ifu.FlushM, NextInstrE); - flopenr #(32) InstrMReg(clk, reset, ~dut.core.ifu.StallM, NextInstrE, InstrM); - - logic probe; - if (NO_SPOOFING) - assign probe = testbench.dut.core.PCM == 64'hffffffff80200c8c - & InstrM != 32'h14021273 - & testbench.dut.core.InstrValidM; - @@ -261,19 +246,20 @@ module testbench; logic HREADYEXT, HRESPEXT; logic HCLK, HRESETn; logic HREADY; - logic HSELEXT; + logic HSELEXT; + logic HSELEXTSDC; logic [P.PA_BITS-1:0] HADDR; - logic [P.AHBW-1:0] HWDATA; - logic [P.XLEN/8-1:0] HWSTRB; - logic HWRITE; - logic [2:0] HSIZE; - logic [2:0] HBURST; - logic [3:0] HPROT; - logic [1:0] HTRANS; - logic HMASTLOCK; - logic [31:0] GPIOIN; - logic [31:0] GPIOOUT, GPIOEN; - logic UARTSin, UARTSout; + logic [P.AHBW-1:0] HWDATA; + logic [P.XLEN/8-1:0] HWSTRB; + logic HWRITE; + logic [2:0] HSIZE; + logic [2:0] HBURST; + logic [3:0] HPROT; + logic [1:0] HTRANS; + logic HMASTLOCK; + logic [31:0] GPIOIN; + logic [31:0] GPIOOUT, GPIOEN; + logic UARTSin, UARTSout; // FPGA-specific Stuff logic SDCCLK; @@ -292,6 +278,21 @@ module testbench; assign SDCIntr = 0; + /////////////////////////////////////////////////////////////////////////////// + /////////////////////////////// Cache Issue /////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////// + + // Duplicate copy of pipeline registers that are optimized out of some configurations + logic [31:0] NextInstrE, InstrM; + mux2 #(32) FlushInstrMMux(dut.core.ifu.InstrE, dut.core.ifu.nop, dut.core.ifu.FlushM, NextInstrE); + flopenr #(32) InstrMReg(clk, reset, ~dut.core.ifu.StallM, NextInstrE, InstrM); + + logic probe; + if (NO_SPOOFING) + assign probe = testbench.dut.core.PCM == 64'hffffffff80200c8c + & InstrM != 32'h14021273 + & testbench.dut.core.InstrValidM; + `ifdef USE_IMPERAS_DV @@ -442,10 +443,10 @@ module testbench; // Wally - wallypipelinedsoc #(P) dut(.clk, .reset_ext, .reset, .HRDATAEXT, .HREADYEXT, .HRESPEXT, .HSELEXT, .HSELEXTSDC, - .HCLK, .HRESETn, .HADDR, .HWDATA, .HWSTRB, .HWRITE, .HSIZE, .HBURST, .HPROT, - .HTRANS, .HMASTLOCK, .HREADY, .TIMECLK(1'b0), .GPIOIN, .GPIOOUT, .GPIOEN, - .UARTSin, .UARTSout, .SDCIntr, .SPICS, .SPIOut, .SPIIn); + wallypipelinedsoc #(P) dut(.clk, .reset_ext, .reset, .HRDATAEXT, .HREADYEXT, .HRESPEXT, .HSELEXT, .HSELEXTSDC, + .HCLK, .HRESETn, .HADDR, .HWDATA, .HWSTRB, .HWRITE, .HSIZE, .HBURST, .HPROT, + .HTRANS, .HMASTLOCK, .HREADY, .TIMECLK(1'b0), .GPIOIN, .GPIOOUT, .GPIOEN, + .UARTSin, .UARTSout, .SDCIntr, .SPIIn, .SPIOut, .SPICS); // W-stage hardware not needed by Wally itself parameter nop = 'h13; From 1c4b3e37b1e16855568f6873266980953057fbd7 Mon Sep 17 00:00:00 2001 From: David Harris Date: Wed, 15 Nov 2023 06:05:55 -0800 Subject: [PATCH 04/14] Removed riscv-arch-test submodule that was corrupted --- .gitmodules | 3 --- addins/riscv-arch-test | 1 - 2 files changed, 4 deletions(-) delete mode 160000 addins/riscv-arch-test diff --git a/.gitmodules b/.gitmodules index 361441a18..dfb5fcf20 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,6 +26,3 @@ [submodule "addins/vivado-risc-v"] path = addins/vivado-risc-v url = https://github.com/eugene-tarassov/vivado-risc-v.git -[submodule "addins/riscv-arch-test"] - path = addins/riscv-arch-test - url = https://github.com/riscv-non-isa/riscv-arch-test diff --git a/addins/riscv-arch-test b/addins/riscv-arch-test deleted file mode 160000 index 4eea0a0f0..000000000 --- a/addins/riscv-arch-test +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4eea0a0f0e21f2613a114e45a5ad738e721c4044 From 20afaa558a2630042401250e6a5f8dc72b5c4259 Mon Sep 17 00:00:00 2001 From: David Harris Date: Wed, 15 Nov 2023 06:07:57 -0800 Subject: [PATCH 05/14] Added back in riscv-arch-test --- .gitmodules | 3 +++ addins/riscv-arch-test | 1 + 2 files changed, 4 insertions(+) create mode 160000 addins/riscv-arch-test diff --git a/.gitmodules b/.gitmodules index dfb5fcf20..361441a18 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,3 +26,6 @@ [submodule "addins/vivado-risc-v"] path = addins/vivado-risc-v url = https://github.com/eugene-tarassov/vivado-risc-v.git +[submodule "addins/riscv-arch-test"] + path = addins/riscv-arch-test + url = https://github.com/riscv-non-isa/riscv-arch-test diff --git a/addins/riscv-arch-test b/addins/riscv-arch-test new file mode 160000 index 000000000..4eea0a0f0 --- /dev/null +++ b/addins/riscv-arch-test @@ -0,0 +1 @@ +Subproject commit 4eea0a0f0e21f2613a114e45a5ad738e721c4044 From 5d4a89b27c15e9ac0749fcb2daeb284fa6a29053 Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Wed, 15 Nov 2023 14:51:47 -0600 Subject: [PATCH 06/14] Fixed bug in the btb branch logging. We were only logging branch instructions not all control flow instructions which dramatically skewed the results for sim_bp. --- testbench/common/loggers.sv | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/testbench/common/loggers.sv b/testbench/common/loggers.sv index db259da7a..28845eb45 100644 --- a/testbench/common/loggers.sv +++ b/testbench/common/loggers.sv @@ -213,26 +213,41 @@ module loggers import cvw::*; #(parameter cvw_t P, if (P.BPRED_SUPPORTED) begin : BranchLogger if (BPRED_LOGGER) begin string direction; - int file; + int file, CFIfile; logic PCSrcM; - string LogFile; + string LogFile, CFILogFile; logic resetD, resetEdge; flopenrc #(1) PCSrcMReg(clk, reset, dut.core.FlushM, ~dut.core.StallM, dut.core.ifu.PCSrcE, PCSrcM); flop #(1) ResetDReg(clk, reset, resetD); assign resetEdge = ~reset & resetD; initial begin LogFile = "branch.log"; // will break some of Ross's research analysis scripts + CFILogFile = "cfi.log"; // will break some of Ross's research analysis scripts //LogFile = $psprintf("branch_%s%0d.log", P.BPRED_TYPE, P.BPRED_SIZE); file = $fopen(LogFile, "w"); + CFIfile = $fopen(CFILogFile, "w"); end always @(posedge clk) begin - if(resetEdge) $fwrite(file, "TRAIN\n"); - if(StartSample) $fwrite(file, "BEGIN %s\n", memfilename); + if(resetEdge) begin + $fwrite(file, "TRAIN\n"); + $fwrite(CFIfile, "TRAIN\n"); + end + if(StartSample) begin + $fwrite(file, "BEGIN %s\n", memfilename); + $fwrite(CFIfile, "BEGIN %s\n", memfilename); + end if(dut.core.ifu.InstrClassM[0] & ~dut.core.StallW & ~dut.core.FlushW & dut.core.InstrValidM) begin direction = PCSrcM ? "t" : "n"; $fwrite(file, "%h %s\n", dut.core.PCM, direction); end - if(EndSample) $fwrite(file, "END %s\n", memfilename); + if((|dut.core.ifu.InstrClassM) & ~dut.core.StallW & ~dut.core.FlushW & dut.core.InstrValidM) begin + direction = PCSrcM ? "t" : "n"; + $fwrite(CFIfile, "%h %s\n", dut.core.PCM, direction); + end + if(EndSample) begin + $fwrite(file, "END %s\n", memfilename); + $fwrite(CFIfile, "END %s\n", memfilename); + end end end end From bc935b1b3b83117dbb5f793685075ee531cfeab1 Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Wed, 15 Nov 2023 14:56:02 -0600 Subject: [PATCH 07/14] Fixed second bug in the logger script when branch logging enabled but counter logger not. --- testbench/common/loggers.sv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testbench/common/loggers.sv b/testbench/common/loggers.sv index 28845eb45..1cf719085 100644 --- a/testbench/common/loggers.sv +++ b/testbench/common/loggers.sv @@ -45,7 +45,7 @@ module loggers import cvw::*; #(parameter cvw_t P, // performance counter logging logic BeginSample; logic StartSample, EndSample; - if(PrintHPMCounters & P.ZICNTR_SUPPORTED) begin : HPMCSample + if((PrintHPMCounters | BPRED_LOGGER) & P.ZICNTR_SUPPORTED) begin : HPMCSample integer HPMCindex; logic StartSampleFirst; logic StartSampleDelayed, BeginDelayed; From 9a90c15f37277d57d08fa8ed0eca7d971d9d157a Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Wed, 15 Nov 2023 16:36:49 -0600 Subject: [PATCH 08/14] Extended SeparateBranch to support both just branches and all control flow instructions. --- bin/SeparateBranch.sh | 5 +++-- sim/bpred-sim.py | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bin/SeparateBranch.sh b/bin/SeparateBranch.sh index eb4ee4494..c81ba32c9 100755 --- a/bin/SeparateBranch.sh +++ b/bin/SeparateBranch.sh @@ -43,7 +43,8 @@ TrainLineNumberArray=($TrainLineNumbers) BeginLineNumberArray=($BeginLineNumbers) EndLineNumberArray=($EndLineNumbers) -mkdir -p branch +OutputPath=${File%%.*} +mkdir -p $OutputPath Length=${#EndLineNumberArray[@]} for i in $(seq 0 1 $((Length-1))) do @@ -51,5 +52,5 @@ do CurrTrain=$((${TrainLineNumberArray[$i]}+1)) CurrEnd=$((${EndLineNumberArray[$i]}-1)) echo $CurrName, $CurrTrain, $CurrEnd - sed -n "${CurrTrain},${CurrEnd}p" $File > branch/${CurrName}_branch.log + sed -n "${CurrTrain},${CurrEnd}p" $File > $OutputPath/${CurrName}_${File} done diff --git a/sim/bpred-sim.py b/sim/bpred-sim.py index 209e21fc4..530fab70c 100755 --- a/sim/bpred-sim.py +++ b/sim/bpred-sim.py @@ -114,7 +114,20 @@ def main(): grepstr="") configs.append(tc) - if(args.target or args.iclass): + if(args.target): + # BTB and class size sweep + bpdSize = [6, 8, 10, 12, 14, 16] + for CurrBPSize in bpdSize: + name = 'BTB'+str(CurrBPSize) + configOptions = "+define+INSTR_CLASS_PRED=0 +define+BPRED_OVERRIDE +define+BPRED_TYPE=\`BP_GSHARE" + "+define+BPRED_SIZE=16" + "+define+RAS_SIZE=16+define+BTB_SIZE=" + str(CurrBPSize) + "+define+BTB_OVERRIDE" + tc = TestCase( + name=name, + variant="rv32gc", + cmd="vsim > {} -c < Date: Wed, 15 Nov 2023 16:39:35 -0600 Subject: [PATCH 09/14] Added btb reference data. --- bin/parseHPMC.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/parseHPMC.py b/bin/parseHPMC.py index bb6d2871e..2d6bb9008 100755 --- a/bin/parseHPMC.py +++ b/bin/parseHPMC.py @@ -32,10 +32,12 @@ import math import numpy as np import argparse -RefData = [('twobitCModel6', 'twobitCModel', 64, 9.65280765420711), ('twobitCModel8', 'twobitCModel', 256, 8.75120245829945), ('twobitCModel10', 'twobitCModel', 1024, 8.1318382397263), +RefDataBP = [('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)] +RefDataBTB = [('BTBCModel6', 'BTBCModel', 64, 0.00478249129947965), ('BTBCModel8', 'BTBCModel', 256, 0.000398977702713851), ('BTBCModel10', 'BTBCModel', 1024, 2.42019646857733e-05), + ('BTBCModel12', 'BTBCModel', 4096, 8.7805838949138e-06), ('BTBCModel14', 'BTBCModel', 16384, 5.61562278846231e-06), ('BTBCModel16', 'BTBCModel', 65536, 5.61562278846231e-06)] def ParseBranchListFile(path): '''Take the path to the list of Questa Sim log files containing the performance counters outputs. File @@ -436,7 +438,8 @@ 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) +if(args.reference and args.direction): benchmarkDict['Mean'].extend(RefDataBP) +if(args.reference and args.target): benchmarkDict['Mean'].extend(RefDataBTB) #print(benchmarkDict['Mean']) #print(benchmarkDict['aha-mont64Speed']) #print(benchmarkDict) From 21b2a71bd6b4a7ad8dee00c5db2e77d47b64cf4a Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Wed, 15 Nov 2023 16:53:44 -0600 Subject: [PATCH 10/14] Updates to btb logger processing. --- bin/CModelBTBAccuracy.sh | 2 +- bin/parseHPMC.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/CModelBTBAccuracy.sh b/bin/CModelBTBAccuracy.sh index 5cde4238c..e4a26fb85 100755 --- a/bin/CModelBTBAccuracy.sh +++ b/bin/CModelBTBAccuracy.sh @@ -52,6 +52,6 @@ do # with such long precision bc outputs onto multiple lines # must remove \n and \ from string Product=`echo "$Product" | tr -d '\n' | tr -d '\\\'` - GeoMean=`perl -E "say $Product**(1/$Count)"` + GeoMean=`perl -E "say $Product**(1/$Count) * 100"` echo "$Pred$Size $GeoMean" done diff --git a/bin/parseHPMC.py b/bin/parseHPMC.py index 2d6bb9008..8e274a200 100755 --- a/bin/parseHPMC.py +++ b/bin/parseHPMC.py @@ -36,8 +36,8 @@ RefDataBP = [('twobitCModel6', 'twobitCModel', 64, 9.65280765420711), ('twobitCM ('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)] -RefDataBTB = [('BTBCModel6', 'BTBCModel', 64, 0.00478249129947965), ('BTBCModel8', 'BTBCModel', 256, 0.000398977702713851), ('BTBCModel10', 'BTBCModel', 1024, 2.42019646857733e-05), - ('BTBCModel12', 'BTBCModel', 4096, 8.7805838949138e-06), ('BTBCModel14', 'BTBCModel', 16384, 5.61562278846231e-06), ('BTBCModel16', 'BTBCModel', 65536, 5.61562278846231e-06)] +RefDataBTB = [('BTBCModel6', 'BTBCModel', 64, 1.11806778745097), ('BTBCModel8', 'BTBCModel', 256, 0.183833943219956), ('BTBCModel10', 'BTBCModel', 1024, 0.0109271020749376), + ('BTBCModel12', 'BTBCModel', 4096, 0.00437600802791213), ('BTBCModel14', 'BTBCModel', 16384, 0.00188756234204305), ('BTBCModel16', 'BTBCModel', 65536, 0.00188756234204305)] def ParseBranchListFile(path): '''Take the path to the list of Questa Sim log files containing the performance counters outputs. File From 0b49c736b9b34d793e2015359f6c0e088a41f955 Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Wed, 15 Nov 2023 22:35:33 -0600 Subject: [PATCH 11/14] Removed the size opt tests from the branch predictor analysis. --- bin/parseHPMC.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/parseHPMC.py b/bin/parseHPMC.py index 8e274a200..86326457a 100755 --- a/bin/parseHPMC.py +++ b/bin/parseHPMC.py @@ -180,9 +180,11 @@ def ExtractSelectedData(benchmarkFirstList): benchmarkDict = { } for benchmark in benchmarkFirstList: (name, opt, config, prefixName, entries, dataDict) = benchmark - if opt == 'bd_speedopt_speed': NewName = name+'Sp' - elif opt == 'bd_sizeopt_speed': NewName = name+'Sz' - else: NewName = name + # use this code to distinguish speed opt and size opt. + #if opt == 'bd_speedopt_speed': NewName = name+'Sp' + #elif opt == 'bd_sizeopt_speed': NewName = name+'Sz' + #else: NewName = name + NewName = name #print(NewName) #NewName = name+'_'+opt if NewName in benchmarkDict: From 38b327eaf8becc10349317588fb695da33a444d1 Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Fri, 17 Nov 2023 11:21:25 -0600 Subject: [PATCH 12/14] Fixed testbench so it runs with BPRED_LOGGER but not PrintHPMCounters. --- testbench/testbench.sv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testbench/testbench.sv b/testbench/testbench.sv index 186144839..070a6cad7 100644 --- a/testbench/testbench.sv +++ b/testbench/testbench.sv @@ -37,7 +37,7 @@ module testbench; parameter DEBUG=0; parameter TEST="none"; parameter PrintHPMCounters=0; - parameter BPRED_LOGGER=0; + parameter BPRED_LOGGER=1; parameter I_CACHE_ADDR_LOGGER=0; parameter D_CACHE_ADDR_LOGGER=0; @@ -434,7 +434,7 @@ module testbench; loggers (clk, reset, DCacheFlushStart, DCacheFlushDone, memfilename); // track the current function or global label - if (DEBUG == 1 | (PrintHPMCounters & P.ZICNTR_SUPPORTED)) begin : FunctionName + if (DEBUG == 1 | ((PrintHPMCounters | BPRED_LOGGER) & P.ZICNTR_SUPPORTED)) begin : FunctionName FunctionName #(P) FunctionName(.reset(reset_ext | TestBenchReset), .clk(clk), .ProgramAddrMapFile(ProgramAddrMapFile), .ProgramLabelMapFile(ProgramLabelMapFile)); end From d95d7130a35120c9dd9082ec984bcee51d28be14 Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Fri, 17 Nov 2023 12:05:22 -0600 Subject: [PATCH 13/14] Fixed bugs in paraseHPMC.py --- bin/parseHPMC.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/parseHPMC.py b/bin/parseHPMC.py index 86326457a..a11296b3e 100755 --- a/bin/parseHPMC.py +++ b/bin/parseHPMC.py @@ -244,7 +244,7 @@ def ReportAsText(benchmarkDict): def Inversion(lst): return [x if not args.invert else 100 - x for x in lst] -def BarGraph(seriesDict, xlabelList, BenchPerRow, FileName): +def BarGraph(seriesDict, xlabelList, BenchPerRow, FileName, IncludeLegend): index = 0 NumberInGroup = len(seriesDict) # Figure out width of bars. NumberInGroup bars + want 2 bar space @@ -262,8 +262,8 @@ def BarGraph(seriesDict, xlabelList, BenchPerRow, FileName): plt.xticks([r + barWidth*(NumberInGroup/2-0.5) for r in range(0, BenchPerRow)], xlabelList) plt.xlabel('Benchmark') if(not args.invert): plt.ylabel('Misprediction Rate (%)') - else: plt.ylabel('Prediction Accuracy (%)') - plt.legend(loc='upper left', ncol=2) + else: plt.ylabel('Prediction Accuracy (%)') + if(IncludeLegend): plt.legend(loc='upper right', ncol=2) plt.savefig(FileName) def SelectPartition(xlabelListBig, seriesDictBig, group, BenchPerRow): @@ -352,13 +352,13 @@ def ReportAsGraph(benchmarkDict, bar): # index += 1 if(not args.summary): - size = len(benchmarkDict) - sizeSqrt = math.sqrt(size) - isSquare = math.isclose(sizeSqrt, round(sizeSqrt)) - numCol = math.floor(sizeSqrt) + NumBenchmarks = len(benchmarkDict) + NumBenchmarksSqrt = math.sqrt(NumBenchmarks) + isSquare = math.isclose(NumBenchmarksSqrt, round(NumBenchmarksSqrt)) + numCol = math.floor(NumBenchmarksSqrt) numRow = numCol + (0 if isSquare else 1) index = 1 - BenchPerRow = 7 + BenchPerRow = 5 xlabelList = [] seriesDict = {} @@ -387,11 +387,11 @@ def ReportAsGraph(benchmarkDict, bar): #The next step will be to split the benchmarkDict into length BenchPerRow pieces then repeat the following code # on each piece. - for row in range(0, math.ceil(39 / BenchPerRow)): + for row in range(0, math.ceil(NumBenchmarks / BenchPerRow)): (xlabelListTrunk, seriesDictTrunk) = SelectPartition(xlabelListBig, seriesDictBig, row, BenchPerRow) FileName = 'barSegment%d.png' % row groupLen = len(xlabelListTrunk) - BarGraph(seriesDictTrunk, xlabelListTrunk, groupLen, FileName) + BarGraph(seriesDictTrunk, xlabelListTrunk, groupLen, FileName, (row == 0)) # main From 8cf2c404bf85865f261af5a06d30fa66c52b867c Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Fri, 17 Nov 2023 15:21:58 -0600 Subject: [PATCH 14/14] bpred-sim only simulates 12 jobs at once. --- sim/bpred-sim.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sim/bpred-sim.py b/sim/bpred-sim.py index 530fab70c..60af41298 100755 --- a/sim/bpred-sim.py +++ b/sim/bpred-sim.py @@ -102,7 +102,8 @@ def main(): if(args.direction): # for direction predictor size sweep 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'] + bpdType = ['twobit', 'gshare'] for CurrBPType in bpdType: for CurrBPSize in bpdSize: name = CurrBPType+str(CurrBPSize)