Webcentive RISC-V Reference

cm.mva01s

Move two s0-s7 registers into a0-a1

Extension
Zcmp
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
cm.mva01s r1s, r2s
Length
16-bit (compressed)

Encoding

1513121097654210
101011c_sreg111c_sreg210

Match 0xac62, mask 0xfc63. Source: cm.mva01s c_sreg1 c_sreg2 1..0=2 15..13=5 12..10=3 6..5=3 in riscv-opcodes/extensions/rv_zcmp.

FieldBitsriscv-opcodes name
c_sreg19:7c_sreg1
c_sreg24:2c_sreg2

Description

Moves r1s' into a0 and r2s' into a1. The execution is atomic, so it is not possible to observe state where only one of a0 or a1 have been updated. The encoding uses sreg number specifiers instead of xreg number specifiers to save encoding space. The mapping between them is specified in the pseudo-code below.

Description from riscv-unified-db, reformatted.

Operation

if (implemented?(ExtensionName::Zcmp) && MISA_CSR_IMPLEMENTED && (CSR[misa].C == 1'b0)) {
  reserved_instruction($encoding);
}
XReg xreg1 = (r1s[2:1]>0) ? {1,0,r1s[2:0]} : {0,1,r1s[2:0]};
XReg xreg2 = (r2s[2:1]>0) ? {1,0,r2s[2:0]} : {0,1,r2s[2:0]};
X[10] = X[xreg1];
X[11] = X[xreg2];

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages