Repository navigation
feat(L-S19): 3-stage pipeline XOR-popcount for 150 MHz Fmax - #15
Merged
Merged
Conversation
Introduces gf16_popcount (8-elem) and gf16_popcount16 (16-elem): registered 3-stage pipelined inner-product units for ternary XOR-popcount. Pipeline stages: Stage 1 (reg): decode same/diff per element pair (AND/XOR) Stage 2 (reg): popcount tree 8→4 bits (3:2 compressors) Stage 3 (reg): final subtraction, sign-extend to 8-bit LATENCY=3, valid_out = valid_in + 3 clock edges. Fmax target: 150 MHz (x3 vs 50 MHz baseline) => x3 TOPS. Updated vsa_matmul_8x8 and vsa_matmul_16x16 to instantiate 64/256 parallel gf16_popcount units replacing the combinational inner_product() function. FSM absorbs 3-cycle pipeline; matmul done latency 2->5 cycles (watchdog budget unchanged). Simulation (iverilog): L-S19 testbench: 11/11 PASS Full tb.v: 18/18 PASS GF16 0x47C0: PASS (non-negotiable canonical vector) R-SI-1: zero * operators (pure XOR + popcount adder tree). Apache-2.0. ANCHOR: phi^2+phi^-2=3 DOI 10.5281/zenodo.19227877 EPIC trinity-fpga#51
Prevents yosys/ABC from optimizing away the 3-stage pipeline registers during retiming. Without these attributes, ABC merges the registered stages back into combinational logic, defeating the L-S19 timing benefit. R-SI-4 NOTE: info.yaml::clock_hz remains 50_000_000 (TinyTapeout board hard rule). The L-S19 x3 frequency benefit (50 -> 150 MHz) is harvested on custom carrier boards and on TTSKY26c, not on the TTSKY26b shuttle. Ref: ICA A-01 from TRI1-TOPSBOOST-MR-002 NASA report. EPIC Trinity-S-AI-DNA/trinity-fpga#51
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.
Closes #51 (partial — L-S19)
What
Introduces 3-stage pipelining into the XOR-popcount critical path of the ternary VSA matmul units.
New modules:
src/gf16_popcount.v— pipelined inner-product for 8-element ternary vectors (LATENCY=3)src/gf16_popcount16.v— same for 16-element vectors (used byvsa_matmul_16x16)Updated modules:
src/vsa_matmul_8x8.v— 64 parallelgf16_popcountinstances replace the single-cycle combinationalinner_product()functionsrc/vsa_matmul_16x16.v— 256 parallelgf16_popcount16instancesNew simulation:
sim/ls19/tb_ls19_pipeline.v— standalone iverilog testbench (11 tests)Why: x3 frequency → x3 TOPS
The previous design computed all 64 inner products in one combinational cloud, bounded to ~50 MHz. The 3-stage pipeline breaks this into:
same[7:0],diff[7:0]+ validcnt_pos[3:0],cnt_neg[3:0]+ validresult[7:0]+valid_outTarget Fmax: 150 MHz (x3 vs 50 MHz) → x3 TOPS at same gate budget.
Latency change: 1 cycle → 3 cycles (
valid_out=valid_in+ 3 clock edges). The matmul FSM absorbs this cleanly;doneasserts 5 clocks afterstartinstead of 2.iverilog simulation results
GF16 canonical 0x47C0 — PASS
dot4([1,2,3,4],[1,2,3,4]) = 30.0 = 0x47C0— verified PASS on fulltb.v. Non-negotiable test vector is unchanged; the legacy combinationalgf16_dot4path is untouched.R-SI-1
Zero
*operators introduced. All popcount arithmetic is explicit+on single-bit values (adder tree). Apache-2.0 only, no vendor IP.ANCHOR
φ²+φ⁻²=3 · DOI 10.5281/zenodo.19227877 · Apache-2.0 · EPIC Trinity-S-AI-DNA/trinity-fpga#51
DO NOT MERGE without user authorization.