jbush001 / NyuziProcessor

GPGPU microprocessor architecture
Apache License 2.0
1.97k stars 349 forks source link

Real Time Clock #118

Open jbush001 opened 6 years ago

jbush001 commented 6 years ago

There is currently a libc function clock(). This is used, for example, in several apps to display frame rates. This calls get_cycle_count(), which uses the cycle count control register. On the emulator, get_cycle_count returns the number of instructions executed, so the timing is not accurate. I previously had modified the emulator to make the cycle count control register be based on real time and a simulated clock rate, but this breaks benchmarks.

I think the right solution is to create a set of device registers that return "wall clock" time. On hardware, this would be a dividing counter. On the emulator, it could map to a call to 'time' on the host platform.

jbush001 commented 6 years ago

This is an FPGA test harness improvement and is not part of Nyuzi proper.