BlueBasics
is a Bluespec library of basic helper types and utilities.
The functionalities provided by BlueBasics
should only rely on primitives already present in a standard Bluespec distribution or on other BlueBasics
-provided primitives.
1. SourceSink
The Source
and Sink
types are the most central types introduced by BlueBasics
.
They augment the standard Get
and Put
with explicit control flow signal (the way FIFOF
augments FIFO
).
They are used virtually everywhere else in BlueBasics
(and in Bluespec code that relies on BlueBasics
).
They are particulary usefull to design low latency interconnect components.
interface Source #(type t);
(* always_ready *) method Bool canPeek;
method t peek;
method Action drop;
endinterface
interface Sink #(type t);
(* always_ready *) method Bool canPut;
method Action put (t val);
endinterface
2. Primitives
In addition to the previous Source
and Sink
interfaces, some credit-based SourceWithCredit
and SinkWithCredit
are also provided whose flow control is guarded on the presence of credit which is exchange through an extra Sink
or Source
interface.
typedef struct {
Source #(t) data;
Sink #(Bit #(0)) credit;
} SourceWithCredit #(type t);
Some helper Bluespec modules are provided to augment `Source`s and `Sink`s with credit.
module toSourceWithCredit #(parameter NumProxy #(t_max_credits) _proxy, t_src s)
(SourceWithCredit #(t));
4. MasterSlave
A Master
is a Source
of requests and a Sink
for responses.
A Slave
is a Sink
for requests and a Source
of responses.
5. Virtualize
The Virtualizable
typeclass provides a single method, virtualize
, which receive an instance of an interface together with an integer n
, and return an array of n
virtualized interfaces to the initial interface.
Virtualizable
instances are also provided for Reg
, Server
and Slave
.