From ae421505198a724df21657eb8c97fdb7e18a9eb6 Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Sun, 12 Mar 2023 17:58:36 -0500 Subject: [PATCH] Added script to separate branch.log into separate logs for each benchmark. --- bin/separateBrnach.sh | 24 ++++++++++++++++++++++++ testbench/testbench.sv | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 bin/separateBrnach.sh diff --git a/bin/separateBrnach.sh b/bin/separateBrnach.sh new file mode 100755 index 00000000..157046ca --- /dev/null +++ b/bin/separateBrnach.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +File="$1" +BeginLineNumbers=`cat $File | grep -n "BEGIN" | awk -NF ':' '{print $1}'` +Name=`cat $File | grep -n "BEGIN" | awk -NF '/' '{print $6}'` +EndLineNumbers=`cat $File | grep -n "END" | awk -NF ':' '{print $1}'` +echo $Name +echo $BeginLineNumbers +echo $EndLineNumbers + +NameArray=($Name) +BeginLineNumberArray=($BeginLineNumbers) +EndLineNumberArray=($EndLineNumbers) + +mkdir -p branch +Length=${#EndLineNumberArray[@]} +for i in $(seq 0 1 $((Length-1))) +do + CurrName=${NameArray[$i]} + CurrStart=$((${BeginLineNumberArray[$i]}+1)) + CurrEnd=$((${EndLineNumberArray[$i]}-1)) + echo $CurrName, $CurrStart, $CurrEnd + sed -n "${CurrStart},${CurrEnd}p" $File > branch/${CurrName}_branch.log +done diff --git a/testbench/testbench.sv b/testbench/testbench.sv index 6c9315ee..e6b032f8 100644 --- a/testbench/testbench.sv +++ b/testbench/testbench.sv @@ -544,9 +544,11 @@ logic [3:0] dummy; string direction; int file; logic PCSrcM; + string LogFile; flopenrc #(1) PCSrcMReg(clk, reset, dut.core.FlushM, ~dut.core.StallM, dut.core.ifu.bpred.bpred.Predictor.DirPredictor.PCSrcE, PCSrcM); initial begin - file = $fopen("branch.log", "w"); + LogFile = $psprintf("branch_%s%d.log", `BPRED_TYPE, `BPRED_SIZE); + file = $fopen(LogFile, "w"); end always @(posedge clk) begin if(StartSample) $fwrite(file, "BEGIN %s\n", memfilename);