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

Signal that is used as both an input and output to an Instance gets assigned to its reset value #274

Closed
povauboin opened this issue Nov 26, 2019 · 1 comment
Labels

Comments

@povauboin
Copy link

MCVE:

from nmigen import *
from nmigen.back import verilog, rtlil

class Good(Elaboratable):
    def elaborate(self, platform):
        m = Module()
        s = Signal(reset=1)
        m.submodules.ins = ins = Instance("GOOD",
            i_in=s,
            o_out=s,
        )
        return m

class Bad(Elaboratable):
    def elaborate(self, platform):
        m = Module()
        s = Signal(reset=1)
        m.submodules.ins = ins = Instance("BAD",
            o_out=s,
            i_in=s,
        )
        return m

def main():
    print(rtlil.convert(Bad(), name="bad"))
    print(rtlil.convert(Good(), name="good"))

if __name__ == "__main__":
    main()

Output:

attribute \generator "nMigen"
attribute \top 1
attribute \nmigen.hierarchy "bad"
module \bad
  attribute \src "toto.py:20"
  wire width 1 \s
  cell \BAD \ins
    connect \out \s
    connect \in \s
  end
  connect \s 1'1                 # <<<< ??
end

attribute \generator "nMigen"
attribute \top 1
attribute \nmigen.hierarchy "good"
module \good
  attribute \src "toto.py:10"
  wire width 1 \s
  cell \GOOD \ins
    connect \in \s
    connect \out \s
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants