Skip to content

Monotonic clock #90

Open
Open
@whitequark

Description

@whitequark

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions