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

Detect pin/ball conflicts between resources when they are requested #124

Closed
sbourdeauducq opened this issue Jul 3, 2019 · 3 comments
Closed
Milestone

Comments

@sbourdeauducq
Copy link
Member

Repro:

from nmigen import *
from nmigen_boards.versa_ecp5 import VersaECP5Platform


class Top(Elaboratable):
    def elaborate(self, platform):
        m = Module()

        foo = Signal()
        m.d.comb += platform.request("uart").tx.o.eq(0)
        
        return m


if __name__ == "__main__":
    VersaECP5Platform().build(Top())
$ python crash.py 
ERROR: Cell '$2' cannot be bound to bel 'X38/Y0/PIOB' since it is already bound to cell 'uart_0__rx__io$tr_io'

This is with nextpnr ff958830d1097b9bfa3c3b34094e671741ef563d, Yosys 8455d1f4ffb942c802b65e20748e54a123e08df0 and nMigen 9a1048a.

@whitequark whitequark added the bug label Jul 3, 2019
@whitequark
Copy link
Contributor

That was caused by a typo (m-labs/nmigen-boards@6e0cc9d) that caused rx and tx to be bound to the same ball. The error message would be much better with #123, and also we should probably detect this before handing over the RTL to the vendor toolchain.

@whitequark whitequark added improvement and removed bug labels Jul 3, 2019
@whitequark whitequark changed the title nextpnr error: Cell cannot be bound to bel since it is already bound Detect pin/ball conflicts between resources when they are requested Jul 3, 2019
@whitequark whitequark added this to the 0.1 milestone Jul 3, 2019
@whitequark
Copy link
Contributor

@sbourdeauducq With #123, the message now looks like:

$ python3 crash.py
ERROR: Cell 'uart_0__tx' cannot be bound to bel 'X38/Y0/PIOB' since it is already bound to cell 'uart_0__rx__io$tr_io'

@whitequark
Copy link
Contributor

With latest master, the message now looks like:

$ python3 crash.py
Traceback (most recent call last):
  File "t.py", line 16, in <module>
    VersaECP5Platform().build(Top())
  File "/home/whitequark/Projects/nmigen/nmigen/build/plat.py", line 47, in build
    plan = self.prepare(fragment, name, **kwargs)
  File "/home/whitequark/Projects/nmigen/nmigen/build/plat.py", line 61, in prepare
    fragment = Fragment.get(fragment, self)
  File "/home/whitequark/Projects/nmigen/nmigen/hdl/ir.py", line 56, in get
    obj = obj.elaborate(platform)
  File "t.py", line 10, in elaborate
    m.d.comb += platform.request("uart").tx.o.eq(0)
  File "/home/whitequark/Projects/nmigen/nmigen/build/res.py", line 151, in request
    attrs=resource.attrs)
  File "/home/whitequark/Projects/nmigen/nmigen/build/res.py", line 111, in resolve
    attrs={**attrs, **sub.attrs})
  File "/home/whitequark/Projects/nmigen/nmigen/build/res.py", line 135, in resolve
    .format(name, phys_name, self._phys_reqd[phys_name]))
nmigen.build.res.ResourceError: Resource component uart_0__tx uses physical pin C11, but it is already used by resource component uart_0__rx that was requested earlier

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

No branches or pull requests

2 participants