build.res: simplify emission of port constraints on individual bits.
This commit is contained in:
parent
9f643ce005
commit
2763b403f1
|
@ -183,6 +183,14 @@ class ConstraintManager:
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
def iter_port_constraints_bits(self):
|
||||||
|
for port_name, pin_names, extras in self.iter_port_constraints():
|
||||||
|
if len(pin_names) == 1:
|
||||||
|
yield port_name, pin_names[0], extras
|
||||||
|
else:
|
||||||
|
for bit, pin_name in enumerate(pin_names):
|
||||||
|
yield "{}[{}]".format(port_name, bit), pin_name, extras
|
||||||
|
|
||||||
def iter_clock_constraints(self):
|
def iter_clock_constraints(self):
|
||||||
for name, number in self.clocks.keys() & self._requested.keys():
|
for name, number in self.clocks.keys() & self._requested.keys():
|
||||||
resource = self.resources[name, number]
|
resource = self.resources[name, number]
|
||||||
|
|
15
nmigen/vendor/fpga/lattice_ice40.py
vendored
15
nmigen/vendor/fpga/lattice_ice40.py
vendored
|
@ -24,8 +24,9 @@ class LatticeICE40Platform(TemplatedPlatform):
|
||||||
* ``synth_opts``: adds options for ``synth_ice40`` Yosys command.
|
* ``synth_opts``: adds options for ``synth_ice40`` Yosys command.
|
||||||
* ``script_after_read``: inserts commands after ``read_ilang`` in Yosys script.
|
* ``script_after_read``: inserts commands after ``read_ilang`` in Yosys script.
|
||||||
* ``script_after_synth``: inserts commands after ``synth_ice40`` in Yosys script.
|
* ``script_after_synth``: inserts commands after ``synth_ice40`` in Yosys script.
|
||||||
* ``yosys_opts``: overrides default options (``-q``) for Yosys.
|
* ``yosys_opts``: adds extra options for Yosys.
|
||||||
* ``nextpnr_opts``: overrides default options (``-q --placer heap``).
|
* ``nextpnr_opts``: adds extra and overrides default options (``--placer heap``)
|
||||||
|
for nextpnr.
|
||||||
|
|
||||||
Build products:
|
Build products:
|
||||||
* ``{{name}}.rpt``: Yosys log.
|
* ``{{name}}.rpt``: Yosys log.
|
||||||
|
@ -61,14 +62,8 @@ class LatticeICE40Platform(TemplatedPlatform):
|
||||||
""",
|
""",
|
||||||
"{{name}}.pcf": r"""
|
"{{name}}.pcf": r"""
|
||||||
# {{autogenerated}}
|
# {{autogenerated}}
|
||||||
{% for port, pins, extra in platform.iter_port_constraints() %}
|
{% for port_name, pin_name, extras in platform.iter_port_constraints_bits() -%}
|
||||||
{% if pins|count > 1 %}
|
set_io {{port_name}} {{pin_name}}
|
||||||
{% for bit in range -%}
|
|
||||||
set_io {{port}}[{{bit}}] {{pins[bit]}}
|
|
||||||
{% endfor %}
|
|
||||||
{% else -%}
|
|
||||||
set_io {{port}} {{pins[0]}}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
""",
|
""",
|
||||||
"{{name}}_pre_pack.py": r"""
|
"{{name}}_pre_pack.py": r"""
|
||||||
|
|
Loading…
Reference in a new issue