From bf08c57ab077eedf661cc7fe3afba8604a8e32f7 Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Sat, 7 Jan 2023 13:16:57 -0600 Subject: [PATCH] Added branch outcome logger to testbench --- pipelined/testbench/testbench.sv | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pipelined/testbench/testbench.sv b/pipelined/testbench/testbench.sv index f663421b..71f1806a 100644 --- a/pipelined/testbench/testbench.sv +++ b/pipelined/testbench/testbench.sv @@ -33,6 +33,7 @@ `include "tests.vh" `define PrintHPMCounters 0 +`define BPRED_LOGGER 1 module testbench; parameter DEBUG=0; @@ -475,6 +476,19 @@ logic [3:0] dummy; release dut.core.ifu.bpred.bpred.TargetPredictor.memory.mem[adrindex]; end end + + if (`BPRED_LOGGER) begin + string direction; + int file; + initial + file = $fopen("branch.log", "w"); + always @(posedge clk) begin + if(dut.core.ifu.InstrClassM[0] & ~dut.core.StallW & ~dut.core.FlushW & dut.core.InstrValidM) begin + direction = dut.core.ifu.bpred.bpred.Predictor.DirPredictor.PCSrcM ? "t" : "n"; + $fwrite(file, "%h %s\n", dut.core.PCM, direction); + end + end + end end // check for hange up.