hpc-labs.ai

AI-boosted software optimizations/refactoring. From code to silicon - measured and verified.

All samples

ParetoStack-chip 1.5.8: five FPGA samples to judge before installing

Ces pages d’exemples sont en anglais.

All designs are small samples that ship in the release. All samples were written for the product, so they do not predict gains on your design. Target: Lattice iCE40 HX8K (sample 5: ECP5-25k), open-source tools (Yosys 0.70, nextpnr). The measure is the highest clock frequency. A rewrite here adds latency: results come out one or more clocks later. Whether that is acceptable depends on your system.

Two kinds of figures, kept apart. "Tool estimate" is the timing model of the place-and-route tool. "Board" is the highest clock at which a placed design passed every test on one physical board, measured by a separate test setup of ours. The product itself does not program or measure hardware.

Limits of the board figures
  • One board (Lattice iCE40-HX8K breakout), one chip, one room, 2026-11-28 and 29; temperature and supply voltage neither controlled nor recorded.
  • The design sits inside a test circuit with its own stimulus, pins and constraints, so it is not placed as in the tool runs. Outputs were compared with simulation of the original design.
  • A passing clock covers only the paths the test inputs exercise. It is not a guaranteed maximum or a timing signoff. Pass rule: 20 runs in a row; in repeats of 200 runs, 4 of 48 reported maxima failed (including one placement each of samples 2 and 3).
  • Clock steps are about 3 to 4.5 % apart. Power was not measured. No other chip, board or vendor tool was tried.

1. 8-tap FIR filter: adder chain pipelined

gain on tool and board+3 samples latency

On a narrow screen, scroll the listing sideways: the optimized version is on the right.

Original: fir8.vOptimized by the product
unchanged lines not shown
17 wire signed [W+7:0] p5 = d5 * 23;17 wire signed [W+7:0] p5 = d5 * 23;
18 wire signed [W+7:0] p6 = d6 * -11;18 wire signed [W+7:0] p6 = d6 * -11;
19 wire signed [W+7:0] p7 = d7 * 5;19 wire signed [W+7:0] p7 = d7 * 5;
20 wire signed [W+7:0] sum = p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7;20 reg signed [W+7:0] sum_p0_0, sum_p0_1, sum_p0_2, sum_p0_3, sum_p0_4, sum_p0_5, sum_p0_6, sum_p0_7, sum_p1_0, sum_p1_1, sum_p1_2, sum_p1_3, sum_p2_0, sum_p2_1;
2121
22 always @(posedge clk) begin22 always @(posedge clk) begin
23 if (rst) begin23 if (rst) begin
24 {d0, d1, d2, d3, d4, d5, d6, d7} <= 0;24 {d0, d1, d2, d3, d4, d5, d6, d7} <= 0;
25 y <= 0;25 y <= 0; sum_p0_0 <= 0; sum_p0_1 <= 0; sum_p0_2 <= 0; sum_p0_3 <= 0; sum_p0_4 <= 0; sum_p0_5 <= 0; sum_p0_6 <= 0; sum_p0_7 <= 0; sum_p1_0 <= 0; sum_p1_1 <= 0; sum_p1_2 <= 0; sum_p1_3 <= 0; sum_p2_0 <= 0; sum_p2_1 <= 0;
26 yv <= 0;26 yv <= 0;
27 end else begin27 end else begin
28 yv <= valid;28 yv <= valid;
29 if (valid) begin29 if (valid) begin
30 d0 <= x; d1 <= d0; d2 <= d1; d3 <= d2; d4 <= d3; d5 <= d4; d6 <= d5; d7 <= d6;30 d0 <= x; d1 <= d0; d2 <= d1; d3 <= d2; d4 <= d3; d5 <= d4; d6 <= d5; d7 <= d6;
31 y <= sum;31 sum_p0_0 <= p0;
32 sum_p0_1 <= p1;
33 sum_p0_2 <= p2;
34 sum_p0_3 <= p3;
35 sum_p0_4 <= p4;
36 sum_p0_5 <= p5;
37 sum_p0_6 <= p6;
38 sum_p0_7 <= p7;
39 sum_p1_0 <= sum_p0_0 + sum_p0_1;
40 sum_p1_1 <= sum_p0_2 + sum_p0_3;
41 sum_p1_2 <= sum_p0_4 + sum_p0_5;
42 sum_p1_3 <= sum_p0_6 + sum_p0_7;
43 sum_p2_0 <= sum_p1_0 + sum_p1_1;
44 sum_p2_1 <= sum_p1_2 + sum_p1_3;
45 y <= sum_p2_0 + sum_p2_1;
32 end46 end
33 end47 end
34 end48 end
unchanged lines not shown

The rewrite shown is what release 1.5.8 writes. It is byte for byte the file of the 1.5.5 run and the file that ran on the board.

Tool estimate (place-and-route timing model, not hardware)

RunOriginalRewriteRatioLogic cellsAdded latency
Release 1.5.5, 2026-11-21, 2 seeds59.5 MHz135.9 MHz2.28x929 to 7233
Development version, 2026-11-13, 10 seeds66.3 MHz133.5 MHz2.01x929 to 7233

Measured on one FPGA board (highest clock that passed)

Placements (seeds)OriginalRewriteBoard ratioTool ratio on the same placements
376.5 MHz162 MHz2.12x2.04x
1075 MHz162 MHz2.16x2.06x

Checked by: simulation: the rewrite's output stream equals the original's, delayed by the added latency, under the sample's testbench; the synthesized netlist matches at gate level; and both designs were driven with the same random inputs (19,999 cycles). This is simulation, not a formal proof.

A rejection seen on this design: in an early development run (2026-10-26) two synthesis settings gave netlists that did not compute the design (one stuck at zero, one almost empty). The gate-level simulation rejected both. Their speed was irrelevant; the settings were corrected afterwards.

2. 16 x 16 multiply-accumulate: multiplier split

gain on tool and board+1 clock latency

On a narrow screen, scroll the listing sideways: the optimized version is on the right.

Original: mul16.vOptimized by the product
unchanged lines not shown
8);8);
9 reg [15:0] a_r, b_r;9 reg [15:0] a_r, b_r;
10 reg [31:0] p_r;10 reg [31:0] p_r;
11 wire [31:0] prod = a_r * b_r;11 reg [31:0] prod_m0, prod_m1, prod_m2, prod_m3;
12 always @(posedge clk) begin12 always @(posedge clk) begin
13 if (rst) begin13 if (rst) begin
14 a_r <= 0; b_r <= 0; p_r <= 0; acc <= 0;14 a_r <= 0; b_r <= 0; p_r <= 0; prod_m0 <= 0; prod_m1 <= 0; prod_m2 <= 0; prod_m3 <= 0; acc <= 0;
15 end else begin15 end else begin
16 a_r <= a;16 a_r <= a;
17 b_r <= b;17 b_r <= b;
18 p_r <= prod;18 prod_m0 <= a_r * b_r[3:0];
19 prod_m1 <= a_r * b_r[7:4];
20 prod_m2 <= a_r * b_r[11:8];
21 prod_m3 <= a_r * b_r[15:12];
22 p_r <= prod_m0 + (prod_m1 << 4) + (prod_m2 << 8) + (prod_m3 << 12);
19 acc <= acc + p_r;23 acc <= acc + p_r;
20 end24 end
21 end25 end
unchanged lines not shown

The rewrite shown is what release 1.5.8 writes. It is byte for byte the file of the 1.5.5 run and the file that ran on the board.

Tool estimate (place-and-route timing model, not hardware)

RunOriginalRewriteRatioLogic cellsAdded latency
Release 1.5.5, 2026-11-21, 2 seeds69.4 MHz103.2 MHz1.49x730 to 6261
Development version, 2026-11-13, 10 seeds70.2 MHz104.2 MHz1.48x730 to 6261

Measured on one FPGA board (highest clock that passed)

Placements (seeds)OriginalRewriteBoard ratioTool ratio on the same placements
381 MHz126 MHz1.56x1.45x
1084 MHz126 MHz1.50x1.47x

Checked by: simulation: the rewrite's output stream equals the original's, delayed by the added latency, under the sample's testbench; the synthesized netlist matches at gate level; and both designs were driven with the same random inputs (19,999 cycles). This is simulation, not a formal proof.

3. 8-bit ALU: the estimated gain mostly did not hold on the board

gain size not confirmed+1 clock latency

The rewrite is functionally correct and passed every check. Its size of gain did not survive on the board.

On a narrow screen, scroll the listing sideways: the optimized version is on the right.

Original: alu8.vOptimized by the product
unchanged lines not shown
10);10);
11 reg [2:0] op_r; reg [7:0] a_r, b_r;11 reg [2:0] op_r; reg [7:0] a_r, b_r;
12 reg [15:0] r;12 reg [15:0] r;
13 reg [2:0] op_r_dly;
14 reg [7:0] a_r_dly;
15 reg [7:0] b_r_dly;
16 reg [15:0] r_m0, r_m1;
13 always @* begin17 always @* begin
14 case (op_r)18 case (op_r_dly)
15 3'd0: r = a_r + b_r;19 3'd0: r = a_r_dly + b_r_dly;
16 3'd1: r = a_r - b_r;20 3'd1: r = a_r_dly - b_r_dly;
17 3'd2: r = a_r & b_r;21 3'd2: r = a_r_dly & b_r_dly;
18 3'd3: r = a_r | b_r;22 3'd3: r = a_r_dly | b_r_dly;
19 3'd4: r = a_r ^ b_r;23 3'd4: r = a_r_dly ^ b_r_dly;
20 3'd5: r = a_r << b_r[2:0];24 3'd5: r = a_r_dly << b_r_dly[2:0];
21 3'd6: r = a_r * b_r;25 3'd6: r = r_m0 + (r_m1 << 4);
22 default: r = {8'b0, a_r} + {8'b0, b_r} + 16'd1;26 default: r = {8'b0, a_r_dly} + {8'b0, b_r_dly} + 16'd1;
23 endcase27 endcase
24 end28 end
25 always @(posedge clk) begin29 always @(posedge clk) begin
26 if (rst) begin op_r <= 0; a_r <= 0; b_r <= 0; y <= 0; zero <= 1; end30 if (rst) begin op_r <= 0; a_r <= 0; b_r <= 0; y <= 0; op_r_dly <= 0; a_r_dly <= 0; b_r_dly <= 0; r_m0 <= 0; r_m1 <= 0; zero <= 1; end
27 else begin op_r <= op; a_r <= a; b_r <= b; y <= r; zero <= (r == 0); end31 else begin op_r <= op; a_r <= a; b_r <= b; op_r_dly <= op_r; a_r_dly <= a_r; b_r_dly <= b_r; r_m0 <= a_r * b_r[3:0]; r_m1 <= a_r * b_r[7:4]; y <= r; zero <= (r == 0); end
28 end32 end
29endmodule33endmodule

The rewrite shown is what release 1.5.8 writes. It is byte for byte the file of the 1.5.5 run and the file that ran on the board.

Tool estimate (place-and-route timing model, not hardware)

RunOriginalRewriteRatioLogic cellsAdded latency
Release 1.5.5, 2026-11-21, 2 seeds76.1 MHz124.7 MHz1.64x309 to 3141
Development version, 2026-11-13, 10 seeds76.5 MHz118.2 MHz1.55x309 to 3141

Measured on one FPGA board (highest clock that passed)

Placements (seeds)OriginalRewriteBoard ratioTool ratio on the same placements
394.5 MHz102 MHz1.08x1.16x
1093 MHz102 MHz1.10x1.16x

Checked by: simulation: the rewrite's output stream equals the original's, delayed by the added latency, under the sample's testbench; the synthesized netlist matches at gate level; and both designs were driven with the same random inputs (19,999 cycles). This is simulation, not a formal proof.

Reason, as far as it is established: inside the larger test circuit the tool's own estimate for the same placements was only 1.16x, and the board agreed with that. A further analysis made after the results were known (tool only, not run on the board) indicates that most of the loss comes from how the synthesis tool mapped the rewritten ALU once it was merged into the larger circuit. A gain estimated on a design alone may not survive inside the design that contains it. With the same seed numbers the rewrite was still higher in all 10 pairs, by 1.03x to 1.22x; over all 10 placements the two sets of results touch at 99 MHz.

4. CRC-32: no gain

no gain: keep the original
Show the original (crc32.v); there is no optimized version
// CRC-32 (IEEE 802.3) of a byte stream, 8 bits per clock, written the straightforward way: a loop that updates the CRC bit by bit, all eight steps in ONE clock cycle (a long XOR chain between registers). module crc32 ( input clk, input rst, input valid, input [7:0] data, output reg [31:0] crc ); reg [31:0] c; integer i; always @* begin c = crc ^ {24'b0, data}; for (i = 0; i < 8; i = i + 1) c = c[0] ? (c >> 1) ^ 32'hEDB88320 : (c >> 1); end always @(posedge clk) begin if (rst) crc <= 32'hFFFFFFFF; else if (valid) crc <= c; end endmodule

Tool estimate (release 1.5.5, 2026-11-21, 2 seeds)

RowFmaxLogic cells
Original (baseline)294.6 MHz51
Best other synthesis or place-and-route setting294.6 MHz (equal), the others slower51 or more
Source rewritenone offered

The recorded reasons: no sum of four or more terms to pipeline; no multiplication in the file. Release 1.5.8 gives the same two notes. The design was not run on the board.

5. SystemVerilog ALU on ECP5: measured but not counted

not counted: could not be checked
Show the original (alu_sv.sv); there is no optimized version
// The same 8-bit ALU as hw_alu8, in SystemVerilog: package types, always_comb, always_ff, a unique case. module alu_sv import alu_pkg::*; ( input logic clk, input logic rst, input cmd_t cmd, output logic [15:0] y, output logic zero ); cmd_t c_r; logic [15:0] r; always_comb begin unique case (c_r.op) ADD: r = 16'(c_r.a) + 16'(c_r.b); SUB: r = 16'(c_r.a) - 16'(c_r.b); AND_: r = 16'(c_r.a & c_r.b); OR_: r = 16'(c_r.a | c_r.b); XOR_: r = 16'(c_r.a ^ c_r.b); SHL: r = 16'(c_r.a) << c_r.b[2:0]; MUL: r = 16'(c_r.a) * 16'(c_r.b); INC: r = 16'(c_r.a) + 16'(c_r.b) + 16'd1; endcase end always_ff @(posedge clk) begin if (rst) begin c_r <= '0; y <= '0; zero <= 1'b1; end else begin c_r <= cmd; y <= r; zero <= (r == 16'd0); end end endmodule

Tool estimate (release 1.5.5, 2026-11-21, 2 seeds)

RowFmax medianLogic cellsVerdict
Default synthesis (uses a hard multiplier block)88.8 MHz229unverified: measured, not counted
Without the hard multiplier block89.5 MHz441checked: becomes the reference

The recorded reason: "measured but NOT counted: no check of the netlist could run. Gate-level simulation with the testbench: no simulation model for a block the netlist uses: 'MULT18X18D'." The random simulation could not build the netlist either. No source rewrite is offered for this file. Not run on the board.