Repository navigation
feat(vsa): ternary matmul kernel — XOR + popcount, 0 DSP - #12
Merged
Merged
Conversation
Phase 2 of issue #7: ternary matmul over VSA ALU Verilog: - vsa_matmul.v: 64x64 ternary matmul using bind (ternary multiply) + popcount for dot product — 0 DSP48 blocks - tb_vsa_matmul.v: testbench with self-test weights, 64/64 PASS Rust (FP-01): - Gf16Binary parser (magic + multi-tensor format) - TernaryWeightConverter: GF16 → ternary {-1, 0, +1} quantization - Packed trit output (2 bits/trit, 32 trits/u64) for Verilog - Verilog .mem file writer for BRAM initialization Tests: 21/21 cargo test, 64/64 iverilog, 0 clippy warnings
This was referenced May 6, 2026
Open
This was referenced May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #7 (Phase 2)
Ternary matrix-vector multiply over VSA ALU — pure LUT logic, zero DSP48 blocks.
Verilog (
fpga/vsa/)vsa_matmul.v— 64×64 sequential ternary matmul using VSA bind (element-wise ternary multiply) + popcount for signed dot product. Register-based weights, combinational bind+popcount, 1 row/clock latency.tb_vsa_matmul.v— self-checking testbench: 64/64 PASS (iverilog 13.0)Rust (
rings/FP-01/)Gf16Binary— parser forigla_champion_gf16.binformat (magic0x47463136, multi-tensor)TernaryWeightConverter— GF16 u16 → ternary {-1, 0, +1} quantization with configurable thresholdvsa_bind.v), 32 trits/u64 wordwrite_verilog_mem()— generates$readmem-compatible.memfiles for BRAM initVerification
cargo test --workspace: 21/21 PASS (8 FP-00 + 9 FP-01 + 4 FP-02)iverilog tb_vsa_matmul: 64/64 PASScargo clippy --workspace: 0 warningsArchitecture
φ² + φ⁻² = 3 | TRINITY