Skip to content

Commit 0f27429

Browse files
jeanthomwhitequark
authored andcommitted
vendor._gowin: fix clock name quotes for Gowin IDE
Gowin IDE seems unhappy with quotes in clock signal names. For instance, with the following SDC: create_clock -name "clk50_0__io" -period 20.0 [get_ports {clk50_0__io}] Gowin IDE will complain with the following error message: ERROR (TA2000) : "top.sdc":2 | 'syntax error' near token '-period' Changing quotes with curly braces fixes the issue.
1 parent 9243901 commit 0f27429

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: amaranth/vendor/_gowin.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,15 @@ def _osc_div(self):
437437
file delete -force {{name}}.fs
438438
file copy -force impl/pnr/project.fs {{name}}.fs
439439
""",
440+
# Gowin is using neither Tcl nor the Synopsys code to parse SDC files, so the grammar
441+
# deviates from the usual (eg. no quotes, no nested braces).
440442
"{{name}}.sdc": r"""
441443
// {{autogenerated}}
442444
{% for signal, frequency in platform.iter_signal_clock_constraints() -%}
443-
create_clock -name {{signal.name|tcl_quote}} -period {{1000000000/frequency}} [get_nets {{signal|hierarchy("/")|tcl_quote}}]
445+
create_clock -name {{ "{" }}{{signal.name}}{{ "}" }} -period {{1000000000/frequency}} [get_nets {{signal|hierarchy("/")|tcl_quote}}]
444446
{% endfor %}
445447
{% for port, frequency in platform.iter_port_clock_constraints() -%}
446-
create_clock -name {{port.name|tcl_quote}} -period {{1000000000/frequency}} [get_ports
448+
create_clock -name {{ "{" }}{{port.name}}{{ "}" }} -period {{1000000000/frequency}} [get_ports
447449
{{ "{" }}{{port.name}}{{ "}" }}]
448450
{% endfor %}
449451
{{get_override("add_constraints")|default("// (add_constraints placeholder)")}}

0 commit comments

Comments
 (0)