Methods and interfaces are a way for a module to communicate with
the outside world. A method describes a behavior and the conditions for
BSV methods encapsulate a micro-protocol:
Consider a simplified FIFO definition:
- Each method has an associated READY signal (output port)
- Methods which perform an Action have an associated ENABLE signal (input port)
- Method arguments are input ports
- Method results are output ports
interface Fifo ;
method Action enq(Bit#(32) data) ;
method Bit#(32) first() ;
method ActionValue#(Bit#(32)) deq() ;
This group of methods describes all the inputs and outputs to the FIFO module. The methods are defined within the
Bluespec classifies interface methods into three types. The following pages describe how the method is implemented for the FIFO example.
- Value Methods: These are methods which return a value to the caller. When these methods are called, there is no change of state.
- Action Methods:
These are methods which cause actions (state changes) to occur. One may
consider these as input methods, since they typically take data into
- ActionValue Methods :
These methods couple Action and Value methods, providing an action to
the module which provided the method, and returning a value to the
Bluespec automatically provides appropriate handshaking signals and logic for each method of an interface.