How is VSUB.VV different from VRSUB?
VSUB.VV subtracts in the vs2[i] - vs1[i] direction. VRSUB is reverse subtraction: scalar or immediate minus vs2[i].
VSUB.VV subtracts vs1 from active vs2 elements, keeping low SEW bits.
VSUB.VV computes vs2[i] - vs1[i] for active elements, wrapping at SEW width.
Starts from OP-V encoding fields, then shows how VSUB subtracts the second source from vs2, wraps at SEW, and writes vd.
Require V 1.0, enabled vector state and valid supported vtype/SEW. Fix LMUL=m1, vstart=0, VLEN=4096 and VLMAX=4096/16=256. An ordinary masked vd cannot be v0; equal-width source/destination overlap is legal. XLEN>SEW takes low scalar bits; XLEN<SEW sign-extends; x0 supplies zero. When v0 supplies the EEW=1 mask it cannot also supply SEW data. VL=0 updates no destination elements. Only body is shown without definite inactive/tail values. Steps are teaching stages, not processor cycles.
vsub.vv uses OP-V encoding. The animation places fixed fields, register fields, vm, and the vs1 field in one encoding strip.
This animation shows OP-V field decode, active-element reads, SEW-width integer subtraction, mask control, and vd writeback. These are teaching stages; they do not model pipelines, caches, or timing.
VSUB.VV computes vs2[i] - vs1[i] for active elements, wrapping at SEW width.
vd/vs2/vs1 are aligned EEW=SEW, EMUL=LMUL groups. Equal-width source/destination overlap is legal; equal sources read equal values. vs1[i] is the subtrahend.
32-bit OP-V: opcode=1010111, funct6=000010, funct3=000; vm at bit25, vs2 at bits24:20, vs1 at bits19:15, vd at bits11:7.
Active vd[i]=(vs2[i] - vs1[i]) mod 2^SEW, without a borrow flag, integer overflow trap, saturation or vxsat change. VRSUB reverses the subtraction direction.
Require RV32/RV64 V 1.0, enabled vector state, vill=0 and supported vtype/SEW. v0.t means vm=0; omission means vm=1. Only mask-enabled vstart<=i<vl elements compute; prestart stays unchanged, inactive/tail follow vma/vta, retaining or all ones; masked vd excludes v0. vstart>=vl (including vl=0) leaves vd unchanged; v0 cannot supply both EEW=1 mask and data. Success resets vstart=0.
Assume enabled V/VS, valid m1,tu,mu, VLEN=4096, vl=4, vstart=0, v0.mask[0..3]=1101; SEW=8, v12=[0,1,255,7], v4=[1,1,1,1]. v8[0]=255, v8[1]=0, v8[3]=6. Lane2 and tails keep old values; vxsat stays unchanged. Success resets vstart=0.
Assume enabled V/VS, valid m1,tu,mu, VLEN=4096, vl=4, vstart=0, v0.mask[0..3]=1101; SEW=8, v12=[0,1,255,7], v4=[1,1,1,1]. v8[0]=255, v8[1]=0, v8[3]=6. Lane2 and tails keep old values; vxsat stays unchanged. Success resets vstart=0.
VSUB.VV subtracts in the vs2[i] - vs1[i] direction. VRSUB is reverse subtraction: scalar or immediate minus vs2[i].
No. Ordinary vector integer subtraction keeps the low SEW bits, so the result wraps at SEW width.