Closed mchack-work closed 1 year ago
Currently off by a prescaler cycle from real hardware. Qemu:
% ./cmd/runtimer/runtimer --port /dev/pts/16 --speed 1000000 --timer 10 --prescaler 18000000
Timer expired after 10.010400653 seconds
Real hardware:
Timer expired after 10.973372394 seconds
I could run and reproduce this, both on qemu (i've merged the support!) and hw. The --speed 1000000
was for some local test though i suppose
Real hardware has now changed to work like the qemu model. Setting --timer 1 --prescaler 18000000
finishes in ~1 second. A prescaler of 36 million doubles it.
Merged on the side.
Add a timer emulation.
The real timer has two counters: timer and prescaler. The prescaler ticks down to 0 every clock cycle (18 MHz, 55 ns). We don't emulate that. Instead we sleep until the next real timer tick.
Closes #2