toolchain: pin nextpnr 1436b96f, fpga-as reference parity, chipdb part-name symlinks - #20
Conversation
lromor/fpga-assembler@6ff89a2 writes "fasm" into the bitstream's 'b' TLV where xc7frames2bit writes the part name, and sets seven configuration bits the reference implementation leaves clear, so a bitstream assembled with it differs from the one fasm2frames + xc7frames2bit produce for the same FASM. hansfbaier's reference-parity branch fixes both. Switch back to lromor/fpga-assembler once the PR lands: lromor/fpga-assembler#47 Assisted-by: deepseek/deepseek-flash
The generator takes a die and one database serves every package of it, so the copy under each part name multiplied a family's artefact by the number of footprints: kintex7 shipped 1.2 GB for its 252 MB of data. A relative symlink keeps the store path self-contained and relocatable while making openXC7.mk's per-part lookup still work. Assisted-by: deepseek/deepseek-flash
Two xc7 fixes from openXC7/nextpnr#45: * write_ibufds_gte2() hardcoded GTXE2_COMMON as the COMMON segment prefix; on a GTP tile the database names it GTPE2_COMMON, so every Artix-7 GTP design emitted an undeclared feature and fasm2frames rejected the bitstream (FasmLookupError), fpga-as aborted on the lookup. * the OFB-loopback exemption in the packer missed the shape where the OSERDESE2's OFB drives the ISERDESE2's OFB input (D and DDLY open), which is how Xilinx's DDR3 PHY example instantiates its training ISERDES; the packer aborted with "has disconnected D input". demo-projects' smoke and heavy workflows need both. Assisted-by: deepseek/deepseek-flash
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the toolchain inputs to revisions that reproduce the demo-projects reference bitstreams and fix xc7 packing failures, while replacing redundant chipdb copies with relocatable per-part symlinks. Flow diagram for shared chipdb part-name symlinksflowchart TD
Package[Package name lookup]
DBPart[CHIPDB/DBPART.bin]
Link[Relative symlink]
DieDB[chipdb-fabric.bin]
Package --> DBPart
DBPart --> Link
Link --> DieDB
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="nix/nextpnr-chipdb.nix" line_range="71" />
<code_context>
fi
if [ -f "$out/chipdb-$fabric.bin" ]; then
- cp "$out/chipdb-$fabric.bin" "$out/$part.bin"
+ # Symlink, not copy: one die's database is 20-75 MB and serves every
+ # package of that die, so a copy under each part name inflated a
+ # family's artefact severalfold (kintex7: 1.2 GB for 252 MB of data)
+ # and made CI pull the copies with it. Relative, so the store path
+ # stays self-contained and relocatable.
+ ln -s "chipdb-$fabric.bin" "$out/$part.bin"
else
</code_context>
<issue_to_address>
**nitpick:** The file header still says that each package receives a copy of its die database, but the implementation now installs symlinks instead. This misleads maintainers about both the storage behavior and the artifact layout.
**Suggested fix:** Update the header comment to say that each package receives a relative symlink to its die database.
```suggestion
# Each package receives a relative symlink to its die database; one die's
```
</issue_to_address>
### Comment 2
<location path="nix/nextpnr-chipdb.nix" line_range="76" />
<code_context>
+ # family's artefact severalfold (kintex7: 1.2 GB for 252 MB of data)
+ # and made CI pull the copies with it. Relative, so the store path
+ # stays self-contained and relocatable.
+ ln -s "chipdb-$fabric.bin" "$out/$part.bin"
else
echo "no chipdb for $part (fabric $fabric) -- skipped"
</code_context>
<issue_to_address>
**issue (broader_impact):** The database-size reduction is lost when the CI packaging step copies the store output with ordinary `cp`, because that dereferences these symlinks and recreates a full copy under every part name. CI artifacts therefore remain inflated despite this change.
**Triggers:** When the CI chipdb stage packages this derivation with `cp` rather than preserving symlinks.
**Suggested fix:** Change the CI copy to `cp -a` (or otherwise preserve symlinks) when packaging the chipdb output.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and a faulty nextpnr or fpga-as pin could generate incorrect FPGA bitstreams, and consumers that do not handle the new relative chipdb symlinks could fail to build. Reverting restores the previous toolchain, and generated databases or bitstreams can be regenerated, so the impact is bounded and repairable.
Blocking findings: nix/nextpnr-chipdb.nix:76
| # family's artefact severalfold (kintex7: 1.2 GB for 252 MB of data) | ||
| # and made CI pull the copies with it. Relative, so the store path | ||
| # stays self-contained and relocatable. | ||
| ln -s "chipdb-$fabric.bin" "$out/$part.bin" |
There was a problem hiding this comment.
issue (broader_impact): The database-size reduction is lost when the CI packaging step copies the store output with ordinary cp, because that dereferences these symlinks and recreates a full copy under every part name. CI artifacts therefore remain inflated despite this change.
Triggers: When the CI chipdb stage packages this derivation with cp rather than preserving symlinks.
Suggested fix: Change the CI copy to cp -a (or otherwise preserve symlinks) when packaging the chipdb output.
The speed grades of one footprint collapse onto the same part name --
xc7a100tcsg324-1, -2, -2L and -3 all strip to xc7a100tcsg324 -- so the second
one to be linked hit an existing symlink and `ln -s` aborted the whole
derivation:
ln: failed to create symbolic link '.../xc7a100tcsg324.bin': File exists
The copy this replaced overwrote silently, which is why it went unnoticed.
All of them link the same die's database, so `ln -sf` is both correct and
order-independent.
Verified: nix build .#nextpnr .#nextpnr-xilinx-chipdb.{artix7,kintex7,spartan7,zynq7}
--print-out-paths --no-link
Assisted-by: deepseek/deepseek-flash
The derivation was changed to install a relative symlink per package name, but the file header still described the old copy-per-name layout. Review comment on #20. Assisted-by: deepseek/deepseek-flash
#45 is merged, so track main instead of the PR branch tip. The merge brought
nothing else (git diff 1436b96f 5a0b7e41 is empty) and the source tarball hash
is unchanged, so this is derivation-identical: nextpnr-xilinx-chipdb.{artix7,
kintex7} resolve to the same store paths as before (bds5583..., 4zz1w25...) and
nextpnr to the same 735jw473... -- no rebuild, no chipdb cache invalidation.
Assisted-by: deepseek/deepseek-flash
|
Both comments addressed. Comment 1 (header says copy, code installs a symlink) — fixed in 9888734. The Comment 2 ( Fixed on the demo-projects side (commit 987b035), since that is where the staging
Verified: the artix7 tar is 123 MB for the same 25 entries, 0 broken symlinks Also in this branch: 3fa6f49 re-pins nextpnr to 5a0b7e41, main's merge of #45. The |
Three changes that make the toolchain's own build of the demo toolchain match what
demo-projects' CI now expects.nextpnr→ 1436b96f (openXC7/nextpnr#45)Pins the two xc7 fixes the smoke/heavy matrix needs:
write_ibufds_gte2()hardcodedGTXE2_COMMONas the COMMON segment prefix;on a
GTP_COMMONtile the database names that segmentGTPE2_COMMON, soevery Artix-7 GTP design emitted an undeclared feature.
fasm2framesrejected the bitstream (
FasmLookupError) and fpga-as aborted on the lookup.(
litex-sata-alientek-davincipro.)OSERDESE2's
OFBdrives the ISERDESE2'sOFBinput withD/DDLYopen --Xilinx's DDR3 PHY example's training ISERDES -- and aborted with
has disconnected D input. (ddr3-test-arty-s7.)The rev is the pre-merge commit from that PR, so this PR's CI can run the whole
stack; re-pin to the merge commit on
mainonce #45 lands.fpga-as
Pinned to
hansfbaier/fpga-assembler@cf0e3f0(lromor/fpga-assembler#47, "Reproducethe reference implementation's output"). The rev the flake used writes
"fasm"into the bitstream's
bTLV wherexc7frames2bitwrites the part name, and setsseven configuration bits the reference leaves clear, so
demo-projects' committedgoldens cannot match a rebuild. Switch back to the upstream repo when #47 lands.
chipdb part names
nix/nextpnr-chipdb.nixinstalled a copy of the die's database under everypackage name, so kintex7 shipped 1.2 GB for 252 MB of data. Relative symlinks
instead;
openXC7.mk's${CHIPDB}/${DBPART}.binlookup is unchanged.Note the CI chipdb stage still
cps the store output, which dereferences thelinks -- the workflow would need
cp -ato see the size win.Verification
nix build .#nextpnr .#nextpnr-xilinx-chipdb.artix7on this branch, and all 20smoke projects +
litex-ddr-hpcstore-k420tbuilt to.bitwith the resultingderivations (scripts in the demo-projects PR).
Assisted-by: deepseek/deepseek-flash
Summary by Sourcery
Align the FPGA toolchain dependencies and chip database packaging with the demo-projects CI and reference bitstream outputs.
Bug Fixes:
Enhancements:
Build:
Tests:
Fix-up: the part-name symlinks were not idempotent (07b9721)
The first real build of
.#nextpnr-xilinx-chipdb.artix7aborted:The speed grades of one footprint collapse onto the same part name --
xc7a100tcsg324-1,-2,-2L,-3all strip toxc7a100tcsg324-- so thesecond one to be linked hit an existing symlink. The
cpthis replacedoverwrote silently, so the old derivation never hit it.
ln -sfis bothcorrect and order-independent (every duplicate links the same die's database).
Verified this time by building the artefacts, not just by reading the code:
and by checking every part name the two CI matrices use against the resulting
directories (the
openXC7.mkcontract is${DBPART}.bin,DBPART=PARTwith the first
-<digit>removed): all 21 part/family pairs resolve, includingthe
xc7a35t->xc7a50tfabric alias (xc7a35tcsg324.bin->chipdb-xc7a50t.bin).