How does VMULH.VX differ from VWMUL*?
VMULH.VX writes only the high SEW bits to an SEW-width vd. VWMUL* writes the full 2*SEW widening product.
VMULH.VX forms each active element's 2*SEW integer product and writes the product's high SEW bits.
VMULH.VX is a RISC-V V extension single-width integer vector-scalar multiply instruction. Each active element reads vs2 and the second source from integer scalar register rs1, forms a 2*SEW product, and writes the high SEW bits to vd. Both source operands are interpreted as signed; with vm=0, only body elements whose v0.t bit is 1 are processed, while masked-off and tail elements follow the current vtype policies.
Starts from OP-V encoding fields, then shows how VMULH forms a 2*SEW product and writes the signed-by-signed high SEW bits to vd.
Require valid vtype, enabled VS, and supported SEW; VL=0 updates nothing, including tails. An ordinary masked vd cannot be v0; v0 cannot supply both mask and SEW data. Same-width source/destination overlap is legal. Steps are teaching stages, not processor cycles.
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.
vmulh.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, the high half of a 2*SEW product integer signed high-half multiplication, mask control, and vd writeback. It does not model pipelines, caches, or timing.
VMULH.VX does not write a full widening product. It forms a 2*SEW product for active elements within the current vl and writes only the high SEW bits to vd; the second source comes from integer scalar register rs1, and both source operands are interpreted as signed.
Syntax: vmulh.vx vd, vs2, rs1[, v0.t]. 32-bit OP-V: opcode=1010111, funct3=110, funct6=100111.
vd receives SEW-bit integer vector elements, not comparison-mask bits; vs2 supplies SEW-bit vector elements. rs1 selects an integer x register: use low SEW bits when XLEN>SEW, or sign-extend when XLEN<SEW; x0 supplies zero.
Treat both sources as signed; write the high SEW bits of the 2×SEW product. This is not multiply-accumulate, and does not round under vxrm or saturate.
Active elements satisfy vstart≤i<vl and either vm=1 or v0.mask[i]=1. Prestart is preserved; vma/vta govern inactive/tail preservation or permitted all-ones values. vstart≥vl (including vl=0) updates no destination elements.
Same-width source/destination overlap is legal. EEW=SEW and EMUL=LMUL; EMUL=2/4/8 groups align to their size. An ordinary masked vd cannot include v0, and v0 cannot supply both an EEW=1 mask and SEW data. Require the extension, valid supported vtype, and non-Off mstatus.VS; with H and virtualization V=1, vsstatus.VS must also be non-Off. The animation fixes LMUL=m1, VLEN=4096 and vstart=0, showing body elements only; steps are not processor cycles.
Assume enabled V/VS, valid e8,m1, VLEN≥128, vl=4, vstart=0, ta/ma and initialized sources; the example uses v0.t. v8=[0xff,2,0x80,7], x11=3, v0.mask[0..3]=[1,0,1,1] → v4=[0xff,policy,0xfe,0x00]. Both sources are signed and the high 8 bits are written. policy retains the old value or writes all ones; tails are not guaranteed zero.
Assume enabled V/VS, valid e8,m1, VLEN≥128, vl=4, vstart=0, ta/ma and initialized sources; the example uses v0.t. v8=[0xff,2,0x80,7], x11=3, v0.mask[0..3]=[1,0,1,1] → v4=[0xff,policy,0xfe,0x00]. Both sources are signed and the high 8 bits are written. policy retains the old value or writes all ones; tails are not guaranteed zero.
VMULH.VX writes only the high SEW bits to an SEW-width vd. VWMUL* writes the full 2*SEW widening product.
No. This instruction writes only the selected high SEW bits from the current multiply; use VMACC/VWMACC-family multiply-accumulate instructions when accumulation is required.