blarney-0.1.0.0
Copyright(c) Matthew Naylor 2020
LicenseMIT
Maintainermattfn@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageGHC2021

Blarney.Interconnect

Description

 
Synopsis

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

makeFairExchange Source #

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

makeTwoWayBroadcast Source #

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

makeShuffleExchange Source #

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.