Home/Instructions/Vector AES Middle-Round Decryption (Scalar Key)
VAESDM.VS

RISC-V VAESDM.VS Instruction Details

Instruction ManualOP-VE vector-scalar form

Vector AES middle-round decryption using one scalar 128-bit round-key element group from vs2 for all state groups.

Instruction Syntax

vaesdm.vs vd, vs2

vd supplies the old state and receives the new state; vs2 supplies round keys, both using vector registers v0–v31. There is no third source, immediate or v0.t mask operand; v0 is writable as data.

32-bit OP-VE: opcode=1110111, funct6=101001, vm=1, vs1=00000, funct3=010; vs1 is a fixed selector, not a source operand.

Requires enabled Zvkned and vector state, SEW=32, EGW=128, EGS=4. InvShiftRows → InvSubBytes → round-key XOR → InvMixColumns; all active state groups use vs2 element group 0; encodings where vd overlaps this scalar key group are reserved.

Process groups vstart/4 through vl/4−1. Encodings with vl or vstart not a multiple of 4, or other SEW values, are reserved. LMUL*VLEN<128 raises an illegal-instruction exception even if vl=0. Execution latency must not depend on operand data.

ZvknedVector CryptoAES

Instruction Behavior

vaesdm.vs performs AES middle-round decryption. Each 128-bit state element group in vd undergoes InvShiftRows, InvSubBytes, XOR with the scalar 128-bit round-key element group from vs2, and InvMixColumns; the new state is written back to vd. SEW must be 32.

VAESDM.VS Decode And Execute Animation

This bounded model shows only official ISA-visible fields, state, and conditions; it does not model a complete cryptographic protocol or microarchitecture.

vaesdm.vs
fixed 101001 / vm=1 / vs1=00000vs2=v16vs1=00000funct3=010vd=v8opcode=1110111
Execution Data Path

state -> InvShiftRows, InvSubBytes, AddRoundKey, then InvMixColumns -> vd

result pending

Quick Understanding & Search Notes

Vector AES middle-round decryption using one scalar 128-bit round-key element group from vs2 for all state groups.

Performs AES middle-round decryption: InvShiftRows, then InvSubBytes, round-key XOR, and finally InvMixColumns; SEW=32 and EGW=128.
This element-group crypto instruction has no vm mask operand and executes at element-group granularity.
SEW=32, EGW=128, EGS=4; encodings with vl or vstart not a multiple of 4 are reserved. LMUL*VLEN<128 raises an illegal-instruction exception even when vl=0.

Vector Execution Context

vd supplies the old state and receives the new state; vs2 supplies round keys, both using vector registers v0–v31. There is no third source, immediate or v0.t mask operand; v0 is writable as data.

32-bit OP-VE: opcode=1110111, funct6=101001, vm=1, vs1=00000, funct3=010; vs1 is a fixed selector, not a source operand.

Requires enabled Zvkned and vector state, SEW=32, EGW=128, EGS=4. InvShiftRows → InvSubBytes → round-key XOR → InvMixColumns; all active state groups use vs2 element group 0; encodings where vd overlaps this scalar key group are reserved.

Process groups vstart/4 through vl/4−1. Encodings with vl or vstart not a multiple of 4, or other SEW values, are reserved. LMUL*VLEN<128 raises an illegal-instruction exception even if vl=0. Execution latency must not depend on operand data.

The RISC-V Instruction Set Manual, Volume I: Unprivileged Architecture — Version 20260120, Chapter 33

Common Usage Scenarios

Crypto & Security

With Zvkned and vector state enabled, VLEN=128, LMUL=1, SEW=32, vl=4, vstart=0, and zero state in v8 and zero key in v16, this round function writes v8=0x52525252525252525252525252525252, updating this active group only.

Vector Acceleration

With Zvkned and vector state enabled, VLEN=128, LMUL=1, SEW=32, vl=4, vstart=0, and zero state in v8 and zero key in v16, this round function writes v8=0x52525252525252525252525252525252, updating this active group only.

Pre-Use Checklist

Syntax Check
  • vd supplies the old state and receives the new state; vs2 supplies round keys, both using vector registers v0–v31. There is no third source, immediate or v0.t mask operand; v0 is writable as data.
  • 32-bit OP-VE: opcode=1110111, funct6=101001, vm=1, vs1=00000, funct3=010; vs1 is a fixed selector, not a source operand.
Semantic Check
  • Requires enabled Zvkned and vector state, SEW=32, EGW=128, EGS=4. InvShiftRows → InvSubBytes → round-key XOR → InvMixColumns; all active state groups use vs2 element group 0; encodings where vd overlaps this scalar key group are reserved.
  • Process groups vstart/4 through vl/4−1. Encodings with vl or vstart not a multiple of 4, or other SEW values, are reserved. LMUL*VLEN<128 raises an illegal-instruction exception even if vl=0. Execution latency must not depend on operand data.

Pitfalls / Common Confusions

No vm operand; this element-group crypto instruction is not maskable.
The .vs scalar operand is an element group in vector register vs2, not a GPR or FP register.
For .vs, vd must not overlap the vs2 scalar element group.
SEW=32, EGW=128, EGS=4; vl and vstart must be multiples of 4, and LMUL*VLEN must cover at least one 128-bit element group.

FAQ

Can VAESDM.VS always use a v0.t mask?

No. This element-group crypto instruction has no vm operand; ordinary RVV mask syntax should not be added to examples.

What determines the element width for VAESDM.VS?

This instruction fixes SEW=32 and executes on 128-bit element groups; encodings with other SEW values are reserved.