Mercurial > pygar
view modules/bluespec/Pygar/lab4/CBUFF.bsv @ 37:0475235d1513 pygar svn.38
[svn r38] fixed audiocorepipe
author | punk |
---|---|
date | Tue, 04 May 2010 19:25:30 -0400 |
parents | 74716e9a81cc |
children |
line wrap: on
line source
1 import Connectable::*;2 import GetPut::*;3 import ClientServer::*;5 `include "asim/provides/librl_bsv_storage.bsh"7 typedef SCOREBOARD_FIFO_ENTRY_ID#(t) CBUFFToken#(type t);9 interface CBUFF #(numeric type n, type element_type);10 interface Get#(CBUFFToken#(n)) reserve;11 interface Put#(Tuple2 #(CBUFFToken#(n), element_type)) complete;12 interface Get#(element_type) drain;13 endinterface15 module mkCBUFF(CBUFF#(n, element_type))16 provisos(Bits#(element_type,a__));18 SCOREBOARD_FIFOF#(n,element_type) cbuff <- mkScoreboardFIFOF();20 let res = interface Get;21 method ActionValue#(CBUFFToken#(n)) get();22 let tok <- cbuff.enq();23 return tok;24 endmethod25 endinterface;27 let comp = interface Put;28 method Action put(Tuple2#(CBUFFToken#(n),element_type) t);29 cbuff.setValue(tpl_1(t), tpl_2(t));30 endmethod31 endinterface;33 let dr = interface Get;34 method ActionValue#(element_type) get();35 cbuff.deq();36 return cbuff.first();37 endmethod38 endinterface;40 interface Get reserve = res;41 interface Put complete = comp;42 interface Get drain = dr;44 endmodule