cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
rx_sar_table.cpp
Go to the documentation of this file.
1 
17 
43 
56 #include "rx_sar_table.hpp"
57 
58 using namespace hls;
59 
60 
64 #ifndef __SYNTHESIS__
65  extern bool gTraceEvent;
66 #endif
67 
68 #define THIS_NAME "TOE/RSt"
69 
70 #define TRACE_OFF 0x0000
71 #define TRACE_RST 1 << 1
72 #define TRACE_ALL 0xFFFF
73 
74 #define DEBUG_LEVEL (TRACE_OFF)
75 
76 
106  stream<RXeRxSarQuery> &siRXe_RxSarQry,
107  stream<RxSarReply> &soRXe_RxSarRep,
108  stream<RAiRxSarQuery> &siRAi_RxSarQry,
109  stream<RAiRxSarReply> &soRAi_RxSarRep,
110  stream<SessionId> &siTXe_RxSarReq,
111  stream<RxSarReply> &soTxe_RxSarRep)
112 {
113  //-- DIRECTIVES FOR THIS PROCESS -------------------------------------------
114  #pragma HLS PIPELINE II=1 enable_flush
115 
116  const char *myName = THIS_NAME;
117 
118  //-- STATIC ARRAYS ---------------------------------------------------------
119  static RxSarEntry RX_SAR_TABLE[TOE_MAX_SESSIONS];
120  #pragma HLS RESOURCE variable=RX_SAR_TABLE core=RAM_2P
121  #pragma HLS DEPENDENCE variable=RX_SAR_TABLE inter false
122 
123  if(!siTXe_RxSarReq.empty()) {
124  SessionId sessId;
125  //---------------------------------------
126  // [TXe] - Read only access
127  //---------------------------------------
128  siTXe_RxSarReq.read(sessId);
129  soTxe_RxSarRep.write(RxSarReply(RX_SAR_TABLE[sessId].appd,
130  RX_SAR_TABLE[sessId].rcvd,
131  RX_SAR_TABLE[sessId].ooo,
132  RX_SAR_TABLE[sessId].oooHead,
133  RX_SAR_TABLE[sessId].oooTail));
134  if (DEBUG_LEVEL & TRACE_RST) {
135  RxBufPtr free_space = ((RX_SAR_TABLE[sessId].appd -
136  (RxBufPtr)RX_SAR_TABLE[sessId].oooHead(TOE_WINDOW_BITS-1, 0)) - 1);
137  printInfo(myName, "[TXe] Read S%d - FreeSpace=%d\n",
138  sessId.to_uint(), free_space.to_uint());
139  }
140  }
141  else if(!siRAi_RxSarQry.empty()) {
142  RAiRxSarQuery raiQry;
143  //----------------------------------------------------------------
144  // [RAi] - Read or write access to update the application pointer
145  //----------------------------------------------------------------
146  siRAi_RxSarQry.read(raiQry);
147  if(raiQry.write) {
148  RX_SAR_TABLE[raiQry.sessionID].appd = raiQry.appd;
149  if (DEBUG_LEVEL & TRACE_RST) {
150  RxBufPtr free_space = ((RX_SAR_TABLE[raiQry.sessionID].appd -
151  (RxBufPtr)RX_SAR_TABLE[raiQry.sessionID].oooHead(TOE_WINDOW_BITS-1, 0)) - 1);
152  printInfo(myName, "[RAi] Write S%d - FreeSpace=%d\n",
153  raiQry.sessionID.to_uint(), free_space.to_uint());
154  }
155  }
156  else {
157  soRAi_RxSarRep.write(RAiRxSarReply(raiQry.sessionID,
158  RX_SAR_TABLE[raiQry.sessionID].appd));
159  if (DEBUG_LEVEL & TRACE_RST) {
160  RxBufPtr free_space = ((RX_SAR_TABLE[raiQry.sessionID].appd -
161  (RxBufPtr)RX_SAR_TABLE[raiQry.sessionID].oooHead(TOE_WINDOW_BITS-1, 0)) - 1);
162  printInfo(myName, "[RAi] Read S%d - FreeSpace=%d\n",
163  raiQry.sessionID.to_uint(), free_space.to_uint());
164  }
165  }
166  }
167  else if(!siRXe_RxSarQry.empty()) {
168  RXeRxSarQuery rxeQry = siRXe_RxSarQry.read();
169  //---------------------------------------
170  // [RXe] - Write access
171  //---------------------------------------
172  if (rxeQry.write) {
173  RX_SAR_TABLE[rxeQry.sessionID].rcvd = rxeQry.rcvd;
174  if (rxeQry.init) {
175  RX_SAR_TABLE[rxeQry.sessionID].appd = rxeQry.rcvd;
176  }
177  if (rxeQry.ooo) {
178  RX_SAR_TABLE[rxeQry.sessionID].ooo = true;
179  RX_SAR_TABLE[rxeQry.sessionID].oooHead = rxeQry.oooHead;
180  RX_SAR_TABLE[rxeQry.sessionID].oooTail = rxeQry.oooTail;
181  }
182  else {
183  RX_SAR_TABLE[rxeQry.sessionID].ooo = false;
184  RX_SAR_TABLE[rxeQry.sessionID].oooHead = rxeQry.rcvd;
185  RX_SAR_TABLE[rxeQry.sessionID].oooTail = rxeQry.rcvd;
186  }
187  if (DEBUG_LEVEL & TRACE_RST) {
188  RxBufPtr free_space = ((RX_SAR_TABLE[rxeQry.sessionID].appd -
189  (RxBufPtr)RX_SAR_TABLE[rxeQry.sessionID].oooHead(TOE_WINDOW_BITS-1, 0)) - 1);
190  printInfo(myName, "[RXe] Write S%d - FreeSpace=%d\n",
191  rxeQry.sessionID.to_uint(), free_space.to_uint());
192  }
193  }
194  else {
195  // Read access from [RXe]
196  soRXe_RxSarRep.write(RxSarReply(RX_SAR_TABLE[rxeQry.sessionID].appd,
197  RX_SAR_TABLE[rxeQry.sessionID].rcvd,
198  RX_SAR_TABLE[rxeQry.sessionID].ooo,
199  RX_SAR_TABLE[rxeQry.sessionID].oooHead,
200  RX_SAR_TABLE[rxeQry.sessionID].oooTail));
201  if (DEBUG_LEVEL & TRACE_RST) {
202  RxBufPtr free_space = ((RX_SAR_TABLE[rxeQry.sessionID].appd -
203  (RxBufPtr)RX_SAR_TABLE[rxeQry.sessionID].oooHead(TOE_WINDOW_BITS-1, 0)) - 1);
204  printInfo(myName, "[RXe] Read S%d - FreeSpace=%d\n",
205  rxeQry.sessionID.to_uint(), free_space.to_uint());
206  }
207  }
208  }
209 }
210 
SessionId sessionID
Definition: toe.hpp:416
RxBufPtr appd
Definition: toe.hpp:417
RdWrBit write
Definition: toe.hpp:418
CmdBit init
Definition: toe.hpp:391
RdWrBit write
Definition: toe.hpp:390
RxSeqNum rcvd
Definition: toe.hpp:386
RxSeqNum oooTail
Definition: toe.hpp:388
FlagBool ooo
Definition: toe.hpp:389
SessionId sessionID
Definition: toe.hpp:385
RxSeqNum oooHead
Definition: toe.hpp:387
RxSeqNum oooHead
RxBufPtr appd
FlagBool ooo
RxSeqNum rcvd
RxSeqNum oooTail
void rx_sar_table(stream< RXeRxSarQuery > &siRXe_RxSarQry, stream< RxSarReply > &soRXe_RxSarRep, stream< RAiRxSarQuery > &siRAi_RxSarQry, stream< RAiRxSarReply > &soRAi_RxSarRep, stream< SessionId > &siTXe_RxSarReq, stream< RxSarReply > &soTxe_RxSarRep)
Rx SAR Table (RSt)
bool gTraceEvent
Definition: tb_nal.cpp:151
#define THIS_NAME
TcpBufAdr RxBufPtr
Definition: toe.hpp:298
#define DEBUG_LEVEL
#define TRACE_RST
ap_uint< 16 > SessionId
Definition: nts_types.hpp:136
#define printInfo(callerName, format,...)
A macro to print an information message.
Definition: nts_utils.hpp:169
: Rx Segmentation And Re-assembly Table (RSt).