Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 30th, 2012  |  syntax: None  |  size: 0.53 KB  |  views: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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)
clone this paste RAW Paste Data