forked from Github_Repos/cvw
Added code to print out performance counters at end of each test.
This commit is contained in:
parent
78e441fb38
commit
09bb733088
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user