Added reporting of branches on the stat json files and improved the plotting script

This commit is contained in:
(Tim) Efthimis Kritikos 2023-05-21 02:59:53 +01:00
parent 3dd2ff59ea
commit e74d73ed58
3 changed files with 21 additions and 8 deletions

View File

@ -42,10 +42,14 @@ module processor (
/* STATISTICS */ ,output reg new_instruction
`endif
`ifdef OTUPUT_JSON_STATISTICS
/* */ ,output wire [`L1_CACHE_SIZE-1:0] L1_SIZE_STAT, output wire VALID_INSTRUCTION_STAT
/* */ ,output wire [`L1_CACHE_SIZE-1:0] L1_SIZE_STAT, output wire VALID_INSTRUCTION_STAT, output wire jump_req_debug
`endif
);
`ifdef OTUPUT_JSON_STATISTICS
assign jump_req_debug=biu_jump_req;
`endif
/* If there is an error either from the decoder or execution unit set it to ERROR */
assign ERROR=(DE_ERROR!=`ERR_NO_ERROR)?DE_ERROR:(EXEC_ERROR!=`ERR_NO_ERROR)?EXEC_ERROR:`ERR_NO_ERROR;

View File

@ -30,7 +30,7 @@ wire new_instruction;
`ifdef OTUPUT_JSON_STATISTICS
wire unsigned [`L1_CACHE_SIZE-1:0] L1_SIZE_STAT;
wire VALID_INSTRUCTION_STAT;
wire VALID_INSTRUCTION_STAT,jump_req;
`endif
processor p(
@ -40,7 +40,7 @@ processor p(
/* STATISTICS */ ,new_instruction
`endif
`ifdef OTUPUT_JSON_STATISTICS
/* */ ,L1_SIZE_STAT, VALID_INSTRUCTION_STAT
/* */ ,L1_SIZE_STAT, VALID_INSTRUCTION_STAT, jump_req
`endif
);
@ -81,7 +81,7 @@ end
reg first_json_cycle;
always @(negedge clock)begin
if(HALT==0 && json_file_descriptor!=0)begin
$fdisplay(json_file_descriptor,"%s{\"C\":%0d,\"L1\":%0d,\"VDI\":%0d}",first_json_cycle?"":",",cycles,L1_SIZE_STAT,VALID_INSTRUCTION_STAT);
$fdisplay(json_file_descriptor,"%s{\"C\":%0d,\"L1\":%0d,\"VDI\":%0d,\"JMP\":%0d}",first_json_cycle?"":",",cycles,L1_SIZE_STAT,VALID_INSTRUCTION_STAT,jump_req);
first_json_cycle <= 0;
end
end

View File

@ -18,7 +18,7 @@ CSV_FILE=$(mktemp)
IN=$1
OUT=$3
jq -r '.Cycles[]| [.C,.L1,.VDI]|@csv' -- "$IN" > "$CSV_FILE"
jq -r '.Cycles[]| [.C,.L1,.VDI,.JMP]|@csv' -- "$IN" > "$CSV_FILE"
BASE_GNUPLOT_OPTIONS="set datafile separator ',';set term svg;set output \"${OUT}\";"
@ -26,21 +26,30 @@ parse_cache_size(){
CACHE_SIZE=$(jq -r .L1_size -- "$IN")
}
parse_total_cycles(){
TOTAL_CYCLES=$(jq -r .\"Total\ Cycles\" -- "$IN")
}
case "$2" in
"cache_time")
parse_cache_size
parse_total_cycles
gnuplot -e "${BASE_GNUPLOT_OPTIONS}\
set xlabel \"Clock cycles\";\
set ylabel \"Cache utilisation (bytes)\";\
set offsets 0, 0, 3, 1;\
set ytics 0,1,$((CACHE_SIZE-1));\
set xtics 0,$((TOTAL_CYCLES/15)),${TOTAL_CYCLES};\
unset colorbox;\
set ytics add (\"Valid\" -1);\
set grid ytics;\
set yrange [-2:${CACHE_SIZE}];\
set palette model RGB defined ( 0 'red', 1 'green' );\
plot '${CSV_FILE}' using 1:2 with histeps notitle ,\
'${CSV_FILE}' using 1:(-0.75):(0):(-0.5):3 with vectors nohead palette notitle"
set palette model RGB defined ( 0 'red', 1 'green', 2 'dark-khaki' );\
plot\
'${CSV_FILE}' using 1:(-2):(0):("'$'"4*100):(2) with vectors nohead palette notitle,\
'${CSV_FILE}' using 1:2 with histeps notitle ls 1,\
'${CSV_FILE}' using 1:(-0.75):(0):(-0.5):3 with vectors nohead palette notitle \
"
;;
"cache_util_freq")