build.{dsl,res,plat}: apply clock constraints to signals, not resources.

This adds the Clock() build DSL element, and adds a resource manager
function add_clock_constraint() that takes a Pin or a Signal.
Note that not all platforms, in particular not any nextpnr platforms
at the moment, can add constraints on arbitrary signals.

Fixes #86.
This commit is contained in:
whitequark 2019-06-05 08:48:36 +00:00
parent ab3f103e5a
commit c9879c795b
7 changed files with 155 additions and 109 deletions

View file

@ -76,9 +76,9 @@ class LatticeICE40Platform(TemplatedPlatform):
""",
"{{name}}_pre_pack.py": r"""
# {{autogenerated}}
{% for port_name, frequency in platform.iter_clock_constraints() -%}
{% for signal, frequency in platform.iter_clock_constraints() -%}
{# Clock in MHz #}
ctx.addClock("{{port_name}}", {{frequency/1000000}})
ctx.addClock("{{signal.name}}", {{frequency/1000000}})
{% endfor%}
""",
}