Added code to print out performance counters at end of each test.

This commit is contained in:
Ross Thompson 2023-01-05 18:00:11 -06:00
parent 78e441fb38
commit 09bb733088

View File

@ -32,6 +32,8 @@
`include "wally-config.vh"
`include "tests.vh"
`define PrintHPMCounters 0
module testbench;
parameter DEBUG=0;
parameter TEST="none";
@ -401,6 +403,34 @@ logic [3:0] dummy;
end
end // always @ (negedge clk)
if(`PrintHPMCounters) begin
integer HPMCindex;
string HPMCnames[] = '{"Mcycle",
"------",
"InstRet",
"Load Stall",
"Br Dir Wrong",
"Br Count",
"Br Target Wrong",
"Jump, JR, ret",
"RAS Wrong",
"ret",
"Instr Class Wrong",
"D Cache Access",
"D Cache Miss",
"I Cache Access",
"I Cache Miss"};
always @(negedge clk) begin
if(DCacheFlushStart & ~DCacheFlushDone) begin
for(HPMCindex = 0; HPMCindex < HPMCnames.size(); HPMCindex += 1) begin
// unlikely to have more than 10M in any counter.
$display("Cnt[%2d] = %7d %s", HPMCindex, dut.core.priv.priv.csr.counters.counters.HPMCOUNTER_REGW[HPMCindex], HPMCnames[HPMCindex]);
end
end
end
end
// track the current function or global label
if (DEBUG == 1) begin : FunctionName
FunctionName FunctionName(.reset(reset),