Copyright | (c) Matthew Naylor 2020 |
---|---|
License | MIT |
Maintainer | mattfn@gmail.com |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Blarney.Interconnect
Description
Synopsis
- mergeTwo :: Bits a => Stream a -> Stream a -> Stream a
- mergeChain :: Bits a => [Stream a] -> Stream a
- mergeTree :: Bits a => [Stream a] -> Stream a
- makeFairMerger :: Bits a => [Stream a] -> Module (Stream a)
- type TwoWaySwitch a = (a -> Bit 1) -> (a -> Bit 1) -> (Stream a, Stream a) -> Module (Stream a, Stream a)
- makeGenericFairMergeTwo :: Bits a => Module (Queue a) -> (a -> Bit 1) -> (a -> Bit 1) -> (Stream a, Stream a) -> Module (Stream a)
- makeFairExchange :: Bits a => Module (Queue a) -> (a -> Bit 1) -> (a -> Bit 1) -> (Stream a, Stream a) -> Module (Stream a, Stream a)
- makeTwoWayBroadcast :: Bits a => (a -> Bit 1) -> Stream a -> Module (Stream a, Stream a)
- makeFairExchangeWithBroadcast :: Bits a => Module (Queue a) -> (a -> Bit 1) -> (a -> Bit 1) -> (a -> Bit 1) -> (Stream a, Stream a) -> Module (Stream a, Stream a)
- makeShuffleExchange :: forall n a. (KnownNat n, Bits a) => TwoWaySwitch a -> (a -> Bit n) -> (a -> Bit 1) -> [Stream a] -> Module [Stream a]
Documentation
mergeTwo :: Bits a => Stream a -> Stream a -> Stream a Source #
Unbuffered left-biased merge of two streams
mergeChain :: Bits a => [Stream a] -> Stream a Source #
Unbuffered sequential left-biased merge of multiple sources
mergeTree :: Bits a => [Stream a] -> Stream a Source #
Unbuffered parallel tree merge of multiple streams, where each merger is left biased
makeFairMerger :: Bits a => [Stream a] -> Module (Stream a) Source #
Buffered fair merger of a list of streams
type TwoWaySwitch a Source #
Arguments
= (a -> Bit 1) | Routing function |
-> (a -> Bit 1) | Final flit of atomic transaction? |
-> (Stream a, Stream a) | Input streams |
-> Module (Stream a, Stream a) | Output streams |
Shorthand for a two-way switch
makeGenericFairMergeTwo Source #
Arguments
:: Bits a | |
=> Module (Queue a) | Queue kind to use for buffering |
-> (a -> Bit 1) | Guard on whether data is consumed by merger |
-> (a -> Bit 1) | Final flit of an atomic transaction? |
-> (Stream a, Stream a) | Input streams to be merged |
-> Module (Stream a) | Output stream |
Buffered fair merger of two streams
Arguments
:: Bits a | |
=> Module (Queue a) | Queue kind to use for buffering |
-> (a -> Bit 1) | Routing function |
-> (a -> Bit 1) | Final flit of atomic transaction? |
-> (Stream a, Stream a) | Input streams |
-> Module (Stream a, Stream a) | Output streams |
Buffered fair switch between two streams, based on routing function
Arguments
:: Bits a | |
=> (a -> Bit 1) | Broadcast condition |
-> Stream a | Input stream |
-> Module (Stream a, Stream a) | Output streams |
Optionally broadcast items from an input stream into two output streams. If an item is to be broadcast, then *both* consumers must eventually consume it (perhaps at different times).
makeFairExchangeWithBroadcast Source #
Arguments
:: Bits a | |
=> Module (Queue a) | Queue kind to use for buffering |
-> (a -> Bit 1) | Broadcast condition |
-> (a -> Bit 1) | Routing function |
-> (a -> Bit 1) | Final flit of atomic transaction? |
-> (Stream a, Stream a) | Input streams |
-> Module (Stream a, Stream a) | Output streams |
Buffered fair switch between two streams, based on routing function, with optional broadcast
Arguments
:: forall n a. (KnownNat n, Bits a) | |
=> TwoWaySwitch a | Primitive two-way switch |
-> (a -> Bit n) | Routing function |
-> (a -> Bit 1) | Final flit of atomic transaction? |
-> [Stream a] | Input streams |
-> Module [Stream a] | Output streams |
Shuffle Exchange network. Data from a set of input streams is routed to a set of output streams based on a routing function. The number of streams in and out must be a power of two. The number of 2-input muxes used is N * log(N), where N is the number of stream inputs. The latency of the network is log(N), assuming no congestion and no routing clashes. This is useful to implement network switches thar are too large to be handled by a crossbar (which would require N*N 2-input muxes). The throughput will not match that of a crossbar in general, but the network is capable of routing a large number of packets simultaneously. When the routing pattern is a shift or rotation (by any amount), the throughput is equivalent to that of a full crossbar. Indeed, the network is similar to that found in a barrel shifter.