11. Pipe Package¶
The Pipe package is modeled on Bluespec, Inc’s PAClib package. It provides functions and modules for composing pipelines of operations.
11.1. Pipe Interfaces¶
-
interface
Pipe::
PipeIn
(type a)¶ Corresponds to the input interface of a FIFOF.
-
enq
(a v) → Action¶
-
notFull
→ Bool¶
-
-
interface
Pipe::
PipeOut
(type a)¶ Corresponds to the output interface of a FIFOF.
-
first
→ a¶
-
deq
→ Action¶
-
notEmpty
→ Bool¶
-
-
typeclass
Pipe::
ToPipeIn
(type a, type b)¶ -
function
toPipeIn
(b in) → PipeIn#(a)¶ Returns a PipeIn to the object “in” with no additional buffering.
-
function
-
typeclass
Pipe::
ToPipeOut
(type a, type b)¶ -
function
toPipeOut
(b in) → PipeOut#(a)¶ Returns a PipeOut from the object “in” with no additional buffering.
-
function
-
typeclass
Pipe::
MkPipeIn
(type a, type b)¶ -
module
mkPipeIn
(b in) → (PipeIn#(a)¶ Instantiates a module whose interface is a PipeIn to the input parameter “in”. Includes a FIFO buffering stage.
-
module
-
typeclass
Pipe::
MkPipeOut
(type a, type b)¶ -
module
mkPipeOut
(b in) → (PipeOut#(a)¶ Instantiates a module whose interface is PipeOut from the input parameter “in”. Includes a FIFO buffering stage.
-
module
-
instance
Pipe::
ToPipeIn
(a, FIFOF#(a)) Converts a FIFOF to a PipeIn.
-
instance
Pipe::
ToPipeOut
(a, function a pipefn()) Converts a function to a PipeOut.
-
instance
Pipe::
ToPipeOut
(a, Reg#(a)) Converts a register to a PipeOut.
-
instance
Pipe::
ToPipeIn
(Vector#(m, a), Gearbox#(m, n, a)) Converts a Gearbox to a PipeOut.
-
instance
Pipe::
ToPipeOut
(a, FIFOF#(a)) Converts a FIFOF to a PipeOut.
-
instance
Pipe::
ToPipeOut
(Vector#(n, a), MIMO#(k, n, sz, a)) Converts a MIMO to a PipeOut.
-
instance
Pipe::
ToPipeOut
(Vector#(n, a), Gearbox#(m, n, a)) Converts a Gearbox to a PipeOut.
-
instance
Pipe::
MkPipeOut
(a, Get#(a)) Instantiates a pipelined PipeOut from a Get interface.
-
instance
Pipe::
MkPipeIn
(a, Put#(a)) Instantiates a pipelined PipeIn to a Put interface.
11.2. Get and Put Pipes¶
-
instance
Pipe::
ToGet
(PipeOut #(a), a)¶
-
instance
Pipe::
ToPut
(PipeIn #(a), a)¶
11.3. Connectable Pipes¶
-
instance
Pipe::
Connectable
(PipeOut#(a), Put#(a))¶
-
instance
Pipe::
Connectable
(PipeOut#(a), PipeIn#(a))
11.4. Mapping over Pipes¶
-
function
Pipe::
toCountedPipeOut
(Reg#(Bit#(n)) r, PipeOut#(a) pipe) → PipeOut#(a)¶
-
function
Pipe::
zipPipeOut
(PipeOut#(a) ina, PipeOut#(b) inb) → PipeOut#(Tuple2#(a,b))¶ Returns a PipeOut whose elements are 2-tuples of the elements of the input pipes.
-
function
Pipe::
mapPipe
(function b f(a av), PipeOut#(a) apipe) → PipeOut#(b)¶ Returns a PipeOut that maps the function f to each element of the input pipes with no buffering.
-
module
Pipe::
mkMapPipe
(function b f(a av), PipeOut#(a) apipe) → (PipeOut#(b)¶ Instantiates a PipeOut that maps the function f to each element of the input pipes using a FIFOF for buffering.
-
function
Pipe::
mapPipeIn
(function b f(a av), PipeIn#(b) apipe) → PipeIn#(a)¶ Returns a PipeIn applies the function f to each value that is enqueued.
11.5. Reducing Pipes¶
11.6. Functions on Pipes of Vectors¶
-
function
Pipe::
unvectorPipeOut
(PipeOut#(Vector#(1, a)) in) → PipeOut#(a)¶
11.7. Funneling and Unfunneling¶
-
module
Pipe::
mkFunnel
(PipeOut#(Vector#(mk, a)) in) → (PipeOut#(Vector#(m, a))¶ Returns k Vectors of m elements for each Vector#(mk,a) element of the input pipe.
-
module
Pipe::
mkFunnel1
(PipeOut#(Vector#(k, a)) in) → (PipeOut#(a)¶ Sames as mkFunnel, but returns k singleton elements for each vector element of the input pipe.
-
module
Pipe::
mkFunnelGB1
(Clock slowClock, Reset slowReset, Clock fastClock, Reset fastReset, PipeOut#(Vector#(k, a)) in) → (PipeOut#(a)¶ Same as mkFunnel1, but uses a Gearbox with a 1 to k ratio.
-
module
Pipe::
mkUnfunnel
(PipeOut#(Vector#(m, a)) in) → (PipeOut#(Vector#(mk, a))¶ The dual of mkFunnel. Consumes k elements from the input pipe, each of which is an m-element vector, and returns an mk-element vector.
-
module
Pipe::
mkUnfunnelGB
(Clock slowClock, Reset slowReset, Clock fastClock, Reset fastReset, PipeOut#(Vector#(1, a)) in) → (PipeOut#(Vector#(k, a))¶ The same as mkUnfunnel, but uses a Gearbox with a 1-to-k.
-
module
Pipe::
mkRepeat
(UInt#(n) repetitions, PipeOut#(a) inpipe) → (PipeOut#(a)¶ Returns a PipeOut which repeats each element of the input pipe the specified number of times.
11.8. Fork and Join¶
Fork and Join with limited scalability
-
module
Pipe::
mkForkVector
(PipeOut#(a) inpipe) → (Vector#(n, PipeOut#(a))¶ Replicates each element of the input pipe to each of the output pipes. It uses a FIFOF per output pipe.
-
module
Pipe::
mkSizedForkVector
(Integer size, PipeOut#(a) inpipe) → (Vector#(n, PipeOut#(a))¶ Used a SizedFIFOF for each of the output pipes.
-
module
Pipe::
mkJoin
(function c f(a av, b bv), PipeOut#(a) apipe, PipeOut#(b) bpipe) → (PipeOut#(c)¶ Returns a PipeOut that applies the function f to the elements of the input pipes, with no buffering.
-
module
Pipe::
mkJoinBuffered
(function c f(a av, b bv), PipeOut#(a) apipe, PipeOut#(b) bpipe) → (PipeOut#(c)¶ Returns a PipeOut that applies the function f to the elements of the input pipes, using a FIFOF to buffer the output.
-
module
Pipe::
mkJoinVector
(function b f(Vector#(n, a) av), Vector#(n, PipeOut#(a)) apipes) → (PipeOut#(b)¶ Same as mkJoin, but operates on a vector of PipeOut as input.
11.9. Funnel Pipes¶
Fork and Join with tree-based fanout and fanin for scalability.
These are used by MemReadEngine and MemWriteEngine.
-
typedef
Pipe::
Vector#(j,PipeOut#(a)) FunnelPipe#(numeric type j, numeric type k, type a, numeric type bitsPerCycle)
¶
-
typedef
Pipe::
Vector#(k,PipeOut#(a)) UnFunnelPipe#(numeric type j, numeric type k, type a, numeric type bitsPerCycle)
¶
-
typeclass
Pipe::
FunnelPipesPipelined
(numeric type j, numeric type k, type a, numeric type bpc)¶ -
module
mkFunnelPipesPipelined
(Vector#(k, PipeOut#(a)) in) → (FunnelPipe#(j,k,a,bpc)¶
-
module
mkFunnelPipesPipelinedRR
(Vector#(k, PipeOut#(a)) in, Integer c) → (FunnelPipe#(j,k,a,bpc)¶
-
module
mkUnFunnelPipesPipelined
(Vector#(j, PipeOut#(Tuple2#(Bit#(TLog#(k)), a))) in) → (UnFunnelPipe#(j,k,a,bpc)¶
-
module
mkUnFunnelPipesPipelinedRR
(Vector#(j, PipeOut#(a)) in, Integer c) → (UnFunnelPipe#(j,k,a,bpc)¶
-
module
-
instance
Pipe::
FunnelPipesPipelined
(1, 1, a, bpc)
-
instance
Pipe::
FunnelPipesPipelined
(1, k, a, bpc)
-
module
Pipe::
mkUnFunnelPipesPipelinedInternal
(Vector#(1, PipeOut#(Tuple2#(Bit#(TLog#(k)), a))) in) → (UnFunnelPipe#(1,k,a,bpc)¶
-
module
Pipe::
mkFunnelPipes
(Vector#(mk, PipeOut#(a)) ins) → (Vector#(m, PipeOut#(a))¶
-
module
Pipe::
mkFunnelPipes1
(Vector#(k, PipeOut#(a)) ins) → (PipeOut#(a)¶
-
module
Pipe::
mkUnfunnelPipes
(Vector#(m, PipeOut#(a)) ins) → (Vector#(mk, PipeOut#(a))¶
-
module
Pipe::
mkPipelinedForkVector
(PipeOut#(a) inpipe, Integer id) → (UnFunnelPipe#(1,k,a,bpc)¶
11.10. Delimited Pipes¶
-
interface
Pipe::
FirstLastPipe
(type a)¶ A pipe whose elements two-tuples of boolean values indicating first and last in a series. The ttype a indicates the type of the counter used.
-
pipe
→ PipeOut#(Tuple2#(Bool,Bool))¶ The pipe of delimited elements
-
start
(a count) → Action¶ Starts the series of count elements
-
-
module
Pipe::
mkFirstLastPipe
→ (FirstLastPipe#(a)¶ Creates a FirstLastPipe.
-
struct
Pipe::
RangeConfig#(type a)
¶ The base, limit and step for mkRangePipeOut.
-
xbase
→ a¶
-
xlimit
→ a¶
-
xstep
→ a¶
-
-
interface
Pipe::
RangePipeIfc
(type a)¶ -
pipe
→ PipeOut#(a)¶
-
isFirst
→ Bool¶
-
isLast
→ Bool¶
-
start
(RangeConfig#(a) cfg) → Action¶
-
-
module
Pipe::
mkRangePipeOut
→ (RangePipeIfc#(a)¶ Creates a Pipe of values from xbase to xlimit by xstep. Used by MemRead.