mcycle
Machine cycle counter
- Address
0xB00- Group
- Machine-level CSRs
- Privilege
MRW(privileged spec CSR listing, Machine Counter/Timers)- Access
- read/write; lowest privilege M (machine)
- Address range
- Standard read/write
- Name in riscv-unified-db
- Machine Cycle Counter
Privileged spec: Machine cycle counter
Description
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.
From riscv-unified-db, reformatted.
Fields
| Field | Bits | Type | Description |
|---|---|---|---|
COUNT | 63-0 | RW-RH | Cycle counter. When Zicntr is implemented: Aliased as Increments every cycle unless:
When Smcntrpmf is implemented:
When S is implemented:
When U is implemented:
When H is implemented:
|
Fields from riscv-unified-db; field types computed by IDL functions there are not shown.
Specification and related pages
- The RISC-V Instruction Set Manual, Volume II: CSR listing (src/priv/csrs.adoc)
- riscv-opcodes csrs.csv
- riscv-unified-db: spec/std/isa/csr/mcycle.yaml
- csrrw, csrrs, csrrc (Zicsr instructions that access CSRs)