Skip to content

xdc: Handle get_ports args with braces and spaces - #93

Open
infinitymdm wants to merge 2 commits into
gatecat:xilinx-upstreamfrom
infinitymdm:xilinx-upstream
Open

xdc: Handle get_ports args with braces and spaces#93
infinitymdm wants to merge 2 commits into
gatecat:xilinx-upstreamfrom
infinitymdm:xilinx-upstream

Conversation

@infinitymdm

Copy link
Copy Markdown

I ran into an issue using nextpnr-xilinx with a Digilent Arty A7 board (rev E), using their provided xdc file. It doesn't seem like the current xdc parsing can handle stuff like

set_property -dict { PACKAGE_PIN A8 IOSTANDARD LVCMOS33 } [get_ports { sw[0] }]

where the argument to get_ports has braces and whitespace. Either get_ports {sw[0]} or get_ports sw[0] works just fine, but get_ports { sw[0] } errors out. This PR fixes that by adding a second split_to_args call in get_cells.

@infinitymdm

Copy link
Copy Markdown
Author

Hmm, just noticed that this only fixes the issue for set_property lines. I'll look into additional fixes for e.g. create_clocks.

@infinitymdm
infinitymdm marked this pull request as draft March 4, 2025 15:21
@marzoul

marzoul commented Mar 4, 2025

Copy link
Copy Markdown
Contributor

Seems weird, to the best of my knowledge one of the purposes of braces is precisely to take into account any spaces at part of the contents ? But maybe if dropping spaces is the behavior of Vivado then it can be considered a specification, for these commands...

@marzoul

marzoul commented Mar 4, 2025

Copy link
Copy Markdown
Contributor

If this is change is indeed desired then it will also be necessary to integrate in Himbeachel backend in nextpnr repo.

@marzoul

marzoul commented Mar 4, 2025

Copy link
Copy Markdown
Contributor

Did you check my PR #85 ? It is also integrated in nextpnr and I backported it here.

@infinitymdm

Copy link
Copy Markdown
Author

to the best of my knowledge one of the purposes of braces is precisely to take into account any spaces at part of the contents

If this is the case, the current code doesn't take these spaces into account either. Suppose you had get_ports {test args}: the split_to_args call on L84 would turn this into get_ports, {test, and args}, and the strip_quotes(split.at(1)) on L91 would throw an assertion error because {test doesn't end with }.

Did you check my PR #85 ? It is also integrated in nextpnr and I backported it here.

Yeah, the first thing I did when I ran into this was try your PR. I just cherry-picked this commit from my testing branch, which has your PR applied. See infinitymdm:xdc for that test code.

@infinitymdm

Copy link
Copy Markdown
Author

Applying basically the same change to get_nets fixed the issue with xdc create_clocks lines. Should be ready to go.

@infinitymdm
infinitymdm marked this pull request as ready for review March 6, 2025 20:13
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