From 2d49c4582cca32449e3019c4b7e6117cac6ae0c8 Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Mon, 13 Mar 2023 13:26:27 -0500 Subject: [PATCH] Modified branch logger to indicate when the warmup period is done. The branch-predictor-simulator also changed to support this. --- bin/SeparateBranch.sh | 8 +++++--- testbench/testbench.sv | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/SeparateBranch.sh b/bin/SeparateBranch.sh index f72eaeb8..c5ebb5de 100755 --- a/bin/SeparateBranch.sh +++ b/bin/SeparateBranch.sh @@ -27,6 +27,7 @@ ################################################################################################ File="$1" +TrainLineNumbers=`cat $File | grep -n "TRAIN" | awk -NF ':' '{print $1}'` BeginLineNumbers=`cat $File | grep -n "BEGIN" | awk -NF ':' '{print $1}'` Name=`cat $File | grep -n "BEGIN" | awk -NF '/' '{print $6_$4}'` EndLineNumbers=`cat $File | grep -n "END" | awk -NF ':' '{print $1}'` @@ -35,6 +36,7 @@ echo $BeginLineNumbers echo $EndLineNumbers NameArray=($Name) +TrainLineNumberArray=($TrainLineNumbers) BeginLineNumberArray=($BeginLineNumbers) EndLineNumberArray=($EndLineNumbers) @@ -43,8 +45,8 @@ Length=${#EndLineNumberArray[@]} for i in $(seq 0 1 $((Length-1))) do CurrName=${NameArray[$i]} - CurrStart=$((${BeginLineNumberArray[$i]}+1)) + CurrTrain=$((${TrainLineNumberArray[$i]}+1)) CurrEnd=$((${EndLineNumberArray[$i]}-1)) - echo $CurrName, $CurrStart, $CurrEnd - sed -n "${CurrStart},${CurrEnd}p" $File > branch/${CurrName}_branch.log + echo $CurrName, $CurrTrain, $CurrEnd + sed -n "${CurrTrain},${CurrEnd}p" $File > branch/${CurrName}_branch.log done diff --git a/testbench/testbench.sv b/testbench/testbench.sv index e6b032f8..fe3875cb 100644 --- a/testbench/testbench.sv +++ b/testbench/testbench.sv @@ -545,12 +545,16 @@ logic [3:0] dummy; int file; logic PCSrcM; string LogFile; + logic resetD, resetEdge; flopenrc #(1) PCSrcMReg(clk, reset, dut.core.FlushM, ~dut.core.StallM, dut.core.ifu.bpred.bpred.Predictor.DirPredictor.PCSrcE, PCSrcM); + flop #(1) ResetDReg(clk, reset, resetD); + assign resetEdge = ~reset & resetD; initial begin - LogFile = $psprintf("branch_%s%d.log", `BPRED_TYPE, `BPRED_SIZE); + LogFile = $psprintf("branch_%s%0d.log", `BPRED_TYPE, `BPRED_SIZE); file = $fopen(LogFile, "w"); end always @(posedge clk) begin + if(resetEdge) $fwrite(file, "TRAIN\n"); if(StartSample) $fwrite(file, "BEGIN %s\n", memfilename); if(dut.core.ifu.InstrClassM[0] & ~dut.core.StallW & ~dut.core.FlushW & dut.core.InstrValidM) begin direction = PCSrcM ? "t" : "n";