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.
Software write
This CSR may store a value that is different from what software attempts to write.
When a software write occurs (e.g., through csrrw), the following determines the written value:
COUNT = # since writes to this register may not be hart-local, it must be handled # as a special case if (xlen() == 32) { return sw_write_mcycle({read_mcycle()[63:31], csr_value.COUNT[31:0]}); } else { return sw_write_mcycle(csr_value.COUNT); }
Software read
This CSR may return a value that is different from what is stored in hardware.
return read_mcycle();