Fixed small bug with json data reporting and improved slightly the graphs

This commit is contained in:
(Tim) Efthimis Kritikos 2023-10-30 08:00:09 +00:00
parent cfed0b4117
commit 8a62b89a13
2 changed files with 15 additions and 4 deletions

View File

@ -81,7 +81,7 @@ end
`ifdef OTUPUT_JSON_STATISTICS `ifdef OTUPUT_JSON_STATISTICS
reg first_json_cycle; reg first_json_cycle;
always @(negedge clock)begin always @(negedge clock)begin
if(HALT==0 && json_file_descriptor!=0)begin if(finish < 2 && json_file_descriptor!=0)begin
$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); $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; first_json_cycle <= 0;
end end
@ -110,6 +110,9 @@ always @(posedge HALT) begin
finish<=2'd1; finish<=2'd1;
end end
`ifdef OTUPUT_JSON_STATISTICS
reg [128:0] instruction_count_temp;
`endif
always @(posedge clock) begin always @(posedge clock) begin
/* Allow some clock cycles for the waveform*/ /* Allow some clock cycles for the waveform*/
case(finish) case(finish)
@ -124,11 +127,16 @@ always @(posedge clock) begin
/* verilator lint_on REALCVT */ /* verilator lint_on REALCVT */
`endif `endif
`ifdef OTUPUT_JSON_STATISTICS `ifdef OTUPUT_JSON_STATISTICS
if(json_file_descriptor!=0) instruction_count_temp <= instruction_count;
$fdisplay(json_file_descriptor,"],\n\"Total Cycles\":%0d,\n\"Instructions run\":%0d\n}",cycles,instruction_count); `endif
end
2'd2: begin
finish <= 3;
`ifdef OTUPUT_JSON_STATISTICS
if(json_file_descriptor!=0)
$fdisplay(json_file_descriptor,"],\n\"Total Cycles\":%0d,\n\"Instructions run\":%0d\n}",cycles-1,instruction_count_temp);
`endif `endif
end end
2'd2: finish <= 3;
2'd3: $finish; 2'd3: $finish;
endcase endcase
end end

View File

@ -35,6 +35,7 @@ case "$2" in
parse_cache_size parse_cache_size
parse_total_cycles parse_total_cycles
gnuplot -e "${BASE_GNUPLOT_OPTIONS}\ gnuplot -e "${BASE_GNUPLOT_OPTIONS}\
set term svg name \"Cache_time\";\
set xlabel \"Clock cycles\";\ set xlabel \"Clock cycles\";\
set ylabel \"Cache utilisation (bytes)\";\ set ylabel \"Cache utilisation (bytes)\";\
set offsets 0, 0, 3, 1;\ set offsets 0, 0, 3, 1;\
@ -44,6 +45,7 @@ unset colorbox;\
set ytics add (\"Valid\" -1);\ set ytics add (\"Valid\" -1);\
set grid ytics;\ set grid ytics;\
set yrange [-2:${CACHE_SIZE}];\ set yrange [-2:${CACHE_SIZE}];\
set xrange [-10:${TOTAL_CYCLES}+9];\
set palette model RGB defined ( 0 'red', 1 'green', 2 'dark-khaki' );\ set palette model RGB defined ( 0 'red', 1 'green', 2 'dark-khaki' );\
plot\ plot\
'${CSV_FILE}' using 1:(-2):(0):("'$'"4*100):(2) with vectors nohead palette notitle,\ '${CSV_FILE}' using 1:(-2):(0):("'$'"4*100):(2) with vectors nohead palette notitle,\
@ -55,6 +57,7 @@ plot\
"cache_util_freq") "cache_util_freq")
parse_cache_size parse_cache_size
gnuplot -e "${BASE_GNUPLOT_OPTIONS}\ gnuplot -e "${BASE_GNUPLOT_OPTIONS}\
set term svg name \"cache_util_freq\";\
set xlabel \"Utilisation (bytes)\";\ set xlabel \"Utilisation (bytes)\";\
set ylabel \"Occurrences\";\ set ylabel \"Occurrences\";\
set boxwidth 0.5;\ set boxwidth 0.5;\