mcycle
Machine Cycle Counter
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.
Fields
COUNT
- Location
-
mcycle[63:0]
- Description
-
Cycle counter.
Aliased as cycle.
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 aliasinstretcfg.SINH
is set and the current privilege level is (H)S -
mcyclecfg.UINH
or its aliasinstretcfg.SINH
is set and the current privilege level is U -
mcyclecfg.VSINH
or its aliasinstretcfg.SINH
is set and the current privilege level is VS -
mcyclecfg.VUINH
or its aliasinstretcfg.SINH
is set and the current privilege level is VU
-
- Type
RW-RH |
Read-Write Restricted with Hardware update Field is writeable by software. Only certain values are legal. Writing an illegal value into the field is ignored, such that the field retains its prior state. Hardware also updates the field without an explicit software write.) |
- Reset value
-
UNDEFINED_LEGAL
- Software write
-
This field has special behavior when written by software (e.g., through csrrw).
When software tries to write
csr_value
, the field will be written with the return value of the function below.if (xlen() == 32) { return sw_write_mcycle({read_mcycle()[63:31], csr_value.COUNT[31:0]}); } else { return sw_write_mcycle(csr_value.COUNT); }