How does VMACC.VX handle masking?
With vm=0, v0 selects active elements; with vm=1, all body elements participate. Inactive and tail elements follow the current policies.
Add the low SEW bits of the x[rs1]-by-vs2 product to old vd.
VMACC.VX is a destructive RISC-V V integer multiply-add instruction. For each active element, it adds the low SEW bits of x[rs1] times vs2[i] to old vd[i] and writes the SEW-wide result back to vd[i]. When XLEN is greater than SEW it uses the low SEW bits of x[rs1]; when XLEN is smaller than SEW it sign-extends x[rs1].
Starts from OP-V encoding fields, then shows how VMACC reads old vd as an accumulator, adds the low half of the SEW-by-SEW product, and writes the SEW-wide result.
The teaching model fixes LMUL=m1 and vstart=0 and shows only body elements in the selected VL. It fixes VLEN=4096, VLMAX=4096/16=256, and assumes support for the selected SEW; equal vector sources require equal elements. In ordinary masked forms, inactive and tail elements follow vtype.vma/vta and the result row does not invent a definite value; VADC/VMADC/VSBC/VMSBC execute every body element, with v0 bits used only as carry/borrow-in.
vmacc.vx uses OP-V encoding. The animation places fixed fields, register fields, vm, and the rs1 field in one encoding strip.
This animation shows only ISA-visible relationships from the official V extension: OP-V field decode, active-element reads, SEW-width integer addend-overwrite integer multiply-accumulate, mask control, and vd writeback. It does not model pipelines, caches, or timing.
Active elements compute (old vd + vs1/rs1 × vs2) mod 2^SEW; inactive/tail elements follow policy.
32-bit OP-V: opcode=1010111, funct6=101101, funct3=110 (OPMVX). vd is both the old SEW accumulator and destination; syntax places vs1/rs1 before vs2.
Active elements write (old vd + x[rs1]×vs2) mod 2^SEW. XLEN>SEW uses low SEW scalar bits; XLEN<SEW sign-extends; x0 is 0. VMADD's first multiplicand is old vd; VMACC's old vd is the addend.
Omitting v0.t gives vm=1; including it gives vm=0, enabling only masked-on body elements. Same-EEW destination/source overlap is allowed. Masked vd cannot overlap v0, and one register cannot be read as both an EEW=1 mask and SEW data.
Require V 1.0, enabled VS, valid vtype, and supported widths. Prestart stays unchanged; body is vstart≤i<vl. VL=0 or vstart≥vl updates no destination, including tails; normal completion resets vstart=0 and leaves vl unchanged.
Inactive/tail elements follow vma/vta; agnostic may retain old values or become all ones, without guaranteed zeros. The animation fixes LMUL=m1, VLEN=4096, vstart=0.
Assume RV32/RV64 V; enabled VS, valid vtype, VLEN≥128, and supported widths; vsetvli gives vl=4, vstart=0, ta/ma, unmasked. x10=4, x11=3; e32,m1; old v8=[10,20,30,40], v4=[2,4,6,8] → v8=[16,32,48,64]. Results use source values before writeback. Tails are not guaranteed zero; normal completion resets vstart=0.
Assume RV32/RV64 V; enabled VS, valid vtype, VLEN≥128, and supported widths; vsetvli gives vl=4, vstart=0, ta/ma, unmasked. x10=4, x11=3; e32,m1; old v8=[10,20,30,40], v4=[2,4,6,8] → v8=[16,32,48,64]. Results use source values before writeback. Tails are not guaranteed zero; normal completion resets vstart=0.
With vm=0, v0 selects active elements; with vm=1, all body elements participate. Inactive and tail elements follow the current policies.