# join add2 a to c: add2.in_a = c
m.d.comb += self.add2.in_a.chain_from(self.c)
# join add2 b to add1 z: add2.in_b = add1.out_z
- m.d.comb += self.add2.in_b.chain_from(self.add1.out_z)
+ m.d.comb += self.add2.in_b.chain_inv(self.add1.out_z)
# join output from add2 to z: z = add2.out_z
m.d.comb += self.z.chain_from(self.add2.out_z)
# get at add1's stb signal
self.stb = Signal(reset=0)
self.ack = Signal()
+ def chain_inv(self, in_op, extra=None):
+ stb = in_op.stb
+ if extra is not None:
+ stb = stb & extra
+ return [self.v.eq(in_op.v), # receive value
+ self.stb.eq(~stb), # receive STB
+ in_op.ack.eq(~self.ack), # send ACK
+ ]
+
def chain_from(self, in_op, extra=None):
stb = in_op.stb
if extra is not None: