Learning BSV‎ > ‎Interfaces‎ > ‎

ActionValue Methods

An ActionValue method is both an input method and output method. This is not the same as a inout or a tristate bus. It just means that data is both driven in and read out of the module.

For instance, if we define a FIFO with a push and pop method, the interface would look like this:

 interface FIFO;
method Action push(Bit#(32) data);
method ActionValue#(Bit#(32) pop();
endinterface

This would generate the Verilog code:

   // method Action push(Bit#(32) data);
input [31:0] push;
input EN_push;
output RDY_push;

// method ActionValue#(Bit#(32) pop();
output [31:0] pop;
input EN_pop;
output RDY_pop;


It looks like there are no input signals in the method definition, but the compiler generates the enable signal, hence there is an input. BSV automatically generates the Implicit Signals for the methods. With a little practice, you will learn to see input and output signals for each method in an interface.

Comments