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

DriverConflict raised on entire signal when independently driving individual bits from submodules #347

Closed
the6p4c opened this issue Apr 5, 2020 · 2 comments
Labels

Comments

@the6p4c
Copy link

the6p4c commented Apr 5, 2020

Hopefully this isn't just me doing something wrong, but, the following snippet

from nmigen import *

class MySubmodule(Elaboratable):
    def __init__(self, o):
        self.o = o

    def elaborate(self, platform):
        m = Module()
        m.d.comb += self.o.eq(1)
        return m

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

        xo = Signal(2)
        m.submodules += [
            MySubmodule(xo[0]),
            MySubmodule(xo[1])
        ]

        return m

from nmigen.back import verilog
verilog.convert(Fragment.get(Bug(), None))

produces the error

bug.py:16: DriverConflict: Signal '(sig xo)' is driven from multiple fragments: top.<unnamed #0>, top.<unnamed #1>; hierarchy will be flattened

despite each individual bit of xo only being driven in one location.

@whitequark
Copy link
Member

This is an unavoidable limitation caused by the fact that module ports have per-port direction (in RTLIL, Verilog, etc), but your code would only work if they had per-bit direction. See also #191.

@whitequark
Copy link
Member

Someone on IRC (mwk?) suggested that this could be worked around using inout ports, but this would cause all sorts of issues downstream.

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

No branches or pull requests

2 participants