CSR Bit Fields

RISC-V mhpmcounter29 CSR Register

Address 0xB1DPrivilege MachineAccess RW / up to 64-bit precisionMachine counters and performance-monitoring CSRs

mhpmcounter29 at 0xB1D is machine hardware performance-monitor counter 29, a WARL counter with up to 64 bits of precision for the platform-defined event selected by mhpmevent29.

Field Map

Understand mhpmcounter29 By Bit Fields

1 key fields
63:0

COUNT

RW

On RV64 only, reads and writes the complete Machine HPM count for the platform-defined event selected by mhpmevent29; this WARL counter supports up to 64 bits of precision.

COUNT (bits 63:0) — On RV64 only, reads and writes the complete Machine HPM count for the platform-defined event selected by mhpmevent29; this WARL counter supports up to 64 bits of precision.

What This Field Controls

  • - On RV64 only, reads and writes the complete Machine HPM count for the platform-defined event selected by mhpmevent29; this WARL counter supports up to 64 bits of precision.

Common Values

This field is better understood together with surrounding context than as a fixed memorized enumeration.

Official Basis & Search Notes

mhpmcounter29 is machine HPM counter 29. It does not define event meaning by itself; it counts the platform-defined event currently selected by mhpmevent29 with up to 64 bits of precision.

The official Machine HPM mechanism defines mhpmcounter29 as a WARL counter with up to 64 bits of precision.
mhpmevent29 selects the event; event numbers are platform-defined.
On RV32, mhpmcounter29h provides access to the upper 32 bits.

What To Check First When Reading This CSR

  • - The event source for mhpmcounter29 is determined by mhpmevent29; check the event-selector configuration first.
  • - S/U-mode reads of the read-only hpmcounter29 shadow are controlled by mcounteren.HPM29; U-mode additionally requires scounteren.HPM29.
  • - On RV32, mhpmcounter29h accesses bits 63:32 of mhpmcounter29.

Risk Checks Before Writing

  • - A write to mhpmcounter29 takes effect after the writing instruction has otherwise completed and changes the current count.
  • - When mcountinhibit.HPM29 is set, the counter does not increment; that bit controls incrementing, not accessibility.

Put It Back Into A Real Flow

1

Configure mhpmevent29 to select the platform-defined event to count.

2

Use mcountinhibit.HPM29 when needed to control the counting window.

3

Read mhpmcounter29 and, on RV32, mhpmcounter29h to obtain the event count with up to 64 bits of precision.

FAQ

Can mhpmcounter29 be accessed from any privilege level?

No. The CSR table lists mhpmcounter29 as a machine read/write CSR. Lower-privilege access is to the corresponding read-only hpmcounter29 view: S/U-mode reads are controlled by mcounteren.HPM29, and U-mode reads are additionally controlled by scounteren.HPM29. A disallowed read raises an illegal-instruction exception.

How is mhpmcounter29 related to hpmcounter29?

mhpmcounter29 is the machine read/write counter; hpmcounter29 is its corresponding lower-privilege read-only shadow. S/U-mode reads are controlled by mcounteren.HPM29, and U-mode reads are additionally controlled by scounteren.HPM29.