riscv / riscv-platform-specs

RISC-V Profiles and Platform Specification
Creative Commons Attribution 4.0 International
112 stars 38 forks source link

Inconsistent mtime requirements #38

Open jrtc27 opened 2 years ago

jrtc27 commented 2 years ago

Currently the spec says:

  • Platforms are required to provide an at least 10ns resolution 64-bit counter with strictly monotonic updates.

  • The hardware clock that drives the counter is required to operate at a minimum frequency of 10MHz.

but also:

For a counter with 10ns resolution the timebase-frequency value would be 100000000 (100 MHz) which would also be the minimum possible value for timebase-frequency. From the software perspective a unit increment of the mtime value would correspond to a 10ns interval. However the hardware clock driving the counter could operate at a lower frequency, thereby incrementing the mtime value by more than one unit per clock tick.

These are all contradictory; a 10MHz clock doesn't give a resolution of 10ns, and similarly if the clock is at a lower frequency than timebase-frequency, with the latter still reporting 100 MHz, and steps multiple values at a time then you're not going to have a resolution of 10ns since you never see an individual step.

kumarsankaran commented 2 years ago

@jrtc27 Is this issue still there in the latest spec version? The timer requirements have been modified.