Does VDIV.VX trap on divide by zero?
No. The official V extension defines the divide-by-zero result: the quotient is an all-ones bit pattern, and the instruction itself does not raise a divide-by-zero trap.
Vector-scalar signed integer division; writes each quotient to vd, and divide by zero does not trap.
VDIV.VX divides each active signed SEW-bit vs2 element by the scalar formed from x[rs1] by the .vx rules, rounding the quotient toward zero into vd. A zero divisor returns all ones without a divide-by-zero trap; signed minimum/-1 returns the dividend.
Starts from OP-V encoding fields, then shows how VDIV computes each signed quotient and applies the official divide-by-zero and signed-overflow special cases.
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.
vdiv.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 signed division, mask control, and vd writeback. It does not model pipelines, caches, or timing.
VDIV.VX does not raise a divide-by-zero exception. For active elements within the current vl, it reads vs2 as the dividend and the x[rs1] scalar value as the divisor, writes the signed quotient, and with vm=0 only body elements whose v0.t bit is 1 execute.
vd and vs2 are SEW-wide vector groups; same-EEW source/destination overlap is allowed and equal sources read equal initial values.
rs1 selects an integer register: use low SEW bits for XLEN>SEW, sign-extend for XLEN<SEW (including unsigned division), and read zero from x0.
The quotient rounds toward zero; division by zero returns all ones without a divide-by-zero trap. Signed minimum/-1 returns the dividend; unsigned division cannot overflow.
Require V, enabled vector state, and supported vtype. Active elements satisfy vstart≤i<vl and (vm=1 or v0[i]=1); VL=0 leaves the entire destination unchanged. Omitting v0.t means vm=1. Inactive/tail elements follow vma/vta; masked vd cannot overwrite v0, and v0 cannot supply both EEW=1 and SEW sources.
Assume V/vector state enabled, vstart=0, supported e32,m1, VLMAX≥4, and a0=4. The example is unmasked, so all four body elements execute. v2=[20,21,22,23], a1=3 gives v1=[6,7,7,7]; quotients round toward zero. Tail elements follow ta without assumed zeroing.
Assume V/vector state enabled, vstart=0, supported e32,m1, VLMAX≥4, and a0=4. The example is unmasked, so all four body elements execute. v2=[20,21,22,23], a1=3 gives v1=[6,7,7,7]; quotients round toward zero. Tail elements follow ta without assumed zeroing.
No. The official V extension defines the divide-by-zero result: the quotient is an all-ones bit pattern, and the instruction itself does not raise a divide-by-zero trap.
VDIV.VX writes the quotient; the paired VREM form writes the remainder for the same divide relation. Both use the same divide-by-zero and signed-overflow special-case rules.
The quotient rounds toward zero. At SEW=32, -21/4 produces -5, rather than -6. Ordinary masked forms compute only active elements.