mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Added code to print out performance counters at end of each test.
This commit is contained in:
parent
e34f80db2f
commit
cd17d296d2
@ -32,6 +32,8 @@
|
|||||||
`include "wally-config.vh"
|
`include "wally-config.vh"
|
||||||
`include "tests.vh"
|
`include "tests.vh"
|
||||||
|
|
||||||
|
`define PrintHPMCounters 0
|
||||||
|
|
||||||
module testbench;
|
module testbench;
|
||||||
parameter DEBUG=0;
|
parameter DEBUG=0;
|
||||||
parameter TEST="none";
|
parameter TEST="none";
|
||||||
@ -401,6 +403,34 @@ logic [3:0] dummy;
|
|||||||
end
|
end
|
||||||
end // always @ (negedge clk)
|
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
|
// track the current function or global label
|
||||||
if (DEBUG == 1) begin : FunctionName
|
if (DEBUG == 1) begin : FunctionName
|
||||||
FunctionName FunctionName(.reset(reset),
|
FunctionName FunctionName(.reset(reset),
|
||||||
|
Loading…
Reference in New Issue
Block a user