Modified branch logger to indicate when the warmup period is done.

The branch-predictor-simulator also changed to support this.
This commit is contained in:
Ross Thompson 2023-03-13 13:26:27 -05:00
parent 0441e3b736
commit 2d49c4582c
2 changed files with 10 additions and 4 deletions

View File

@ -27,6 +27,7 @@
################################################################################################ ################################################################################################
File="$1" File="$1"
TrainLineNumbers=`cat $File | grep -n "TRAIN" | awk -NF ':' '{print $1}'`
BeginLineNumbers=`cat $File | grep -n "BEGIN" | 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}'` Name=`cat $File | grep -n "BEGIN" | awk -NF '/' '{print $6_$4}'`
EndLineNumbers=`cat $File | grep -n "END" | awk -NF ':' '{print $1}'` EndLineNumbers=`cat $File | grep -n "END" | awk -NF ':' '{print $1}'`
@ -35,6 +36,7 @@ echo $BeginLineNumbers
echo $EndLineNumbers echo $EndLineNumbers
NameArray=($Name) NameArray=($Name)
TrainLineNumberArray=($TrainLineNumbers)
BeginLineNumberArray=($BeginLineNumbers) BeginLineNumberArray=($BeginLineNumbers)
EndLineNumberArray=($EndLineNumbers) EndLineNumberArray=($EndLineNumbers)
@ -43,8 +45,8 @@ Length=${#EndLineNumberArray[@]}
for i in $(seq 0 1 $((Length-1))) for i in $(seq 0 1 $((Length-1)))
do do
CurrName=${NameArray[$i]} CurrName=${NameArray[$i]}
CurrStart=$((${BeginLineNumberArray[$i]}+1)) CurrTrain=$((${TrainLineNumberArray[$i]}+1))
CurrEnd=$((${EndLineNumberArray[$i]}-1)) CurrEnd=$((${EndLineNumberArray[$i]}-1))
echo $CurrName, $CurrStart, $CurrEnd echo $CurrName, $CurrTrain, $CurrEnd
sed -n "${CurrStart},${CurrEnd}p" $File > branch/${CurrName}_branch.log sed -n "${CurrTrain},${CurrEnd}p" $File > branch/${CurrName}_branch.log
done done

View File

@ -545,12 +545,16 @@ logic [3:0] dummy;
int file; int file;
logic PCSrcM; logic PCSrcM;
string LogFile; 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); 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 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"); file = $fopen(LogFile, "w");
end end
always @(posedge clk) begin always @(posedge clk) begin
if(resetEdge) $fwrite(file, "TRAIN\n");
if(StartSample) $fwrite(file, "BEGIN %s\n", memfilename); if(StartSample) $fwrite(file, "BEGIN %s\n", memfilename);
if(dut.core.ifu.InstrClassM[0] & ~dut.core.StallW & ~dut.core.FlushW & dut.core.InstrValidM) begin if(dut.core.ifu.InstrClassM[0] & ~dut.core.StallW & ~dut.core.FlushW & dut.core.InstrValidM) begin
direction = PCSrcM ? "t" : "n"; direction = PCSrcM ? "t" : "n";