Webcentive RISC-V Reference

vmv.x.s

Vector move scalar to integer register

Extension
V
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
vmv.x.s xd, vs2
Length
32-bit

Encoding

31262524201915141211760
0100001vs200000010rd1010111

Match 0x42002057, mask 0xfe0ff07f. Source: vmv.x.s 31..26=0x10 25=1 vs2 19..15=0 14..12=0x2 rd 6..0=0x57 in riscv-opcodes/extensions/rv_v.

FieldBitsriscv-opcodes name
vs224:20vs2
rd11:7rd

Description

Copies the first element of the source vector register vs2 to the destination integer register xd, sign-extending to XLEN bits if SEW < XLEN.

This is a scalar read instruction that always reads element 0 of vs2, regardless of vstart. The vstart CSR is reset to 0 after execution.

Description from riscv-unified-db, reformatted.

Operation

VectorState state = vector_state();

# vmv.x.s copies element 0 of vs2 to xd, sign-extending to XLEN
X[xd] = $signed(V[vs2][state.sew-1:0]);

CSR[vstart].VALUE = 0;

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

Specification and related pages