Guest User

Untitled

a guest
Jan 30th, 2012
58
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def get_fragment(self):
  2. n = len(self.endpoints)
  3. acked = Signal(BV(n), name="acked")
  4.  
  5. sink = self.endpoints["sink"]
  6. sources = [self.endpoints["source{0}".format(n)]
  7. for n in range(len(self.endpoints)-1)]
  8. comb = [sink.ack.eq(optree('&', [source.ack | acked[n] for n, source in enumerate(sources)]))]
  9. comb += [source.stb.eq(sink.stb) for source in sources]
  10.  
  11. sync = [If(sink.stb & sink.ack, acked.eq(0)).Else(
  12. *[If(source.ack, acked[n].eq(1)) for n, source in
  13. enumerate(sources)])]
  14.  
  15. return Fragment(comb, sync)
RAW Paste Data