← Home

mcycle

Machine Cycle Counter

Address: 0xB00 (2816) · Privilege: M · Length: 64 · Writable · Defined by: Sm · Indirect address: 64 · Indirect slot: 1

Counts the number of clock cycles executed by the processor core on which the hart is running. The counter has 64-bit precision on all RV32 and RV64 harts.

The `mcycle` CSR may be shared between harts on the same core, in which case writes to `mcycle` will be visible to those harts. The platform should provide a mechanism to indicate which harts share an `mcycle` CSR.

Fields

63:5655:4847:4039:3231:2423:1615:87:0
COUNT
BitsFieldAliasDescriptionTypeReset
[63:0]COUNT['cycle.COUNT']Cycle counter. Aliased as `cycle.COUNT`. Increments every cycle unless: * `mcountinhibit.CY` or its alias `scountinhibit.CY` is set * `mcyclecfg.MINH` is set and the current privilege level is M * `mcyclecfg.SINH` or its alias `cyclecfg.SINH` is set and the current privilege level is (H)S * `mcyclecfg.UINH` or its alias `cyclecfg.UINH` is set and the current privilege level is U * `mcyclecfg.VSINH` or its alias `cyclecfg.VSINH` is set and the current privilege level is VS * `mcyclecfg.VUINH` or its alias `cyclecfg.VUINH` is set and the current privilege level is VU RW-RHUNDEFINED_LEGAL

Software read

# since the counter may be shared among harts, reads must be handled
# as a builtin function
return read_mcycle();

Version af3eaf9+cheriot.f635218

Data from the RISC-V Unified Database, copyright RISC-V International and contributors.

CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.

This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.