Currently only done for Synopsys based toolchains (i.e. not nextpnr).
Refs #88.
else:
return " ".join(opts)
+ def hierarchy(signal, separator):
+ return separator.join(name_map[signal][1:])
+
def verbose(arg):
if "NMIGEN_verbose" in os.environ:
return arg
source = textwrap.dedent(source).strip()
compiled = jinja2.Template(source, trim_blocks=True, lstrip_blocks=True)
compiled.environment.filters["options"] = options
+ compiled.environment.filters["hierarchy"] = hierarchy
except jinja2.TemplateSyntaxError as e:
e.args = ("{} (at {}:{})".format(e.message, origin, e.lineno),)
raise
""",
"{{name}}.sdc": r"""
{% for signal, frequency in platform.iter_clock_constraints() -%}
- create_clock -period {{1000000000/frequency}} [get_ports {{signal.name}}]
+ create_clock -period {{1000000000/frequency}} [get_nets {{signal|hierarchy("/")}}]
{% endfor %}
{{get_override("add_constraints")|default("# (add_constraints placeholder)")}}
""",
{% endfor %}
{% endfor %}
{% for signal, frequency in platform.iter_clock_constraints() -%}
- create_clock -name {{signal.name}} -period {{1000000000/frequency}} [get_ports {{signal.name}}]
+ create_clock -name {{signal.name}} -period {{1000000000/frequency}} [get_nets {{signal|hierarchy("/")}}]
{% endfor %}
{{get_override("add_constraints")|default("# (add_constraints placeholder)")}}
"""
{% endfor %}
{% endfor %}
{% for signal, frequency in platform.iter_clock_constraints() -%}
- NET "{{signal.name}}" TNM_NET="PRD{{signal.name}}";
- TIMESPEC "TS{{signal.name}}"=PERIOD "PRD{{signal.name}}" {{1000000000/frequency}} ns HIGH 50%;
+ NET "{{signal|hierarchy("/")}}" TNM_NET="PRD{{signal|hierarchy("/")}}";
+ TIMESPEC "TS{{signal|hierarchy("/")}}"=PERIOD "PRD{{signal|hierarchy("/")}}" {{1000000000/frequency}} ns HIGH 50%;
{% endfor %}
{{get_override("add_constraints")|default("# (add_constraints placeholder)")}}
"""