Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monotonic clock #90

Open
whitequark opened this issue Jun 4, 2024 · 0 comments
Open

Monotonic clock #90

whitequark opened this issue Jun 4, 2024 · 0 comments
Assignees
Labels

Comments

@whitequark
Copy link
Member

whitequark commented Jun 4, 2024

It would be nice to have a peripheral that enables a CPU to measure time intervals and busy wait to delay. This peripheral would use the system clock as a reference, and has two registers:

  • Divider, which divides the system clock by an integer value where 0 is divide by 1, 1 is divide by 2, and so on. This register is R/W by the CPU.
  • Counter, which monotonically increments by 1 each time the divider counter overflows to 0. This register is R/O by the CPU.

The sizes of both registers/counters will be configurable as usual. The timer counter cannot be reset: this is a monotonic counter that only becomes lower than its previous value on natural (binary) overflow.

Proposed name: amaranth_soc.clock.MonotonicClock? Later we may add amaranth_soc.clock.RealtimeClock perhaps.

@whitequark whitequark changed the title Monotonic timer Monotonic clock Jun 4, 2024
@jfng jfng self-assigned this Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants