Webcentive RISC-V Reference

minstret

Machine instructions-retired counter

Address
0xB02
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 Instructions Retired Counter

Privileged spec: Machine instructions-retired counter

Description

Counts the number of instructions retired by this hart from some arbitrary start point in the past.

Note: Instructions that cause synchronous exceptions, including ecall and ebreak, are not considered to retire and hence do not increment the minstret CSR.

From riscv-unified-db, reformatted.

Fields

FieldBitsTypeDescription
COUNT63-0RW-H

Instructions retired counter.

When Zicntr is implemented:

Aliased as instret.COUNT.

Increments every time an instruction retires unless:

  • mcountinhibit.IR (when Smcdeleg is implemented: or its alias scountinhibit.IR) is set

When Smcntrpmf is implemented:

  • minstretcfg.MINH is set and the current privilege level is M

When S is implemented:

  • minstretcfg.SINH (when Ssccfg is implemented: or its alias instretcfg.SINH) is set and the current privilege level is (H)S

When U is implemented:

  • minstretcfg.UINH (when Ssccfg is implemented: or its alias instretcfg.UINH) is set and the current privilege level is U

When H is implemented:

  • minstretcfg.VSINH (when Ssccfg is implemented: or its alias instretcfg.VSINH) is set and the current privilege level is VS
  • minstretcfg.VUINH (when Ssccfg is implemented: or its alias instretcfg.VUINH) is set and the current privilege level is VU

An instruction that causes an exception, notably including MRET/SRET, does not retire and does not cause minstret.COUNT to increment.

Fields from riscv-unified-db; field types computed by IDL functions there are not shown.

Specification and related pages