m.d.comb += self.p.o_ready.eq(self.n[muxid].i_ready)
else:
data_valid = self.n[muxid].o_valid
- m.d.comb += self.p.o_ready.eq(~data_valid | self.n[muxid].i_ready)
+ m.d.comb += self.p.o_ready.eq(self.n[muxid].i_ready)
m.d.comb += data_valid.eq(p_i_valid | \
(~self.n[muxid].i_ready & data_valid))
# send data on
#with m.If(pv):
m.d.comb += eq(r_data, self.p.i_data)
- m.d.comb += eq(self.n[muxid].o_data, self.process(r_data))
+ #m.d.comb += eq(self.n[muxid].o_data, self.process(r_data))
+ for i in range(len(self.n)):
+ with m.If(muxid == i):
+ m.d.comb += eq(self.n[i].o_data, self.process(r_data))
if self.maskwid:
if self.routemask: # straight "routing" mode - treat like data
print ("setup", self, self.stage, r)
self.stage.setup(m, r)
if True: # len(r_data) > 1: # hmm always create an Array even of len 1
- r_data = Array(r_data)
p_i_valid = Array(p_i_valid)
n_i_readyn = Array(n_i_readyn)
data_valid = Array(data_valid)
m.d.comb += maskedout.eq(p.mask_i & ~p.stop_i)
else:
m.d.comb += maskedout.eq(1)
- m.d.comb += p_i_valid[mid].eq(maskedout & self.p_mux.active)
+ m.d.comb += p_i_valid[mid].eq(maskedout & self.p_mux.active &
+ self.p[mid].i_valid)
m.d.comb += self.p[mid].o_ready.eq(~data_valid[mid] | self.n.i_ready)
m.d.comb += n_i_readyn[mid].eq(nirn & data_valid[mid])
anyvalid = Signal(i, reset_less=True)
with m.If(vr):
m.d.comb += eq(self.n.mask_o, self.p[i].mask_i)
m.d.comb += eq(r_data[i], self.process(self.p[i].i_data))
+ with m.If(mid == i):
+ m.d.comb += eq(self.n.o_data, r_data[i])
else:
ml = [] # accumulate output masks
ms = [] # accumulate output stops
m.d.comb += vr.eq(maskedout.bool() & p.i_valid & p.o_ready)
with m.If(vr):
m.d.comb += eq(r_data[i], self.process(self.p[i].i_data))
+ with m.If(mid == i):
+ m.d.comb += eq(self.n.o_data, r_data[i])
if self.maskwid:
mlen = len(self.p[i].mask_i)
s = mlen*i
m.d.comb += self.n.mask_o.eq(Cat(*ml))
m.d.comb += self.n.stop_o.eq(Cat(*ms))
- m.d.comb += eq(self.n.o_data, r_data[mid])
+ #print ("o_data", self.n.o_data, "r_data[mid]", mid, r_data[mid])
+ #m.d.comb += eq(self.n.o_data, r_data[mid])
return m
if not isinstance(o, Sequence):
o, i = [o], [i]
for (ao, ai) in zip(o, i):
- #print ("visit", fn, ao, ai)
+ print ("visit", ao, ai)
+ print (" isinstance Record(ao)", isinstance(ao, Record))
+ print (" isinstance ArrayProxy(ao)",
+ isinstance(ao, ArrayProxy))
+ print (" isinstance Value(ai)",
+ isinstance(ai, Value))
if isinstance(ao, Record):
yield from self.record_iter2(ao, ai)
elif isinstance(ao, ArrayProxy) and not isinstance(ai, Value):
yield from self.arrayproxy_iter2(ao, ai)
+ elif isinstance(ai, ArrayProxy) and not isinstance(ao, Value):
+ assert False, "whoops, input ArrayProxy not supported yet"
+ yield from self.arrayproxy_iter3(ao, ai)
else:
yield (ao, ai)
yield from self.iterator2(ao.fields[field_name], val)
def arrayproxy_iter2(self, ao, ai):
- #print ("arrayproxy_iter2", ai.ports(), ai, ao)
+ print ("arrayproxy_iter2", ai.ports(), ai, ao)
for p in ai.ports():
- #print ("arrayproxy - p", p, p.name, ao)
+ print ("arrayproxy - p", p, p.name, ao)
+ op = getattr(ao, p.name)
+ yield from self.iterator2(op, p)
+
+ def arrayproxy_iter3(self, ao, ai):
+ print ("arrayproxy_iter3", ao.ports(), ai, ao)
+ for p in ao.ports():
+ print ("arrayproxy - p", p, p.name, ao)
op = getattr(ao, p.name)
yield from self.iterator2(op, p)