Zimop instructions
May-Be-Operations
The "Zimop" extension introduces the concept of
instructions that may be operations (MOPs). MOPs are initially defined to
simply write zero to x[rd], but are designed to be redefined by later
extensions to perform some other action.
The Zimop extension defines an encoding space for 40 MOPs.
Note
It is sometimes desirable to define instruction-set extensions whose
instructions, rather than raising illegal-instruction exceptions when the extension is
not implemented, take no useful action (beyond writing x[rd]).
For example, programs with control-flow integrity checks can
execute correctly on implementations without the corresponding extension,
provided the checks are simply ignored. Implementing these checks as MOPs
allows the same programs to run on implementations with or without the
corresponding extension.
Although similar in some respects to HINTs, MOPs cannot be encoded as HINTs, because unlike HINTs, MOPs are allowed to alter architectural state.
Because MOPs may be redefined by later extensions, standard software should not execute a MOP unless it is deliberately targeting an extension that has redefined that MOP.
The Zimop extension defines 32 MOP instructions named MOP.R.n, where
n is an integer between 0 and 31, inclusive.
Unless redefined by another extension, these instructions simply write 0 to
x[rd]. Their encoding allows future extensions to define them to read x[rs1],
as well as write x[rd].
The Zimop extension additionally defines 8 MOP instructions named
MOP.RR.n, where n is an integer between 0 and 7, inclusive.
Unless redefined by another extension, these instructions simply
write 0 to x[rd]. Their encoding allows future extensions to define them to
read x[rs1] and x[rs2], as well as write x[rd].
Note: The recommended assembly syntax for MOP.R.n is MOP.R.n rd, rs1,
with any x-register specifier being valid for either argument. Similarly for
MOP.RR.n, the recommended syntax is MOP.RR.n rd, rs1, rs2.
The extension that redefines a MOP may define an alternate assembly mnemonic.
Note: These MOPs are encoded in the SYSTEM major opcode in part because it is expected their behavior will be modulated by privileged CSR state.
Note: These MOPs are defined to write zero to x[rd], rather than performing
no operation, to simplify instruction decoding and to allow testing the
presence of features by branching on the zeroness of the result.
The MOPs defined in the Zimop extension do not carry a syntactic dependency
from x[rs1] or x[rs2] to x[rd], though an extension that redefines the
MOP may impose such a requirement.
Note: Not carrying a syntactic dependency relieves straightforward
implementations of reading x[rs1] and x[rs2].
Extension description from riscv-unified-db, reformatted.
Specification chapter: The RISC-V Instruction Set Manual, src/unpriv/zimop.adoc.
Instructions (42)
| Mnemonic | Name (riscv-unified-db) | XLEN |
|---|---|---|
mop.r.0 | May-be-operation 0 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.1 | May-be-operation 1 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.2 | May-be-operation 2 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.3 | May-be-operation 3 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.4 | May-be-operation 4 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.5 | May-be-operation 5 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.6 | May-be-operation 6 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.7 | May-be-operation 7 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.8 | May-be-operation 8 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.9 | May-be-operation 9 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.10 | May-be-operation 10 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.11 | May-be-operation 11 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.12 | May-be-operation 12 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.13 | May-be-operation 13 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.14 | May-be-operation 14 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.15 | May-be-operation 15 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.16 | May-be-operation 16 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.17 | May-be-operation 17 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.18 | May-be-operation 18 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.19 | May-be-operation 19 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.20 | May-be-operation 20 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.21 | May-be-operation 21 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.22 | May-be-operation 22 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.23 | May-be-operation 23 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.24 | May-be-operation 24 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.25 | May-be-operation 25 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.26 | May-be-operation 26 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.27 | May-be-operation 27 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.28 | May-be-operation 28 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.29 | May-be-operation 29 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.30 | May-be-operation 30 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.31 | May-be-operation 31 (1 source register) (pseudo-op) | RV32 and RV64 |
mop.r.N | RV32 and RV64 | |
mop.rr.0 | May-be-operation 0 (2 source registers) (pseudo-op) | RV32 and RV64 |
mop.rr.1 | May-be-operation 1 (2 source registers) (pseudo-op) | RV32 and RV64 |
mop.rr.2 | May-be-operation 2 (2 source registers) (pseudo-op) | RV32 and RV64 |
mop.rr.3 | May-be-operation 3 (2 source registers) (pseudo-op) | RV32 and RV64 |
mop.rr.4 | May-be-operation 4 (2 source registers) (pseudo-op) | RV32 and RV64 |
mop.rr.5 | May-be-operation 5 (2 source registers) (pseudo-op) | RV32 and RV64 |
mop.rr.6 | May-be-operation 6 (2 source registers) (pseudo-op) | RV32 and RV64 |
mop.rr.7 | May-be-operation 7 (2 source registers) (pseudo-op) | RV32 and RV64 |
mop.rr.N | RV32 and RV64 |