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

Making an assignment to an input results in unclear assertion error #405

jeanthom opened this issue Jun 17, 2020 · 3 comments


Copy link

jeanthom commented Jun 17, 2020

from nmigen import *
from nmigen_boards.versa_ecp5 import VersaECP5Platform

class Top(Elaboratable):
    def elaborate(self, platform):
        m = Module()
        input = platform.request("eth_clk125", 0) # This is an input
        m.d.comb += input.i.eq(1)
        return m

if __name__ == "__main__":
Traceback (most recent call last):
  File "", line 16, in <module>
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/build/", line 90, in build
    plan = self.prepare(elaboratable, name, **kwargs)
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/build/", line 162, in prepare
    fragment._propagate_ports(ports=self.iter_ports(), all_undef_as_ports=False)
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/hdl/", line 462, in _propagate_ports
    self._prepare_use_def_graph(parent, level, uses, defs, ios, self)
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/hdl/", line 436, in _prepare_use_def_graph
    subfrag._prepare_use_def_graph(parent, level, uses, defs, ios, top)
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/hdl/", line 428, in _prepare_use_def_graph
  File "/home/jeanthomas/.local/lib/python3.8/site-packages/nmigen/hdl/", line 396, in add_defs
    assert defs[sig] is self

Ideally the error message would point to the faulty assignment line.

@whitequark whitequark added the bug label Jun 17, 2020
Copy link

whitequark commented Jun 17, 2020

Same underlying problem as #398.

Copy link

FFY00 commented Jul 14, 2020

I had a look at this, I don't quite understand the context of how it is happening. @whitequark perhaps you could give me some hints?

Copy link

whitequark commented Jul 14, 2020

perhaps you could give me some hints?

I wrote that code a while ago, and it's not very good. It'd probably be easier for me to fix it myself if I have to sit down and remember how it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

No branches or pull requests

3 participants