micro-FPGA / riscv-contest-2018

RISCV SoftCPU Contest 2018
Apache License 2.0
14 stars 4 forks source link

dhrystone, what files have to be used? Negative benchmark value possible.. #6

Closed AnttiLukats closed 5 years ago

AnttiLukats commented 5 years ago

contest rules say that dhrystone from this github url must be used https://github.com/riscv/riscv-tests/tree/master/benchmarks/dhrystone there are 3 files, and we must assume those files can not be modified to comply with the rules.

Those files will calculate benchmark as

Dhrystones_Per_Second = (HZ * Number_Of_Runs) / User_Time;

Where User_Time is mcycle CSR difference, so it is read from counter that runs and CPU clock speed, so it obvious we must define HZ equal to clock CPU frequency. This can be done in util.h (so we do not need to modify the benchmark sources)

problem is dhrystone result will then be NEGATIVE number.. nonsense!

AnttiLukats commented 5 years ago

a fix would be to rewrite the calc in dhrystone_main.c as

Dhrystones_Per_Second = HZ/User_Time * Number_Of_Runs;

but that means we actually modify the benchmark source code :(

AnttiLukats commented 5 years ago

Another fix is to define the HZ as 50000000LL this approuch would leavel the benchmark source files untouched with the side effect that resulting binary is about 2Kbyte larger