How is VWSUBU.VV different from ordinary subtraction?
VWSUBU.VV zero-extends SEW source elements and produces a 2*SEW-wide result; ordinary single-width vector subtraction writes only a SEW-wide result.
VWSUBU.VV performs unsigned widening subtract; SEW source elements are zero-extended and written as 2*SEW-wide results.
Extension condition: RV32/RV64 V 1.0; require enabled vector state, vill=0 and support for the selected SEW and 2*SEW; SEW=64 requires additional 128-bit integer element support.
vwsubu.vv is a RISC-V V extension vector-vector unsigned widening subtract instruction. For active elements, the SEW values from vs2 and vs1 are zero-extended to 2*SEW, then subtracted and written to the 2*SEW-wide vd destination.
Starts from OP-V encoding fields, then shows how VWSUBU zero-extends SEW source elements, subtracts at 2*SEW width, and writes vd.
Teaching context: V 1.0, enabled vector state and valid supported vtype; fix LMUL=m1, VLEN=4096, vstart=0, VLMAX=4096/16. Enter nonnegative bit patterns. Require SEW and 2*SEW support; SEW=64 needs additional 128-bit integer elements beyond baseline V guarantees. Read 16-bit vs2 and a SEW-bit second source; zero-extend narrow sources, subtract the second source from vs2 and keep low 32 bits, without saturation, vxrm use or vxsat change. Equal sources require equal initial values. Wide vd has EMUL=2 and an even start; a narrow source may overlap only its highest register, forcing mask- and tail-agnostic behavior. Scalars first follow XLEN/SEW conversion: take low bits if wider, sign-extend if narrower, then zero-extend to 2*SEW; x0 supplies zero. With v0.t, vd and data sources exclude v0. Only body is shown; inactive/tail follow vma/vta without definite displayed values. VL=0 updates nothing; success resets vstart=0. Stages are teaching steps, not processor cycles.
vwsubu.vv uses OP-V encoding. The animation places fixed fields, register fields, vm, and the vs1 field in one encoding strip.
This animation shows only ISA-visible relationships from the official V extension: OP-V field decode, active-element reads, 2*SEW widening integer unsigned widening subtraction, mask control, and vd writeback. It does not model pipelines, caches, or timing.
VWSUBU.VV is not ordinary SEW-wrapping subtraction: it first zero-extends both source elements, then keeps the subtraction result in a 2*SEW-wide destination element.
vd has EEW=2*SEW and EMUL=2*LMUL<=8; vs2 is a SEW/LMUL narrow source, and the second source is SEW/LMUL vs1. Wide groups align to their size.
32-bit OP-V: opcode=1010111, funct6=110010, funct3=010 (OPMVV); vm bit25, vs2 bits24:20, vs1 bits19:15, vd bits11:7. Optional v0.t means vm=0; omission means vm=1.
Zero-extend narrow sources to 2*SEW, subtract the second source from vs2 and keep low 2*SEW bits without accumulating old vd. Equal same-width sources require equal initial values. No saturation, vxrm use or vxsat change.
Narrow sources overlap wide vd only with EMUL>=1 and equal highest registers, forcing mask/tail-agnostic behavior. Masked vd excludes v0, which cannot supply mask and data together. Prestart stays unchanged; inactive/tail follow vma/vta, retaining old values or allowing all ones, without guaranteed zeroing.
RV32/RV64 V 1.0; require enabled vector state, vill=0 and support for the selected SEW and 2*SEW; SEW=64 needs additional 128-bit integer elements. Active elements satisfy vstart<=i<vl with masking enabled; vstart>=vl (including vl=0) updates nothing. Implementations may reject nonzero vstart values they cannot produce; success resets vstart=0. The animation fixes LMUL=m1, VLEN=4096, vstart=0; stages are not processor cycles.
Assume RV32/RV64 V 1.0, enabled vector state, valid supported e16,m1,tu,mu, supported 32-bit results, XLEN=64, VLEN=4096, vl=4, vstart=0, initialized sources, and v0.mask[0..3]=1111. vs2[0]=0, vs1[0]=1 → vd[0]=4294967295 (0xffffffff); other active elements follow the same rule and tails retain old values. Success resets vstart=0.
Assume RV32/RV64 V 1.0, enabled vector state, valid supported e16,m1,tu,mu, supported 32-bit results, XLEN=64, VLEN=4096, vl=4, vstart=0, initialized sources, and v0.mask[0..3]=1111. vs2[0]=0, vs1[0]=1 → vd[0]=4294967295 (0xffffffff); other active elements follow the same rule and tails retain old values. Success resets vstart=0.
Assume RV32/RV64 V 1.0, enabled vector state, valid supported e16,m1,tu,mu, supported 32-bit results, XLEN=64, VLEN=4096, vl=4, vstart=0, initialized sources, and v0.mask[0..3]=1111. vs2[0]=0, vs1[0]=1 → vd[0]=4294967295 (0xffffffff); other active elements follow the same rule and tails retain old values. Success resets vstart=0.
VWSUBU.VV zero-extends SEW source elements and produces a 2*SEW-wide result; ordinary single-width vector subtraction writes only a SEW-wide result.
No. The result is computed from current source operands and written to vd; .wv/.wx use a wide vs2 source and do not imply accumulation into old vd either.