What is the immediate range for VRSUB.VI?
The VI form uses a 5-bit signed immediate, ranging from -16 to 15, sign-extended before the operation.
Subtract vector elements from a sign-extended immediate.
VRSUB.VI computes signext(imm) - vs2[i] for active elements and writes the low SEW bits to vd.
Starts from OP-V encoding fields, then shows how VRSUB subtracts vs2 from the second source, wraps at SEW, and writes vd.
Require V 1.0, enabled vector state and valid supported vtype/SEW; fix LMUL=m1 and vstart=0. Fix VLEN=4096 and VLMAX=4096/16=256; equal-width sources/destination may overlap. Compute sign-extended simm5 (-16..15) minus vs2[i], keeping low SEW bits. When v0 supplies the EEW=1 mask/borrow bits it cannot also supply data. Enter nonnegative element bit patterns. VL=0 updates no destination bits. Only body is shown without definite inactive/tail values; teaching stages are not processor cycles.
vrsub.vi uses OP-V encoding. The animation places fixed fields, register fields, vm, and the imm field in one encoding strip.
This animation shows OP-V field decode, reverse subtraction, execution masking, and vd writeback; teaching stages are not processor cycles.
VRSUB.VI computes sign-extended imm - vs2[i] for each active element. The VI form uses a 5-bit signed immediate in the range -16 through 15.
Syntax: vrsub.vi vd, vs2, imm[, v0.t]; omit the mask for vm=1, include it for vm=0. 32-bit OP-V: opcode=1010111, funct3=011 (OPIVI), funct6=000011.
Compute sign-extended simm5 (-16..15) minus vs2[i], keeping low SEW bits without an arithmetic-overflow trap.
Body is vstart≤i<vl; only mask-enabled body elements execute, with inactive/tail following vma/vta. Prestart is unchanged; vl=0 or vstart≥vl updates no destination elements.
Same-width sources/destination may overlap; an ordinary masked vd cannot be v0. When v0 supplies EEW=1 mask/borrow bits it cannot also supply data; source groups cannot read a register with different EEWs. Group starts align to EMUL, EMUL≤8.
Require RV32/RV64 V 1.0, enabled vector state and valid supported vtype/SEW. The animation fixes m1 and vstart=0; VLEN=4096. Only body is shown; steps are not processor cycles.
Assume enabled V/VS, valid m1, supported SEW, VLEN=4096 and XLEN=64, vl=4, vstart=0 and initialized sources, v0.mask[0..3]=1111. SEW=8, imm=7, v12=[10,0,255,7] → v8=[253,7,8,0]. Inactive/tail follow vma/vta. vl=0 leaves vd unchanged.
Assume enabled V/VS, valid m1, supported SEW, VLEN=4096 and XLEN=64, vl=4, vstart=0 and initialized sources, v0.mask[0..3]=1111. SEW=8, imm=7, v12=[10,0,255,7] → v8=[253,7,8,0]. Inactive/tail follow vma/vta. vl=0 leaves vd unchanged.
The VI form uses a 5-bit signed immediate, ranging from -16 to 15, sign-extended before the operation.
Ordinary single-width integer subtraction provides VSUB.VV, VSUB.VX, and reverse-subtract VRSUB.VX/VRSUB.VI; vector minus immediate is not a separate VSUB.VI form.