Get Put

Reference 1 C.7.1 GetPut

import GetPut::*;

Two blocks: Someone else gets or retrieves an item from an interface and Someone else put or gives an item to an iterface.

Commonly used in Transaction Level Modeling, or TLM.

Get

You can retrieve (get) data from an object.

method: get(): returns an item from an interface and removes it from the object.

interface Get#(type a);
  method ActionValue#(a) get();
endinterface: Get

Example:

module mkMyFifoUpstream (Get#(int));
   ...
   method ActionValue#(int) get();
     f.deq;
     return f.first;
   endmethod
...

Put

You can give (put) data to an object.

method: put(a_type a) give an item of type a_type to an interface.

interface Put#(type element_type);
    method Action put(element_type x1);
endinterface: Put

Example:

module mkMyFifoDownstream (Put#(int));
  ...
  method Action put(int x);
    F.enq(x);
  endmethod
...

ToGet/ToPut

Two typeclasses: ToGet and ToPut, used to create associated Get and Put interfaces from other types.

  • typeclass ToGet#(a,b); function Get#(b) toGet(a ax); endtypeclass
  • typeclass ToPut#(a,b); function Put#(b) toPut(a ax); endtypeclass

GetS

Like a Get interface, but separates the get method into two methods: a first and a deq.

GetPut

Todo.


  1. Bluespec Reference Guide. 2017 ↩
Created May 7, 2020 // Last Updated May 7, 2020

If you could revise
the fundmental principles of
computer system design
to improve security...

... what would you change?