feat: add FPGA-Neural benchmark tooling + same-tier ECP5 P2/P4/P8 results

tools/fpga_benchmark.py: parametric Yosys + nextpnr-ecp5 benchmark
harness for the LFE5U-45F-8BG381 (speed grade -8, 80 MHz target),
sweeping PARALLEL over the neuron layer and parsing Fmax/LUT4/DFF/DSP
utilization out of the nextpnr report into JSON/CSV.

synth/ecp5/p2, p4, p8: real synthesis+PnR results backing the
same-price-tier FPGA comparison (P2: 87.88 MHz PASS, P4: 75.01 MHz
FAIL, P8: 147.62 MHz PASS -- non-monotonic, dominated by placement
noise since the whole design uses <2% of the device's LUT4 fabric at
every setting, and P8 notably maps to 0 DSP blocks vs 8/16 for P2/P4).

synth/ecp5/top.v: benchmark harness top-level, reworked to generate
deterministic non-constant X/weights/bias via `keep`-attributed
generate blocks so Yosys can't constant-fold the datapath away.

Also adds .gitignore for Python's __pycache__/*.pyc.
This commit is contained in:
2026-09-02 19:48:03 +02:00
parent 233d6ff7fb
commit cfd5e98a0e
28 changed files with 230527 additions and 49 deletions
+4
View File
@@ -0,0 +1,4 @@
target_id,fpga,family,parallel,n_inputs,n_neurons,status,fmax_mhz,period_ns,slack_ns,lut,ff,dsp,lut_pct,ff_pct,dsp_pct,mac_per_cycle,groups_per_neuron,total_mac,cycles_per_layer,cost_eur,mac_per_second,mac_per_euro,build_time_s,error
ecp5_45f,LFE5U-45F-8BG381,ECP5,8,256,4,FAIL,,,,,,,,,,32,32,32,32,35.0,,,,nextpnr placement/routing failed
ecp5_45f,LFE5U-45F-8BG381,ECP5,4,256,4,FAIL,,,,,,,,,,16,64,16,64,35.0,,,,nextpnr placement/routing failed
ecp5_45f,LFE5U-45F-8BG381,ECP5,2,256,4,PASS,,,,,,,,,,8,128,8,128,35.0,,,1.504363291998743,
1 target_id fpga family parallel n_inputs n_neurons status fmax_mhz period_ns slack_ns lut ff dsp lut_pct ff_pct dsp_pct mac_per_cycle groups_per_neuron total_mac cycles_per_layer cost_eur mac_per_second mac_per_euro build_time_s error
2 ecp5_45f LFE5U-45F-8BG381 ECP5 8 256 4 FAIL 32 32 32 32 35.0 nextpnr placement/routing failed
3 ecp5_45f LFE5U-45F-8BG381 ECP5 4 256 4 FAIL 16 64 16 64 35.0 nextpnr placement/routing failed
4 ecp5_45f LFE5U-45F-8BG381 ECP5 2 256 4 PASS 8 128 8 128 35.0 1.504363291998743
+83
View File
@@ -0,0 +1,83 @@
[
{
"target_id": "ecp5_45f",
"fpga": "LFE5U-45F-8BG381",
"family": "ECP5",
"parallel": 8,
"n_inputs": 256,
"n_neurons": 4,
"status": "FAIL",
"fmax_mhz": null,
"period_ns": null,
"slack_ns": null,
"lut": null,
"ff": null,
"dsp": null,
"lut_pct": null,
"ff_pct": null,
"dsp_pct": null,
"mac_per_cycle": 32,
"groups_per_neuron": 32,
"total_mac": 32,
"cycles_per_layer": 32,
"cost_eur": 35.0,
"mac_per_second": null,
"mac_per_euro": null,
"build_time_s": null,
"error": "nextpnr placement/routing failed"
},
{
"target_id": "ecp5_45f",
"fpga": "LFE5U-45F-8BG381",
"family": "ECP5",
"parallel": 4,
"n_inputs": 256,
"n_neurons": 4,
"status": "FAIL",
"fmax_mhz": null,
"period_ns": null,
"slack_ns": null,
"lut": null,
"ff": null,
"dsp": null,
"lut_pct": null,
"ff_pct": null,
"dsp_pct": null,
"mac_per_cycle": 16,
"groups_per_neuron": 64,
"total_mac": 16,
"cycles_per_layer": 64,
"cost_eur": 35.0,
"mac_per_second": null,
"mac_per_euro": null,
"build_time_s": null,
"error": "nextpnr placement/routing failed"
},
{
"target_id": "ecp5_45f",
"fpga": "LFE5U-45F-8BG381",
"family": "ECP5",
"parallel": 2,
"n_inputs": 256,
"n_neurons": 4,
"status": "PASS",
"fmax_mhz": null,
"period_ns": null,
"slack_ns": null,
"lut": null,
"ff": null,
"dsp": null,
"lut_pct": null,
"ff_pct": null,
"dsp_pct": null,
"mac_per_cycle": 8,
"groups_per_neuron": 128,
"total_mac": 8,
"cycles_per_layer": 128,
"cost_eur": 35.0,
"mac_per_second": null,
"mac_per_euro": null,
"build_time_s": 1.504363291998743,
"error": null
}
]