nmigen module elaborate is not done recursively on submodules in
depth-first order. connect fn was having a side-effect of establishing
the p.i_data and n.o_data... which were not set up from a submodule yet.
def __init__(self, width, id_wid):
ControlBase.__init__(self)
self.pipe1 = FPADDBasePipe1(width, id_wid)
def __init__(self, width, id_wid):
ControlBase.__init__(self)
self.pipe1 = FPADDBasePipe1(width, id_wid)
- self.p.i_data = self.pipe1.stage.ispec()
- self.n.o_data = self.pipe1.stage.ospec()
+ self._eqs = self.connect([self.pipe1])
def elaborate(self, platform):
m = Module()
m.submodules.pipe1 = self.pipe1
def elaborate(self, platform):
m = Module()
m.submodules.pipe1 = self.pipe1
- self.connect(m, [self.pipe1])
"""
return self.n._connect_out(nxt.n)
"""
return self.n._connect_out(nxt.n)
- def connect(self, m, pipechain):
+ def connect(self, pipechain):
""" connects a chain (list) of Pipeline instances together and
links them to this ControlBase instance:
""" connects a chain (list) of Pipeline instances together and
links them to this ControlBase instance:
# connect front of chain to ourselves
front = pipechain[0]
# connect front of chain to ourselves
front = pipechain[0]
- #self.p.i_data = front.stage.ispec()
+ self.p.i_data = front.stage.ispec()
eqs += front._connect_in(self)
# connect end of chain to ourselves
end = pipechain[-1]
eqs += front._connect_in(self)
# connect end of chain to ourselves
end = pipechain[-1]
- #self.n.o_data = end.stage.ospec()
+ self.n.o_data = end.stage.ospec()
eqs += end._connect_out(self)
eqs += end._connect_out(self)
- # activate the assignments
- m.d.comb += eqs
def set_input(self, i):
""" helper function to set the input data
def set_input(self, i):
""" helper function to set the input data
pipe1 = ExampleBufPipe()
pipe2 = ExampleBufPipe()
pipe1 = ExampleBufPipe()
pipe2 = ExampleBufPipe()
- self.p.i_data = pipe1.stage.ispec()
- self.n.o_data = pipe2.stage.ospec()
-
m.submodules.pipe1 = pipe1
m.submodules.pipe2 = pipe2
m.submodules.pipe1 = pipe1
m.submodules.pipe2 = pipe2
- self.connect(m, [pipe1, pipe2])
+ m.d.comb += self.connect([pipe1, pipe2])