Expand description
simd — configurable-precision packed SIMD lanes for the fabric datapath (FabricTarget::simd).
HiVec’s TOPS/W comes from packing several narrow lanes into one datapath. Our analog packs lanes values
of width bits into the existing 64-bit word and operates lane-wise. The one thing that must never happen
is a carry bleeding across a lane boundary — the “silent SIMD integer miscompile”. So the packed hardware
op is defined here as an explicit SWAR (SIMD-within-a-register) form built from the fabric’s own AluOp
tiles, and simd_tile_lock proves it BIT-IDENTICAL to a lane-wise reference (N independent scalar ops) for
ALL 64-bit inputs via our certified SAT. The reference is the spec; the SWAR form is what silicon runs.
Enums§
- LaneTy
- A packed lane type:
lanesvalues ofwidthbits,lanes * width == 64. - VecOp
- A packed integer SIMD operation carried by a
LoopCell::VectorArith/CellKind::Simdtile.Addis the carry-isolated SWAR add (proven ≡ lane-wise bysimd_tile_lock); the bitwise ops never cross a lane boundary, so they are the native 64-bit op.
Constants§
- FP16_
ADD_ V - The synthesizable combinational IEEE-754
f16(binary16) adder — the f32 adder narrowed to 5-bit exponent, 10-bit mantissa, bias 15 (window 128-bit, LSB0=64, leading-ref=74, normalize-target=13). Proven bit-exact to thef16_addreference under iverilog; instantiated once per lane by the packed F16×4 tile. - FP16_
MUL_ V - The synthesizable combinational IEEE-754
f16multiplier — the f32 multiplier narrowed to binary16 (11-bit significand product = 22 bits, leading at 20/21). Proven bit-exact tof16_mulunder iverilog. - FP32_
ADD_ V - The synthesizable combinational IEEE-754
f32adder — a faithful port of the PROVEN f64fp_addsub(benchmarks/silicon/fpu.v): align both significands in a wide 128-bit window (64 bits of alignment room, so every bit survives to sticky), add/sub, leading-zero-count, normalize the leading 1 to bit 26 (24-bit significand at[26:3], guard/round/sticky at[2:0]), round-to-nearest-ties-even, and pack (overflow→Inf, underflow→subnormal viapack_sub32).sub=1computesa-b. Proven bit-exact to Rustf32under iverilog bysimd_float_rtl_lock. This module is instantiated once per lane by the packed F32×2 tile. - FP32_
MUL_ V - The synthesizable combinational IEEE-754
f32multiplier — a faithful port of the proven f64fp_mul: pre-normalize each significand (leading 1 to bit 23), multiply (24×24=48-bit, leading at 46/47), normalize the leading 1 to bit 47, round-to-nearest-ties-even, and pack (overflow→Inf, underflow→subnormal, rounded once from the EXACT product to avoid double-rounding). Proven bit-exact to Rustf32under iverilog.
Functions§
- emit_
fp32_ scalar_ add_ testbench - A self-checking combinational testbench for the scalar
fp32_add: driven(a,b)32-bit vectors fromfp32_add_a.hex/_b.hex, compare the settledyagainst Rust’sf32add oracle infp32_add_o.hex. - emit_
fp32_ scalar_ mul_ testbench - A self-checking combinational testbench for the scalar
fp32_mul: driven(a,b)vectors, compareyagainst Rust’sf32multiply oracle infp32_mul_o.hex. - emit_
simd_ add_ testbench - A self-checking combinational testbench for
simd_{name}: driven(a,b)vectors fromsimd_{name}_a.hex/_b.hex, compare the settledragainst the lane-wise oracle in_o.hex, print PASS. - emit_
simd_ add_ verilog - Emit the packed SWAR add as a COMBINATIONAL Verilog module — the SIMD tile the RTL flow tapes out:
r = ((a & M) + (b & M)) ^ ((a ^ b) & ~M), one datapath op, carry blocked at every lane boundary. Proven ≡ the lane-wise spec under iverilog bysimd_rtl_lock(and ≡ N scalar adds by SAT insimd_tile_lock). - emit_
simd_ fadd_ f16x4_ verilog - Emit the packed F16×4 add tile: four
fp16_addlanes over the 64-bit operands. Modulesimd_fadd_f16x4(portsa,b,r). Compile alongsideFP16_ADD_V; proven ≡eval_lanewise_fadd_f16x4under iverilog. - emit_
simd_ fadd_ f32x2_ verilog - Emit the packed F32×2 add tile: two
fp32_addlanes (low = bits[31:0], high =[63:32]) driven in parallel from the 64-bit operands. Module namesimd_fadd_f32x2(portsa,b,r), so the standard SIMD testbench drives it. Compile alongsideFP32_ADD_V; proven ≡eval_lanewise_fadd_f32x2under iverilog. - emit_
simd_ fmul_ f16x4_ verilog - Emit the packed F16×4 multiply tile: four
fp16_mullanes. Modulesimd_fmul_f16x4. Compile alongsideFP16_MUL_V; proven ≡eval_lanewise_fmul_f16x4under iverilog. - emit_
simd_ fmul_ f32x2_ verilog - Emit the packed F32×2 multiply tile: two
fp32_mullanes in parallel. Module namesimd_fmul_f32x2. Compile alongsideFP32_MUL_V; proven ≡eval_lanewise_fmul_f32x2under iverilog. - eval_
lanewise_ add - Evaluate the lane-wise add SPEC concretely (each lane an independent
width-bit wrapping add). - eval_
lanewise_ fadd_ f16x4 - Packed-float add for F16×4 — the SPEC: four independent scalar binary16 adds. Lanes are isolated (a
NaN/Inf/subnormal in one cannot perturb another); the parallel
fp16FPU lanes realize it in silicon. - eval_
lanewise_ fadd_ f32x2 - Packed-float add for F32×2 (two IEEE-754
f32lanes in one 64-bit word, lane 0 low) — the SPEC: each lane an independent scalarf32add. A NaN/Inf/subnormal in one lane cannot perturb the other; SAT cannot bitblast IEEE arithmetic, sosimd_tile_lockcertifies this by per-lane bit-exactness + a cross-lane non-contamination battery (the way the scalar float lane is already proven). This is the model the parallelfp32FPU lanes realize in silicon. - eval_
lanewise_ fmul_ f16x4 - Packed-float multiply for F16×4 (see
eval_lanewise_fadd_f16x4). - eval_
lanewise_ fmul_ f32x2 - Packed-float multiply for F32×2 (see
eval_lanewise_fadd_f32x2). - f16_add
- One correctly-rounded IEEE-754 binary16 add: widen (exact), add in f32 (exact — the sum of two f16s fits in f32’s 24-bit significand), round back RNE. Equals the native binary16 add bit-for-bit (both correctly rounded).
- f16_mul
- One correctly-rounded IEEE-754 binary16 multiply (see
f16_add; the product of two f16s is exact in f32). - f16_
to_ f32 - Widen an IEEE-754 binary16 bit pattern to
f32— EXACT (every f16 value is representable in f32). - f32_
to_ f16 - Round an
f32to an IEEE-754 binary16 bit pattern, round-to-nearest-ties-even (overflow→Inf, underflow→subnormal/0, NaN→canonical qNaN). The one rounding step in the f16 reference; anchored by known-value assertions insimd_tile_lock. - lanewise_
add_ body - The LANE-WISE reference for packed add — the SPEC: each lane independently computes
(a_j + b_j) mod 2^w, expressed as anAluOpresidual (shift the lane down, add, mask towidth, shift back, OR the lanes). This is “N independent scalar adds” made concrete. - naive_
add_ body - A deliberately NAIVE (non-isolated) packed add — a single 64-bit add. Carry bleeds across lane boundaries, so it must NOT equal the lane-wise spec (the non-vacuity witness for the isolation proof).
- pack_
f16x4 - Pack four f16 lanes into a 64-bit word (lane 0 low).
- pack_
f32x2 - Pack two
f32lanes into one 64-bit word (lane 0 low). - swar_
add_ body - The PACKED SWAR add — one datapath op that blocks carry at every lane boundary:
((a & M) + (b & M)) ^ ((a ^ b) & ~M), whereMclears each lane’s top bit. This is what the SIMD tile emits;simd_tile_lockcertifies it equalslanewise_add_body.