+ def elaborate(self, platform):
+ """ handles case where stage has dynamic ready/valid functions
+ """
+ m = Module()
+ if not self.n.stage_ctl:
+ return m
+
+ # when the pipeline (buffered or otherwise) says "ready",
+ # test the *stage* "ready".
+ with m.If(self.p._o_ready):
+ m.d.comb += self.p.s_o_ready.eq(self.stage.p_o_ready)
+ with m.Else():
+ m.d.comb += self.p.s_o_ready.eq(0)
+
+ # when the pipeline (buffered or otherwise) says "valid",
+ # test the *stage* "valid".
+ with m.If(self.n._o_valid):
+ m.d.comb += self.n.s_o_valid.eq(self.stage.n_o_valid)
+ with m.Else():
+ m.d.comb += self.n.s_o_valid.eq(0)
+ return m
+