-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zimop/Zcmop - temporary non-official documentation #131
Comments
Official documentation posted here: riscv/riscv-isa-manual@2463e2a |
Looking for help from someone in the TG conversant with binutils to provide an update to binutils for Zimop/Zcmop; including how we would have binutils comprehend a subset of codepoints being used later for Zicfiss and thus have a different mnemonic. |
Yeah, I think that can be implemented as alias in binutils, there is an example in
So, applying this kind of pattern to Zimop (the instruction mapping may not correct, but it should doesn't matter to demo this concept):
|
Thanks. That makes sense. So for now the binutil update can be just to add mop.r, mop.rr, and c.mop and when we introduce the Zicfiss, some of these can be updated to have aliases. |
FYI, here's a very rough binutils patch. It's my first ever binutils patch, so may have obvious errors, and I suspect it's not looking at ISA dependencies correctly (ie, making sure Zcmop requires C). That said, I can assemble and objdump with it. |
Thank you @adlr ! Much appreciate! Closing this issue since official documentation is now available and will provide a reference from the specification to the official documentation. |
This is not the official specification for these extensions.
Zimop:
The Zimop extension introduces the concept of instructions that may be operations (MOPs). MOPs are initially defined to perform no useful operation and raise no exceptions, but might 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 do not raise illegal-instruction exceptions when the extension is not implemented. 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.
NOTE: Although similar in some respects to HINTs, most MOPs cannot be encoded as HINTs, because MOPs might sometimes alter architectural state, which HINTs are forbidden from doing.
The Zimop extension defines 32 MOP instructions named
mop.r.0
--mop.r.31
. Unless redefined by another extension, these instructions simply write 0 tox[rd]
. Their encoding allows future extensions to define them to readx[rs1]
, as well as writex[rd]
. They are encoded as1-00--0111--sssss100ddddd1110011
, where-
denotes an available opcode bit,s
denotes thers1
field, andd
denotes therd
field.The Zimop extension additionally defines 8 MOP instructions named
mop.rr.0
--mop.rr.7
. Unless redefined by another extension, these instructions simply write 0 tox[rd]
. Their encoding allows future extensions to define them to readx[rs1]
andx[rs2]
, as well as writex[rd]
. They are encoded as1-00--1tttttsssss100ddddd1110011
, wheret
denotes thers2
field.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 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 are not guaranteed to carry a syntactic dependency from source to destination.
NOTE: Not carrying a syntactic dependence relieves straightforward implementations of reading
x[rs1]
andx[rs2]
.Zcmop
Eight code points in the 16-bit encoding space are provided for MOPs:
c.mop.0
, encoded in the reserved encoding space wherec.lui x1, 0
would be encodedc.mop.1 (c.lui x3, 0)
c.mop.2 (c.lui x5, 0)
...
c.mop.7 (c.lui x15, 0)
These instructions are defined to not write
rd
. As with other MOPs, which registers they read is left up to the future definition of the op, but this encoding makes it convenient for these instructions to readx1
,x3
, ...,x15
. Although we generally expect these MOPs to be equivalent to some 32-bit MOP, the expansion (if any) is left to the future definition of the op.The text was updated successfully, but these errors were encountered: