rlm@8: import FIFO::*; rlm@8: import FIFOF::*; rlm@8: import Clocks::*; rlm@8: import GetPut::*; rlm@8: rlm@8: function FIFO#(fifo_type) guardedfifofToFifo( FIFOF#(fifo_type) fifo); rlm@8: rlm@8: FIFO#(fifo_type) f = interface FIFO#(fifo_type); rlm@8: method first = fifo.first; rlm@8: method enq = fifo.enq; rlm@8: method deq = fifo.deq; rlm@8: method clear = fifo.clear; rlm@8: endinterface; rlm@8: return f; rlm@8: endfunction rlm@8: rlm@8: function Get#(fifo_type) syncFifoToGet( SyncFIFOIfc#(fifo_type) fifo); rlm@8: Get#(fifo_type) f = interface Get#(fifo_type); rlm@8: method ActionValue#(fifo_type) get(); rlm@8: fifo.deq; rlm@8: return fifo.first; rlm@8: endmethod rlm@8: endinterface; rlm@8: return f; rlm@8: endfunction rlm@8: rlm@8: function Put#(fifo_type) syncFifoToPut( SyncFIFOIfc#(fifo_type) fifo); rlm@8: Put#(fifo_type) f = interface Put#(fifo_type); rlm@8: method Action put(fifo_type data); rlm@8: fifo.enq(data); rlm@8: endmethod rlm@8: endinterface; rlm@8: return f; rlm@8: endfunction rlm@8: rlm@8: function String fifofState(FIFOF#(data) fifo); rlm@8: String s = ""; rlm@8: rlm@8: if(!fifo.notEmpty) rlm@8: begin rlm@8: s = "Empty"; rlm@8: end rlm@8: else if (!fifo.notFull) rlm@8: begin rlm@8: s = "Full"; rlm@8: end rlm@8: else rlm@8: begin rlm@8: s = "Neither Empty Nor Full"; rlm@8: end rlm@8: rlm@8: return s; rlm@8: endfunction rlm@8: