commit ehedenberg coremark

This commit is contained in:
Elizabeth Hedenberg 2021-05-17 18:00:47 -04:00
parent 9d17950c1d
commit 853c9243c1
3 changed files with 62 additions and 148 deletions

View File

@ -158,19 +158,22 @@ ee_u16 core_bench_list(core_results *res, ee_s16 finder_idx) {
list_head *finder, *remover;
list_data info;
ee_s16 i;
ee_printf("entered corebenchlist \n");
info.idx=finder_idx;
/* find <find_num> values in the list, and change the list each time (reverse and cache if value found) */
for (i=0; i<find_num; i++) {
ee_printf("for loop \n");
info.data16= (i & 0xff) ;
this_find=core_list_find(list,&info);
list=core_list_reverse(list);
if (this_find==NULL) {
missed++;
retval+=(list->next->info->data16 >> 8) & 1;
ee_printf("if statement \n");
}
else {
found++;
ee_printf("else statement \n");
if (this_find->info->data16 & 0x1) /* use found value */
retval+=(this_find->info->data16 >> 9) & 1;
/* and cache next item at the head of the list (if any) */
@ -421,13 +424,20 @@ list_head *core_list_undo_remove(list_head *item_removed, list_head *item_modifi
Found item, or NULL if not found.
*/
list_head *core_list_find(list_head *list,list_data *info) {
ee_printf("entered core_list_find \n");
if (info->idx>=0) {
while (list && (list->info->idx != info->idx))
ee_printf("find if \n");
while (list && (list->info->idx != info->idx)){
list=list->next;
ee_printf("find while if \n");}
ee_printf("core_list_find end \n");
return list;
} else {
while (list && ((list->info->data16 & 0xff) != info->data16))
ee_printf("find else");
while (list && ((list->info->data16 & 0xff) != info->data16)){
list=list->next;
ee_printf("find while else \n");}
ee_printf("core list find end \n");
return list;
}
}
@ -446,6 +456,7 @@ list_head *core_list_find(list_head *list,list_data *info) {
*/
list_head *core_list_reverse(list_head *list) {
ee_printf("entered core_list_reverse");
list_head *next=NULL, *tmp;
while (list) {
tmp=list->next;
@ -453,6 +464,7 @@ list_head *core_list_reverse(list_head *list) {
next=list;
list=tmp;
}
ee_printf("core_list_reverse done");
return next;
}
/* Function: core_list_mergesort
@ -481,20 +493,27 @@ list_head *core_list_mergesort(list_head *list, list_cmp cmp, core_results *res)
ee_s32 insize, nmerges, psize, qsize, i;
insize = 1;
char bufftwo[200];
while (1) {
p = list;
list = NULL;
tail = NULL;
nmerges = 0; /* count number of merges we do in this pass */
ehitoa(nmerges, bufftwo, 10);
ee_printf(" nmerges default value = %s done \n", bufftwo);
while (p) {
nmerges++; /* there exists a merge to be done */
ehitoa(nmerges, bufftwo, 10);
ee_printf(" current nmerges = %s done \n", bufftwo);
/* step `insize' places along from p */
q = p;
psize = 0;
ehitoa(insize, bufftwo, 10);
ee_printf(" insize = %s done \n", bufftwo);
for (i = 0; i < insize; i++) {
ehitoa(i, bufftwo, 10);
ee_printf(" i = %s done \n", bufftwo);
psize++;
q = q->next;
if (!q) break;
@ -502,29 +521,37 @@ list_head *core_list_mergesort(list_head *list, list_cmp cmp, core_results *res)
/* if q hasn't fallen off end, we have two lists to merge */
qsize = insize;
ehitoa(qsize, bufftwo, 10);
ee_printf(" qsize = %s done \n", bufftwo);
/* now we have two lists; merge them */
while (psize > 0 || (qsize > 0 && q)) {
/* decide whether next element of merge comes from p or q */
if (psize == 0) {
ee_printf("if \n");
/* p is empty; e must come from q. */
e = q; q = q->next; qsize--;
} else if (qsize == 0 || !q) {
ee_printf("else if \n");
/* q is empty; e must come from p. */
e = p; p = p->next; psize--;
} else if (cmp(p->info,q->info,res) <= 0) {
ee_printf("else if 2 \n");
/* First element of p is lower (or same); e must come from p. */
e = p; p = p->next; psize--;
} else {
ee_printf("else \n");
/* First element of q is lower; e must come from q. */
e = q; q = q->next; qsize--;
}
/* add the next element to the merged list */
if (tail) {
ee_printf("tail if \n");
tail->next = e;
} else {
ee_printf("tail else \n");
list = e;
}
tail = e;
@ -542,6 +569,8 @@ list_head *core_list_mergesort(list_head *list, list_cmp cmp, core_results *res)
/* Otherwise repeat, merging lists twice the size */
insize *= 2;
ehitoa(insize, bufftwo, 10);
ee_printf(" insize2 = %s done \n", bufftwo);
}
#if COMPILER_REQUIRES_SORT_RETURN
return list;

View File

@ -286,17 +286,17 @@ MAIN_RETURN_TYPE main(int argc, char *argv[]) {
results[i].err=0;
if ((results[i].execs & ID_LIST) &&
(results[i].crclist!=list_known_crc[known_id])) {
sendstring("[%u]ERROR! list crc 0x%04x - should be 0x%04x\n,i,results[i].crclist,list_known_crc[known_id]");
ee_printf("[%u]ERROR! list crc 0x%04x - should be 0x%04x\n,i,results[i].crclist,list_known_crc[known_id]");
results[i].err++;
}
if ((results[i].execs & ID_MATRIX) &&
(results[i].crcmatrix!=matrix_known_crc[known_id])) {
sendstring("[%u]ERROR! matrix crc 0x%04x - should be 0x%04x\n,i,results[i].crcmatrix,matrix_known_crc[known_id]");
ee_printf("[%u]ERROR! matrix crc 0x%04x - should be 0x%04x\n,i,results[i].crcmatrix,matrix_known_crc[known_id]");
results[i].err++;
}
if ((results[i].execs & ID_STATE) &&
(results[i].crcstate!=state_known_crc[known_id])) {
sendstring("[%u]ERROR! state crc 0x%04x - should be 0x%04x\n,i,results[i].crcstate,state_known_crc[known_id]");
ee_printf("[%u]ERROR! state crc 0x%04x - should be 0x%04x\n,i,results[i].crcstate,state_known_crc[known_id]");
results[i].err++;
}
total_errors+=results[i].err;
@ -305,64 +305,64 @@ MAIN_RETURN_TYPE main(int argc, char *argv[]) {
total_errors+=check_data_types();
/* and report results */
//ee_printf("CoreMark Size : %lu\n", (long unsigned) results[0].size);
sendstring("CoreMark Size : %lu\n, (long unsigned) results[0].size");
sendstring("Total ticks : %lu\n, (long unsigned) total_time");
ee_printf("CoreMark Size : %lu\n, (long unsigned) results[0].size");
ee_printf("Total ticks : %lu\n, (long unsigned) total_time");
#if HAS_FLOAT
sendstring("Total time (secs): %f\n,time_in_secs(total_time)");
ee_printf("Total time (secs): %f\n,time_in_secs(total_time)");
if (time_in_secs(total_time) > 0)
sendstring("Iterations/Sec : %f\n,default_num_contexts*results[0].iterations/time_in_secs(total_time)");
ee_printf("Iterations/Sec : %f\n,default_num_contexts*results[0].iterations/time_in_secs(total_time)");
#else
sendstring("Total time (secs): %d\n,time_in_secs(total_time)");
ee_printf("Total time (secs): %d\n,time_in_secs(total_time)");
if (time_in_secs(total_time) > 0)
sendstring("Iterations/Sec : %d\n,default_num_contexts*results[0].iterations/time_in_secs(total_time)");
ee_printf("Iterations/Sec : %d\n,default_num_contexts*results[0].iterations/time_in_secs(total_time)");
#endif
if (time_in_secs(total_time) < 10) {
sendstring("ERROR! Must execute for at least 10 secs for a valid result!\n");
ee_printf("ERROR! Must execute for at least 10 secs for a valid result!\n");
total_errors++;
}
sendstring("Iterations : %lu\n, (long unsigned) default_num_contexts*results[0].iterations");
sendstring("Compiler version : %s\n,COMPILER_VERSION");
sendstring("Compiler flags : %s\n,COMPILER_FLAGS");
ee_printf("Iterations : %lu\n, (long unsigned) default_num_contexts*results[0].iterations");
ee_printf("Compiler version : %s\n,COMPILER_VERSION");
ee_printf("Compiler flags : %s\n,COMPILER_FLAGS");
#if (MULTITHREAD>1)
sendstring("Parallel %s : %d\n,PARALLEL_METHOD,default_num_contexts");
ee_printf("Parallel %s : %d\n,PARALLEL_METHOD,default_num_contexts");
#endif
sendstring("Memory location : %s\n,MEM_LOCATION");
ee_printf("Memory location : %s\n,MEM_LOCATION");
/* output for verification */
sendstring("seedcrc : 0x%04x\n,seedcrc");
ee_printf("seedcrc : 0x%04x\n,seedcrc");
if (results[0].execs & ID_LIST)
for (i=0 ; i<default_num_contexts; i++)
sendstring("[%d]crclist : 0x%04x\n,i,results[i].crclist");
ee_printf("[%d]crclist : 0x%04x\n,i,results[i].crclist");
if (results[0].execs & ID_MATRIX)
for (i=0 ; i<default_num_contexts; i++)
sendstring("[%d]crcmatrix : 0x%04x\n,i,results[i].crcmatrix");
ee_printf("[%d]crcmatrix : 0x%04x\n,i,results[i].crcmatrix");
if (results[0].execs & ID_STATE)
for (i=0 ; i<default_num_contexts; i++)
sendstring("[%d]crcstate : 0x%04x\n,i,results[i].crcstate");
ee_printf("[%d]crcstate : 0x%04x\n,i,results[i].crcstate");
for (i=0 ; i<default_num_contexts; i++)
sendstring("[%d]crcfinal : 0x%04x\n,i,results[i].crc");
ee_printf("[%d]crcfinal : 0x%04x\n,i,results[i].crc");
if (total_errors==0) {
sendstring("Correct operation validated. See README.md for run and reporting rules.\n");
ee_printf("Correct operation validated. See README.md for run and reporting rules.\n");
#if HAS_FLOAT
if (known_id==3) {
sendstring("CoreMark 1.0 : %f / %s %s,default_num_contexts*results[0].iterations/time_in_secs(total_time),COMPILER_VERSION,COMPILER_FLAGS");
ee_printf("CoreMark 1.0 : %f / %s %s,default_num_contexts*results[0].iterations/time_in_secs(total_time),COMPILER_VERSION,COMPILER_FLAGS");
#if defined(MEM_LOCATION) && !defined(MEM_LOCATION_UNSPEC)
sendstring(" / %s,MEM_LOCATION");
ee_printf(" / %s,MEM_LOCATION");
#else
sendstring(" / %s,mem_name[MEM_METHOD]");
ee_printf(" / %s,mem_name[MEM_METHOD]");
#endif
#if (MULTITHREAD>1)
sendstring(" / %d:%s,default_num_contexts,PARALLEL_METHOD");
ee_printf(" / %d:%s,default_num_contexts,PARALLEL_METHOD");
#endif
sendstring("\n");
ee_printf("\n");
}
#endif
}
if (total_errors>0)
sendstring("Errors detected\n");
ee_printf("Errors detected\n");
if (total_errors<0)
sendstring("Cannot validate operation for these seed values, please compare with results on a known platform.\n");
ee_printf("Cannot validate operation for these seed values, please compare with results on a known platform.\n");
#if (MEM_METHOD==MEM_MALLOC)
for (i=0 ; i<MULTITHREAD; i++)

View File

@ -1,115 +0,0 @@
# wally-coremark.do
#
# Modification by Oklahoma State University & Harvey Mudd College
# Use with Testbench
# James Stine, 2008; David Harris 2021
# Go Cowboys!!!!!!
#
# Takes 1:10 to run RV64IC tests using gui
# Use this wally-coremark.do file to run this example.
# Either bring up ModelSim and type the following at the "ModelSim>" prompt:
# do wally-coremark.do
# or, to run from a shell, type the following at the shell prompt:
# vsim -do wally-coremark.do -c
# (omit the "-c" to see the GUI while running from the shell)
onbreak {resume}
# create library
if [file exists work] {
vdel -all
}
vlib work
# compile source files
# suppress spurious warnngs about
# "Extra checking for conflicts with always_comb done at vopt time"
# because vsim will run vopt
# default to config/coremark, but allow this to be overridden at the command line. For example:
vlog +incdir+../config/coremark ../testbench/testbench-coremark.sv ../src/*/*.sv -suppress 2583
# start and run simulation
# remove +acc flag for faster sim during regressions if there is no need to access internal signals
vopt +acc work.testbench -o workopt
vsim workopt
view wave
-- display input and output signals as hexidecimal values
# Diplays All Signals recursively
add wave /testbench/clk
add wave /testbench/reset
add wave -divider
#add wave /testbench/dut/hart/ebu/IReadF
#add wave /testbench/dut/hart/DataStall
#add wave /testbench/dut/hart/InstrStall
#add wave /testbench/dut/hart/StallF
#add wave /testbench/dut/hart/StallD
#add wave /testbench/dut/hart/FlushD
#add wave /testbench/dut/hart/FlushE
#add wave /testbench/dut/hart/FlushM
#add wave /testbench/dut/hart/FlushW
add wave -divider Fetch
add wave -hex /testbench/dut/hart/ifu/PCF
add wave -hex /testbench/dut/hart/ifu/InstrF
add wave /testbench/InstrFName
add wave -divider Decode
add wave -hex /testbench/dut/hart/ifu/PCD
add wave -hex /testbench/dut/hart/ifu/InstrD
add wave /testbench/InstrDName
add wave -divider Execute
add wave -hex /testbench/dut/hart/ifu/PCE
add wave -hex /testbench/dut/hart/ifu/InstrE
add wave /testbench/InstrEName
add wave -divider Memory
add wave -hex /testbench/dut/hart/ifu/PCM
add wave -hex /testbench/dut/hart/ifu/InstrM
add wave /testbench/InstrMName
add wave -divider Write
add wave -hex /testbench/PCW
add wave -hex /testbench/InstrW
add wave /testbench/InstrWName
#add wave -hex /testbench/dut/hart/ieu/dp/SrcAE
#add wave -hex /testbench/dut/hart/ieu/dp/SrcBE
#add wave -hex /testbench/dut/hart/ieu/dp/ALUResultE
#add wave /testbench/dut/hart/ieu/dp/PCSrcE
add wave -divider Regfile_signals
#add wave /testbench/dut/uncore/dtim/memwrite
#add wave -hex /testbench/dut/uncore/HADDR
#add wave -hex /testbench/dut/uncore/HWDATA
#add wave -divider
#add wave -hex /testbench/PCW
#add wave /testbench/InstrWName
#add wave /testbench/dut/hart/ieu/dp/RegWriteW
#add wave -hex /testbench/dut/hart/ieu/dp/ResultW
#add wave -hex /testbench/dut/hart/ieu/dp/RdW
add wave -hex -r /testbench/dut/hart/ieu/dp/regf/*
add wave -divider Regfile_itself
add wave -hex -r /testbench/dut/hart/ieu/dp/regf/rf
add wave -divider RAM
add wave -hex -r /testbench/dut/uncore/dtim/RAM
add wave -divider Misc
add wave -divider
#add wave -hex -r /testbench/*
-- Set Wave Output Items
TreeUpdate [SetDefaultTree]
WaveRestoreZoom {0 ps} {100 ps}
configure wave -namecolwidth 250
configure wave -valuecolwidth 120
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
set DefaultRadix hexadecimal
-- Run the Simulation
#run 7402000
#run 10500
run -all
#quit