2.9HINT Instructions

Part I Linux boot: required Vol. I (Unprivileged) pp. 37–39 · ~3 min read

  • hint instruction

RV32I reserves a large slab of encoding space for HINT instructions — encodings that communicate performance information to the microarchitecture while changing no architectural state except pc and performance counters. The design trick: nearly all HINTs are ordinary computational instructions with rd = x0, plus FENCE encodings whose predecessor or successor set is null. A core that knows nothing about hints executes them as dead operations at zero hardware cost; a core that recognizes them may do something smart; both are conforming, because implementations are always allowed to ignore hints.

The HINT map

91% of the space is reserved for future standard hints; the rest is permanently custom. Standard code points already burned in (Table 5):

RV32I HINT code points (Table 5, condensed)
ConstraintsCode pointsPurpose
LUI / AUIPC / ANDI / ORI / XORIrd=x02^20 / 2^20 / 2^17 ×3Future standard use
ADDIrd=x0, and rs1≠x0 or imm≠02^17−1Future standard use
ADDrd=x0, rs1=x0, rs2=x2–x54NTL.P1 / NTL.PALL / NTL.S1 / NTL.ALL
ADD (rest)rd=x0, other rs1/rs22^10−32 + 2^8Future standard use
SLLI / SRAIrd=x0, rs1=x0, shamt=31 / 71 + 1Semihosting entry/exit markers
SUB/AND/OR/XOR/SLL/SRL/SRArd=x02^10 eachFuture standard use
FENCEfm=0, pred=0 or succ=0 (rs1/rd variants)~2×(2^10−63)+30Future standard use
FENCErd=rs1=x0, fm=0, pred=W, succ=01PAUSE
SLTI / SLTIUrd=x02^17 eachCUSTOM
SLLI / SRLI / SRAI (non-marker)rd=x0, excl. semihosting points~2^10 eachCUSTOM
SLT / SLTUrd=x02^10 eachCUSTOM
Dotted-underlined cells have explanations — click one.

Hardware Designer Notes

The decode cost of HINT compliance is zero by construction — that’s the whole design. If you do act on a hint (say, PAUSE throttling the fetch unit in a spin loop), keep the action microarchitectural only: no architectural state may change, and unrecognized-hint behavior must be indistinguishable from a plain dead instruction. When allocating your own hints, stay inside the CUSTOM rows — the standard rows are a compatibility time bomb (the semihosting markers show standard hints do get minted).

Minimal Linux-boot hart MUST

  • Execute every HINT encoding as its underlying instruction (dead write to x0 / null fence) — advancing pc and counters, never trapping

MAY simplify / trap-and-emulate

  • Recognize specific hints (PAUSE, NTL.*) and act on them — or ignore all of them
  • Use the CUSTOM-designated rows for product-specific hints without breaking conformance

Check yourself — HINTs

1.Your minimal core meets ADD x0, x5, x7 (a HINT encoding it doesn't recognize). What's the cheapest correct behavior?

2.Which encodings carry the standard PAUSE hint and the NTL.* hints?

3.Can you use SLTI rd=x0 encodings for your own accelerator's hints in a conforming design?

3 questions