Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/nmigen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4379a5d6fe8c
Choose a base ref
...
head repository: m-labs/nmigen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c52cd72d3e19
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jun 4, 2019

  1. vendor.lattice_ice40: normalize device names.

    Right now the device name in the board file is just the option
    nextpnr uses, but that's overnormalized and doesn't quite match
    the chip names used elsewhere. It is even worse for ECP5 in terms
    of mismatch with chip names, and for ECP5 we need to support other
    toolchains as well, so let's handle this uniformly everywhere.
    whitequark committed Jun 4, 2019
    Copy the full SHA
    452c4b3 View commit details

Commits on Jun 5, 2019

  1. Typos and style fixes. NFC.

    whitequark committed Jun 5, 2019
    Copy the full SHA
    c52cd72 View commit details
Showing with 20 additions and 8 deletions.
  1. +1 −1 nmigen/build/plat.py
  2. +19 −7 nmigen/vendor/lattice_ice40.py
2 changes: 1 addition & 1 deletion nmigen/build/plat.py
Original file line number Diff line number Diff line change
@@ -195,7 +195,7 @@ class TemplatedPlatform(Platform):

def toolchain_prepare(self, fragment, name, **kwargs):
# This notice serves a dual purpose: to explain that the file is autogenerated,
# and to incorporate
# and to incorporate the nMigen version into generated code.
autogenerated = "Automatically generated by nMigen {}. Do not edit.".format(__version__)

def emit_design(backend):
26 changes: 19 additions & 7 deletions nmigen/vendor/lattice_ice40.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ class LatticeICE40Platform(TemplatedPlatform):
Available overrides:
* ``verbose``: enables logging of informational messages to standard error.
* ``read_opts``: adds options for ``read`` Yosys command.
* ``read_verilog_opts``: adds options for ``read_verilog`` Yosys command.
* ``synth_opts``: adds options for ``synth_ice40`` Yosys command.
* ``script_after_read``: inserts commands after ``read_ilang`` in Yosys script.
* ``script_after_synth``: inserts commands after ``synth_ice40`` in Yosys script.
@@ -35,6 +35,18 @@ class LatticeICE40Platform(TemplatedPlatform):
device = abstractproperty()
package = abstractproperty()

_nextpnr_device_options = {
"iCE40LP384": "--lp384",
"iCE40LP1K": "--lp1k",
"iCE40LP4K": "--lp8k",
"iCE40LP8K": "--lp8k",
"iCE40HX1K": "--hx1k",
"iCE40HX4K": "--hx8k",
"iCE40HX8K": "--hx8k",
"iCE40UP5K": "--up5k",
"iCE5LP4K": "--u4k",
}

file_templates = {
**TemplatedPlatform.build_script_templates,
"{{name}}.il": r"""
@@ -64,9 +76,9 @@ class LatticeICE40Platform(TemplatedPlatform):
""",
"{{name}}_pre_pack.py": r"""
# {{autogenerated}}
{% for port, frequency in platform.iter_clock_constraints() -%}
{% for port_name, frequency in platform.iter_clock_constraints() -%}
{# Clock in MHz #}
ctx.addClock("{{port}}", {{frequency/1000000}})
ctx.addClock("{{port_name}}", {{frequency/1000000}})
{% endfor%}
""",
}
@@ -80,11 +92,11 @@ class LatticeICE40Platform(TemplatedPlatform):
""",
r"""
{{get_tool("nextpnr-ice40")}}
{{quiet("-q")}}
{{quiet("--quiet")}}
{{get_override("nextpnr_opts")|default(["--placer","heap"])|join(" ")}}
-l {{name}}.tim
--{{platform.device}}
--package {{platform.package}}
--log {{name}}.tim
{{platform._nextpnr_device_options[platform.device]}}
--package {{platform.package|lower}}
--json {{name}}.json
--pcf {{name}}.pcf
--pre-pack {{name}}_pre_pack.py