frm
Floating-Point Dynamic Rounding Mode
- Address
0x002- Group
- Unprivileged and user-level CSRs
- Privilege
URW(privileged spec CSR listing, Unprivileged Floating-Point CSRs)- Access
- read/write; lowest privilege U (user/unprivileged)
- Address range
- Standard read/write
- Name in riscv-unified-db
- Floating-Point Dynamic Rounding Mode
Privileged spec: Floating-Point Dynamic Rounding Mode
Description
Rounding modes are encoded as follows:
Rounding mode encoding.
| Rounding Mode |Mnemonic |Meaning | ||
|---|---|---|
| 000 | RNE | Round to Nearest, ties to Even |
| 001 | RTZ | Round towards Zero |
| 010 | RDN | Round Down (towards $-\infty$) |
| 011 | RUP | Round Up (towards $+\infty$) |
| 100 | RMM | Round to Nearest, ties to Max Magnitude |
| 101 | Reserved for future use. | |
| 110 | Reserved for future use. | |
| 111 | DYN | In instruction's rm field, selects dynamic rounding mode; In Rounding Mode register, reserved. |
The behavior of floating-point instructions that depend on rounding mode when executed with a reserved rounding mode is reserved, including both static reserved rounding modes (101-110) and dynamic reserved rounding modes (101-111).
Some instructions, including widening conversions, have the rm field but are nevertheless mathematically unaffected by the rounding mode; software should set their rm field to RNE (000) but implementations must treat the rm field as usual (in particular, with regard to decoding legal vs. reserved encodings).
From riscv-unified-db, reformatted.
Fields
| Field | Bits | Type | Description |
|---|---|---|---|
ROUNDINGMODE | 2-0 | RW-H | Rounding mode data. |
Fields from riscv-unified-db; field types computed by IDL functions there are not shown.
Specification and related pages
- The RISC-V Instruction Set Manual, Volume II: CSR listing (src/priv/csrs.adoc)
- riscv-opcodes csrs.csv
- riscv-unified-db: spec/std/isa/csr/F/frm.yaml
- csrrw, csrrs, csrrc (Zicsr instructions that access CSRs)