Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistyping device definition leads to unclear errors. #337

jchidley opened this issue Mar 17, 2020 · 0 comments

Mistyping device definition leads to unclear errors. #337

jchidley opened this issue Mar 17, 2020 · 0 comments


Copy link

jchidley commented Mar 17, 2020

Mistyping the device value (in this example ICE40UP5K instead of iCE40UP5K) leads to unclear error messages on

from nmigen import *
import os
import subprocess

from import *
from nmigen.vendor.lattice_ice40 import *
from nmigen_boards.resources import *

class board(LatticeICE40Platform):
    device      = "ICE40UP5K"
    package     = "SG48"
    resources   = [
        *LEDResources(pins="41", attrs=Attrs(IO_STANDARD="SB_LVCMOS")),

    connectors  = []

    def toolchain_program(self, products, name):
        iceprog = os.environ.get("ICEPROG", "iceprog")
        with products.extract("{}.bin".format(name)) as bitstream_filename:
            subprocess.check_call([iceprog, "-S", bitstream_filename])

class Blinky(Elaboratable):
    def elaborate(self, platform):
        led   = platform.request("led", 0)
        timer = Signal(20)

        m = Module() = sync = ClockDomain()
        m.submodules.osc = Instance(

        m.d.sync += timer.eq(timer + 1)
        m.d.comb += led.o.eq(timer[-1])
        return m

if __name__ == "__main__":

    platform = board(), do_program=False)

Error output:

ERROR: Unable to place cell 'osc_OSC' of type 'ICESTORM_HFOSC'
ERROR: Packing design failed.
0 warnings, 2 errors
Traceback (most recent call last):
  File "/home/jack/nmigen/examples/board/", line 51, in <module>, do_program=False)
  File "/home/jack/.local/lib/python3.8/site-packages/nmigen/build/", line 82, in build
    products = plan.execute_local(build_dir)
  File "/home/jack/.local/lib/python3.8/site-packages/nmigen/build/", line 98, in execute_local
    subprocess.check_call(["sh", "{}.sh".format(self.script)])
  File "/usr/lib/python3.8/", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sh', '']' returned non-zero exit status 255.
@whitequark whitequark added this to the 0.3 milestone Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

No branches or pull requests

2 participants