Research status
I retain this bench as a teaching archive. Of the four reserved coefficient pairs, one improved estimated routed delay over separate minimum chains. Published methods already optimize adder sharing and its FPGA cost. I keep the designs and certificates so the local comparison can be reproduced. Kumm, Multiple Constant Multiplication Optimizations for Field Programmable Gate Arrays
Share two multiplications
I checked all 16 inputs for each of 136 unordered pairs, including equal pairs. Sharing saves an operation for 31 pairs against separate calculations. After iCE40 synthesis, (7,11) goes from 10 to 9 LUTs and from 1 to 4 carry cells. Both descriptions of (3,6) give 3 LUTs and 2 carries. After routing (7,11) on HX8K-CT256 I get 2.968 ns and 16 cells for the direct expression, 3.465 ns and 20 cells for sharing, on each of five seeds. Reference values Interactive experiment · AT.EX18.05
I provide truth tables for checking a modular arithmetic component.
Use case
A circuit simulator must specify the action on every register word, including unused residue codes. My example applies r ↦ 2r+b modulo an odd prime and fixes the unused words.
Contribution
For p=3,5,7,11 and both control bits, I check that the entire truth table is a permutation and that its inverse restores every word. For p=5 and b=1, the three-bit table is 1,3,0,2,4,5,6,7. This is a compact fixture for gate synthesis.
Next step
I will compare synthesis by modular addition against synthesis by transpositions on identical inputs and with the same register clean-up. The published gate count belongs to one construction. Relevance to hardware also depends on connectivity.
Reproducing the example
After extracting the files, I run python experience.py (Python 3.10+). The file resultats.json contains the reference output.
Prior work
Updated comparison
I now have an arithmetic baseline for the same predicate. At level 67 I move from 26,307,547 to 2,250,827 gates and from 105 to 192 bits. The next comparison requires a specialised adder with a stated ancilla budget and topology. Measurement and assumptions
Control from XII
I supply the XII construction of the in-place gate list and verify 2,116 valid inputs forwards and backwards. D09 uses a different off-domain specification from the historical control. I run python temoin_xii.py and compare with controle-xii.json. I also run python compositions.py to reproduce the 20-transformation library certificate. FPGA lead
My XIII control
I run python blocs.py to check 1,170 inputs of the block Horner step under both XIII compilations, forward and inverse.
Checking the mapped truth table
I run python synthese.py to interpret the supplied netlists and check all eight rows for each design. With python synthese.py --yosys PATH --export new.json I also rebuild the circuit from mod5.v and evaluate its RTL in Yosys. The script uses synth_ice40 -device hx with ABC9. The two single-output LUTs have decimal initialisation values 52,284 and 53,184. The middle input bit connects directly to its output. The constant words 101101 and 00 therefore cost the same in this model. Minimality proof · FPGA dossier
When do saved Toffolis compensate for the other gates?
I fix the reversible corpus circuits at prime 67 and assign unit cost to X and CNOT. The Cuccaro variant reduces Toffolis from 282,891 to 217,155 with more gates and bits. Its weighted cost is lower when one Toffoli costs more than 119/22. I replay addition and its inverse on 5,460 inputs.
I run python temoin_xiv.py to replay my local check and keep its output in controle-xiv.json. When do saved Toffolis compensate for the other gates? · Cuccaro et al., A new quantum ripple-carry addition circuit · Draper et al., A logarithmic-depth quantum carry-lookahead adder
Six live digits on iCE40 HX
I run python chiffres.py to verify the six supplied netlists. To rebuild the three RTL descriptions and their mappings I use python chiffres.py --yosys PATH --export new.json with Yosys 0.71 and iCE40/ABC9 support. The testbench asks Yosys for all 512 outputs of each description. My interpreter evaluates each LUT with its mapped truth table and each carry as the majority of three inputs. I store a digest of the 512 truth bytes in address order 64r+b.
Default mode counts LUT4s and SB_CARRY cells separately. In the second mode I apply -nocarry -nobram to all descriptions and check that only LUTs remain. LUT depth counts LUTs on a path, while cell depth also counts carries. Signed pairs give depth five and 25 LUTs, and Horner gives depth seven and 23 LUTs in LUT-only mode. The minimum circuit size remains open. Contract, costs and references · Routing question
Four circuits on the same FPGA
I compute (64r+b) modulo 5 for 0≤r<5 and 0≤b<64, returning r for the remaining three codes. The three pairs of bits in b have alternating weights modulo 5. I compare the resulting signed sum, six Horner steps, a full table and three small lookup stages reading two bits each. I verify all 512 inputs for every description, both synthesis modes and the function between the two register banks. An input sampled at edge t produces its output at edge t+1.
I fix Yosys 0.71, nextpnr 0.11.1, an iCE40 HX8K-CT256, the pin assignment and a 100 MHz target. With carry chains and block RAM disabled, I find 5.474 ns for signed pairs and 7.434 ns for Horner on every one of five seeds, a 26.4% delay reduction. The full table ranges from 7.763 to 8.218 ns, with a median of 8.190 ns. The three lookup stages take 9.436 ns on every seed. The lower delay costs area in this example. Signed pairs take 25 LUT4s and 36 placed logic cells including the registers, compared with 23 LUT4s and 34 cells for Horner. I provide the register-to-register paths from the router's delay model. Board measurements remain open. Measurements and synthesis files · Small constant division, Ugurdag et al. · nextpnr router

I run python routage.py to check the netlists, all 512 values and the twenty recorded critical paths. To rebuild them I run python routage.py --rebuild YOSYS_PATH NEXTPNR_PATH --export new-reports.json. I use the HX8K model, CT256 package and seeds 1 to 5. rapports-07.json includes utilisation and every segment of the path. Placement can pack the output register into the final LUT cell.
Direct remainder, carry chains and the move to eight bits
I add a Verilog description applying % 5 directly to the concatenated residue and input word. Residue codes 5 to 7 pass through. At eight bits the valid-state function is (256r+b) modulo 5. The coefficient of r changes from −1 to +1 and the four base-four digits have alternating signs. I check 512 inputs at six bits and 2,048 at eight bits for each circuit, including after mapping. I fix the HX8K-CT256, registers, pins within each width, a 100 MHz target and five seeds. I save 90 reports and reproduce the twenty timing controls from the earlier harness.
With standard carry-enabled mapping my six-bit medians are 5.950 ns for signed pairs, 11.074 ns for Horner and 19.691 ns for a direct remainder. At eight bits I obtain 7.049, 13.692 and 24.843 ns, using 47, 55 and 69 placed cells respectively. Three lookup stages at six bits take 9.436 ns and four at eight bits take 13.342 ns. At eight bits the staged lookup narrowly overtakes Horner under standard mapping and trails it with LUTs alone. At seed one in standard mapping the Horner path spends 8.232 ns in routing and 4.585 ns in logic. The staged version gives 8.330 and 4.165 ns in the same categories. Register contributions are also recorded. Allowing carries changes the area trade-off: at six bits signed pairs use 33 cells against 43 for Horner, while the LUT-only harness used 36 against 34. The router's timing model supplies these delays. Results and paths · Small constant division · nextpnr
An initial transfer to binary inference
I fix four threshold neurons, eight bipolar inputs and weights equal to −1 or +1. The dot product is twice the number of matching signs minus eight. I check the identity for all 65,536 pairs of eight-bit masks. I compare an unrolled signed sum with a match-count tree on every one of the 256 activations. With common registers and pins the median falls from 7.042 to 4.949 ns and occupancy from 128 to 41 cells over five HX8K seeds. Each circuit emits four decisions per cycle after filling. Weights and thresholds are fixed in the circuit. End-to-end inference still requires trained weights and measurements of memory, transfers and accuracy. FINN and FINN-R already implement quantized inference on FPGAs. My contribution here is the checkable harness and its target-specific result. Inference dossier · FINN · FINN-R
I run python porter.py and python neurones.py. Both accept --rebuild YOSYS_PATH NEXTPNR_PATH --export new.json to rebuild circuits and routes from Verilog. Both harnesses use Yosys 0.71 and nextpnr 0.11.1.
The reduction flag depends on its domain
For 0≤x,c<p I recover the reduction flag from y<c, where y=(x+c) mod p. I check 3,354 cases. At p=3 and c=1, x=0 and x=3 both produce y=1 with different flags. The supplied complete gate count at 67 remains above bitwise Horner.
My next test is to cost the extra information required to widen the domain. AT.D1 · Cuccaro et al., A new quantum ripple-carry addition circuit
I run python drapeau09.py.
A trained layer exposes a sharing-cost failure
I train four bipolar thresholds on 160 synthetic inputs. All four bits are correct together on 29 of 96 held-out inputs (304 correct bits out of 384). I verify three circuits on all 256 inputs. Across five HX8K routes each, median delay and cell count are 9.296 ns and 128 for signed sums, 5.593 ns and 43 for balanced popcount, and 7.742 ns and 58 for the partition chosen among 35. Minimising distinct counters fails to beat the reference.
I hard-wire the weights and launch eight input bits for four output bits. With common register banks, a 100 MHz parallel interface can issue one vector per cycle when the selected seed meets timing. The signed sum reaches 10.052 ns on one seed. In a half-duplex scenario that sends eight bits, waits one cycle and reads four bits, all three descriptions take thirteen cycles per vector. This is a calculated interface budget. Board throughput remains unmeasured. After interrupting the default router on the fourth signed-sum seed, I used router2 for all fifteen measurements. From the kit I run python apprendre.py --rebuild YOSYS NEXTPNR --export rebuilt.json to regenerate the reports.
My next test is to route several tied partitions and compare fan-out and depth. AT.H10 · Umuroglu et al., FINN
I run python apprendre.py.
One bit to recover the original representative
I retain the sheet ⌊x/p⌋ for x in [0,2p). The pair ((x+c) mod p, sheet) is invertible for fixed c. Two preimages per residue require one extra bit. I check p = 3,5,7,11. For a separate fixed modular kernel I verify 2,048 inputs against its HX8K netlist and all 16,384 cases of its XOR lift. My compute-copy-uncompute construction uses two compute passes and three bit copies in this model.
I plan to decompose computation and uncomputation in the same gate library to measure depth and workspace. AT.D2 · Cuccaro et al., A new quantum ripple-carry addition circuit
I run python domaine10.py.
Seven counters outperform two six-counter partitions on a frozen layer
I route three partitions of one binary layer on HX8K with five seeds each and check all 256 possible inputs. The two six-counter partitions give estimated median delays of 7.742 and 7.623 ns. The seven-counter partition gives 6.405 ns. The specialised reference achieves 5.593 ns and 43 cells against 57 for the seven-counter partition. Ports require eight input and four output bits. In my one-bit serial protocol a transaction takes thirteen cycles. These results describe place-and-route for a synthetic layer.
I plan to commit to a depth-based prediction before routing additional partitions with the same seeds. AT.H11 · Umuroglu et al., FINN
I run python partitions10.py.
When cleaning copies adds a layer
For four mod-four residue predicates I compare signed-control gates. The sequential circuit takes four gates and four layers. Six clean ancillas enable parallel computation, but copying and cleanup bring the total to sixteen gates and five layers. I verify every input with zero initial workspace and outputs.
Measure placement and negative controls in a specified gate library. AT.D3 · Cuccaro et al., A new quantum ripple-carry addition circuit
Two partitions reverse the expected ranking
I predict depths eight and seven for six and seven counters. After synthesis I get seven and eight. Across five HX8K routing seeds the median delays are 6.685 and 7.686 ns. The specialised reference remains at 5.593 ns. Output quality is identical.
Test held-out weights and a cost fixed before routing, then measure on a board. AT.H12 · Umuroglu et al., FINN
Charging for negative controls
I take X, CNOT and positive-control Toffoli gates, with two inputs, four arbitrary targets and clean ancillas. The serial circuit visits the four polarities with four flips, minimal for this schedule, plus four Toffolis. The parallel version uses 24 gates on twelve wires in seven layers against eight gates on six wires in eight layers. I check 64 inputs per version and uncomputation.
I will compare under a coupling topology with explicit swap costs. AT.D4 · Cuccaro et al., A new quantum ripple-carry addition circuit
Changing weights while preserving the function up to symmetry
I complement all eight weight bits, retain thresholds and compare equivalent descriptions on HX8K across five seeds. I check all 256 outputs by conjugating the input. The minimum-counter partition uses six counters, 55 cells and a 7.686 ns median delay against 43 cells and 5.264 ns for popcount. My predicted gain fails. The transported evaluation retains 29/96 exact classes.
I will fix weights outside this symmetry and measure on a physical target when available. AT.H13 · Umuroglu et al., FINN
Restoring data on a line of gates
I fix a reversible two-input, four-output decoder and restore placement after every gate. On the line, serial and copy-based descriptions require 12 and 92 swaps for 8 and 24 logical gates. I check all 64 inputs, including initial output values and ancilla cleanup. I also apply the median gathering method of XX.D02.
Allow placement to persist between gates and check cost across the whole circuit. AT.D5 · Cuccaro et al., A new quantum ripple-carry addition circuit
Testing a prediction on different binary weights
I fix weights 01, 07, 3F, FF and four thresholds of two before five HX8K placements. The pairwise weight distances differ from the previous family. Both descriptions agree on all 256 logical outputs. Popcount wins on delay for all five seeds, median 6.209 ns and 46 cells versus 6.735 ns and 44 cells. These weights classify 9 of 96 held-out inputs correctly. I measure the circuit trade-off here.
Reserve trained weights meeting an accuracy target and measure end-to-end cost. AT.H14 · Umuroglu et al., FINN
Check the gain after FPGA routing
I enumerate minimum chains modulo 16, then synthesize both outputs jointly or from separate minimum chains. I allow synthesis to merge logic, prove combinational equivalence to multiplication by SAT, and hold the HX8K-CT256 target, pins, registers and 100 MHz timing constraint fixed. Of the four reserved pairs, (9,11) goes from 3.465 to 2.562 ns and from 19 to 14 logic cells. The other three pairs tie on delay on all three seeds. I measure the router’s timing estimate.
Change the inputs · AT.EX19.05 · Voronenko & Püschel · Multiple constant multiplication · Yosys · synth_ice40
I reproduce · python place19.py YOSYS NEXTPNR_ICE40
Download bilingual starter kit ↓