generic: Improve the example for K != 4

Configuring K < 4 used to result in "dangling" inputs to the cells being
generated (those are just not driven by anything in the resulting Verilog/JSON).

Configuring K > 4 used to result in an assertion crash in cells.cc.

The ctx.setLutK call fixes both cases.
This commit is contained in:
Josef Gajdusek 2026-04-25 00:09:17 +02:00
parent 7f1fa155d3
commit e73506104b
3 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,8 @@ from simple_config import *
def is_io(x, y):
return x == 0 or x == X-1 or y == 0 or y == Y-1
ctx.setLutK(K)
for x in range(X):
for y in range(Y):
# Bel port wires

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -ex
export PYTHONPATH=$(dirname $0)
yosys -p "tcl ../synth/synth_generic.tcl 4 blinky.json" blinky.v
K=$(python3 -c "import simple_config; print(simple_config.K)")
yosys -p "tcl ../synth/synth_generic.tcl $K blinky.json" blinky.v
${NEXTPNR:-../../nextpnr-generic} --pre-pack simple.py --pre-place simple_timing.py --json blinky.json --post-route bitstream.py --write pnrblinky.json
yosys -p "read_verilog -lib ../synth/prims.v; read_json pnrblinky.json; dump -o blinky.il; show -format png -prefix blinky"

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -ex
export PYTHONPATH=$(dirname $0)
yosys -p "tcl ../synth/synth_generic.tcl 4 blinky.json" blinky.v
K=$(python3 -c "import simple_config; print(simple_config.K)")
yosys -p "tcl ../synth/synth_generic.tcl $K blinky.json" blinky.v
${NEXTPNR:-../../nextpnr-generic} --no-iobs --pre-pack simple.py --pre-place simple_timing.py --json blinky.json --post-route bitstream.py --write pnrblinky.json
yosys -p "read_json pnrblinky.json; write_verilog -noattr -norename pnrblinky.v"
iverilog -o blinky_simtest ../synth/prims.v blinky_tb.v pnrblinky.v