Compare commits

...

2 Commits

4 changed files with 21 additions and 13 deletions

View File

@ -1,5 +1,4 @@
.ORG 0x0100 .ORG 0x0100
mov sp,#STACK
MOV DI,#0x2000 MOV DI,#0x2000
STOS STOS
STOS STOS
@ -29,10 +28,6 @@ MOV CX,#0x0000
MOV CX,#0x0000 MOV CX,#0x0000
HLT HLT
NOTHING: ret
.BLKB 200
STACK:
.ORG 0xFFF0 .ORG 0xFFF0
MOV AX,#0x0100 MOV AX,#0x0100
JMP AX JMP AX

View File

@ -42,10 +42,14 @@ module processor (
/* STATISTICS */ ,output reg new_instruction /* STATISTICS */ ,output reg new_instruction
`endif `endif
`ifdef OTUPUT_JSON_STATISTICS `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 `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 */ /* 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; 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 `ifdef OTUPUT_JSON_STATISTICS
wire unsigned [`L1_CACHE_SIZE-1:0] L1_SIZE_STAT; wire unsigned [`L1_CACHE_SIZE-1:0] L1_SIZE_STAT;
wire VALID_INSTRUCTION_STAT; wire VALID_INSTRUCTION_STAT,jump_req;
`endif `endif
processor p( processor p(
@ -40,7 +40,7 @@ processor p(
/* STATISTICS */ ,new_instruction /* STATISTICS */ ,new_instruction
`endif `endif
`ifdef OTUPUT_JSON_STATISTICS `ifdef OTUPUT_JSON_STATISTICS
/* */ ,L1_SIZE_STAT, VALID_INSTRUCTION_STAT /* */ ,L1_SIZE_STAT, VALID_INSTRUCTION_STAT, jump_req
`endif `endif
); );
@ -81,7 +81,7 @@ end
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(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; first_json_cycle <= 0;
end end
end end

View File

@ -18,7 +18,7 @@ CSV_FILE=$(mktemp)
IN=$1 IN=$1
OUT=$3 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}\";" 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") CACHE_SIZE=$(jq -r .L1_size -- "$IN")
} }
parse_total_cycles(){
TOTAL_CYCLES=$(jq -r .\"Total\ Cycles\" -- "$IN")
}
case "$2" in case "$2" in
"cache_time") "cache_time")
parse_cache_size parse_cache_size
parse_total_cycles
gnuplot -e "${BASE_GNUPLOT_OPTIONS}\ gnuplot -e "${BASE_GNUPLOT_OPTIONS}\
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;\
set ytics 0,1,$((CACHE_SIZE-1));\ set ytics 0,1,$((CACHE_SIZE-1));\
set xtics 0,$((TOTAL_CYCLES/15)),${TOTAL_CYCLES};\
unset colorbox;\ 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 palette model RGB defined ( 0 'red', 1 'green' );\ set palette model RGB defined ( 0 'red', 1 'green', 2 'dark-khaki' );\
plot '${CSV_FILE}' using 1:2 with histeps notitle ,\ plot\
'${CSV_FILE}' using 1:(-0.75):(0):(-0.5):3 with vectors nohead palette notitle" '${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") "cache_util_freq")