Skip to content

gowin_pack: fix PLLA _default_plla_inattrs integer type mismatch#492

Merged
yrabbit merged 3 commits intoYosysHQ:masterfrom
pinnacletechnologysolutionsltd:fix/plla-default-attrs-type
Apr 5, 2026
Merged

gowin_pack: fix PLLA _default_plla_inattrs integer type mismatch#492
yrabbit merged 3 commits intoYosysHQ:masterfrom
pinnacletechnologysolutionsltd:fix/plla-default-attrs-type

Conversation

@pinnacletechnologysolutionsltd
Copy link
Copy Markdown
Contributor

fix: GW5A PLLA default attrs — change int literals to binary strings in _default_plla_inattrs

Problem

When packing a GW5A bitstream with any PLLA primitive, set_pll_attrs()
raises a TypeError because _default_plla_inattrs contains Python int values
(0, 1) for ~40 keys, but the function calls int(val, 2)` throughout — which requires a string argument.

TypeError: int() can't convert non-string with explicit base

This affects any design targeting GW5A-LV25 (Tang Primer 25K) or similar GW5A
devices that use PLLA (not rPLL, which is used on GW1N/GW2A).

Fix

Change all bare 0 and 1 integer literals in _default_plla_inattrs to the
binary string equivalents '0' and '1'. The dictionary already uses strings
for all other value types (e.g. 'TRUE', 'INTERNAL', '100.00'), so this makes the dict consistent.

No logic changes — purely a type correction in the default attribute table.

Tested on

  • Device: GW5A-LV25MG121NES (Engineering Sample)
  • Pack command: gowin_pack -d GW5A-25A --sspi_as_gpio ...
  • Full synthesis → PnR → pack → bitstream flow verified working after fix

nextpnr-0.9 stable reads {device}.pickle (gzip+pickle format) from the
installed apycula package via importlib.resources. The package was
previously shipping only *.msgpack.xz, breaking the stable toolchain
CI test with FileNotFoundError.

Fix: after saving the msgpack, also write apycula/{device}.pickle
(gzip-compressed pickle of the Device dataclass) when using the default
output path. Add *.pickle to setup.py package_data so it is included in
the wheel. Update Makefile clean target to also remove *.pickle.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yrabbit
Copy link
Copy Markdown
Collaborator

yrabbit commented Apr 5, 2026

As for the PLL, no questions there—I was already planning to merge it, but what's the point of messing around with pickle when the nextpnr 0.10 release won't read them anyway?

@pinnacletechnologysolutionsltd
Copy link
Copy Markdown
Contributor Author

Sorry I wasn't sure if it was something that was for legacy releases or to remove it to pass the build. Would you like me to revert that commit?

@yrabbit
Copy link
Copy Markdown
Collaborator

yrabbit commented Apr 5, 2026

Sorry I wasn't sure if it was something that was for legacy releases or to remove it to pass the build. Would you like me to revert that commit?

Yes, that would be great.
With official nextpnr releases, it’s up to other projects that depend on it to catch up to this version, not the other way around. This is especially true in the case of the GW5A series—with the next nextpnr release, we’ll get improvements to the clock system, HCLK support, serializer support, and more—none of which will ever be in 0.9 or even 0.10—there’s no point in even mentioning them.:smile:

@pinnacletechnologysolutionsltd
Copy link
Copy Markdown
Contributor Author

Awesome. I'll do that now. Thank you for your hard work, I'm planning on releasing a new ISA on the Tang Primer 25k and having an open source toolchain is invaluable.

@yrabbit yrabbit merged commit 3f737fa into YosysHQ:master Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants