Webcentive RISC-V Reference

cm.mvsa01

Move a0-a1 into two registers of s0-s7

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

Encoding

1513121097654210
101011c_sreg101c_sreg210

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

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

Description

Moves a0 into r1s' and a1 into r2s'. r1s' and r2s' must be different. The execution is atomic, so it is not possible to observe state where only one of r1s' or r2s' has 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[xreg1] = X[10];
X[xreg2] = X[11];

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

Specification and related pages