How does VSETIVLI differ from VSETVLI?
VSETIVLI takes AVL from a 5-bit uimm; VSETVLI usually takes AVL from rs1 and has rs1=x0 special forms. Both use vtypei to configure vtype.
Configure vl/vtype from a 5-bit immediate AVL and vtypei, then write the selected vl to rd
VSETIVLI is the immediate-AVL form of VSETVLI. It uses a 5-bit zero-extended uimm as AVL and uses vtypei to encode SEW, LMUL, vta, and vma. Hardware selects the new vl from AVL and VLMAX, updates vl/vtype, and writes the selected vl to rd; rd=x0 only discards the GPR write. Successful execution resets vstart to zero.
Decode the vset fields, derive AVL and vtype, then show the architectural vl/vtype/rd update.
VSETIVLI is an OP-V configuration instruction. This step shows the opcode, funct3, and the fields carrying AVL/vtype information.
Assume V and the required vector state are enabled. This demo shows successful completion (using the vill path for unsupported configurations); an implementation may instead trap on illegal vtype to support emulation. Numeric AVL input is limited to exact nonnegative safe integers in an RV64 teaching context. Steps are explanatory, not hardware cycles.
VSETIVLI places AVL directly in the instruction as a 5-bit immediate, which is useful for small constant element counts. It still configures SEW, LMUL, vta, and vma through vtypei, then updates vl/vtype and can save the new vl in rd.
rd is a GPR; uimm is a zero-extended 5-bit AVL (0–31), including valid zero; vtypei specifies SEW, LMUL, ta/tu and ma/mu.
32-bit OP-V: bits[31:30]=11, bits[29:20]=vtypei[9:0], bits[19:15]=uimm, funct3=111 and opcode=1010111. The unsigned immediate is not sign-extended as an ordinary I-type operand.
VLMAX=LMUL×VLEN/SEW. AVL≤VLMAX selects vl=AVL; VLMAX<AVL<2×VLMAX allows ceil(AVL/2)≤vl≤VLMAX; AVL≥2×VLMAX selects VLMAX. The same implementation is deterministic for equal AVL/VLMAX inputs.
rd=x0 only discards GPR writeback; uimm still supplies AVL, with no rs1=x0 special form.
Require V 1.0 and enabled vector state; vset does not depend on old vtype. Successful completion updates vl/vtype and clears vstart. Unsupported vtype sets vill, zeroes other vtype bits and vl; an implementation may instead trap to emulate illegal configurations.
Assume RV32/RV64 V, enabled vector state, supported e32,m1,ta,ma and VLEN=256, giving VLMAX=8. uimm=8: successful execution of the example sets vl=t0=8 and vstart=0, without element masking.
Assume RV32/RV64 V, enabled vector state, supported e32,m1,ta,ma and VLEN=256, giving VLMAX=8. uimm=8: successful execution of the example sets vl=t0=8 and vstart=0, without element masking.
VSETIVLI takes AVL from a 5-bit uimm; VSETVLI usually takes AVL from rs1 and has rs1=x0 special forms. Both use vtypei to configure vtype.
No. uimm=0 means AVL=0, which selects vl=0 under the official vector-length rules.