46 #define THIS_NAME "TOECAM"
48 #define TRACE_OFF 0x0000
49 #define TRACE_CAM 1 << 1
50 #define TRACE_ALL 0xFFFF
52 #define DEBUG_LEVEL (TRACE_OFF)
57 #define MAX_CAM_LATENCY 0
62 #define CAM_ARRAY_SIZE 2
82 #pragma HLS pipeline II=1 enable_flush
83 if ((CamArray0.
key == key) && (CamArray0.
valid ==
true)) {
84 value = CamArray0.
value;
87 else if ((CamArray1.
key == key) && (CamArray1.
valid ==
true)) {
88 value = CamArray1.
value;
91 else if ((CamArray2.
key == key) && (CamArray2.
valid ==
true)) {
92 value = CamArray2.
value;
95 else if ((CamArray3.
key == key) && (CamArray3.
valid ==
true)) {
96 value = CamArray3.
value;
99 else if ((CamArray4.
key == key) && (CamArray4.
valid ==
true)) {
100 value = CamArray4.
value;
103 else if ((CamArray5.
key == key) && (CamArray5.
valid ==
true)) {
104 value = CamArray5.
value;
107 else if ((CamArray6.
key == key) && (CamArray6.
valid ==
true)) {
108 value = CamArray6.
value;
111 else if ((CamArray7.
key == key) && (CamArray7.
valid ==
true)) {
112 value = CamArray7.
value;
128 #pragma HLS pipeline II=1 enable_flush
130 if (CamArray0.
valid ==
false) {
134 else if (CamArray1.
valid ==
false) {
138 else if (CamArray2.
valid ==
false) {
142 else if (CamArray3.
valid ==
false) {
146 else if (CamArray4.
valid ==
false) {
150 else if (CamArray5.
valid ==
false) {
154 else if (CamArray6.
valid ==
false) {
158 else if (CamArray7.
valid ==
false) {
176 #pragma HLS pipeline II=1 enable_flush
178 if ((CamArray0.
key == key) && (CamArray0.
valid ==
true)) {
179 CamArray0.
valid =
false;
182 else if ((CamArray1.
key == key) && (CamArray1.
valid ==
true)) {
183 CamArray1.
valid =
false;
186 else if ((CamArray2.
key == key) && (CamArray2.
valid ==
true)) {
187 CamArray2.
valid =
false;
190 else if ((CamArray3.
key == key) && (CamArray3.
valid ==
true)) {
191 CamArray3.
valid =
false;
194 else if ((CamArray4.
key == key) && (CamArray4.
valid ==
true)) {
195 CamArray4.
valid =
false;
198 else if ((CamArray5.
key == key) && (CamArray5.
valid ==
true)) {
199 CamArray5.
valid =
false;
202 else if ((CamArray6.
key == key) && (CamArray6.
valid ==
true)) {
203 CamArray6.
valid =
false;
206 else if ((CamArray7.
key == key) && (CamArray7.
valid ==
true)) {
207 CamArray7.
valid =
false;
237 ap_uint<1> *poMMIO_CamReady,
241 stream<CamSessionLookupRequest> &siTOE_SssLkpReq,
242 stream<CamSessionLookupReply> &soTOE_SssLkpRep,
243 stream<CamSessionUpdateRequest> &siTOE_SssUpdReq,
244 stream<CamSessionUpdateReply> &soTOE_SssUpdRep)
247 #pragma HLS INTERFACE ap_ctrl_none port=return
249 #pragma HLS PIPELINE II=1 enable_flush
254 #pragma HLS RESET variable=CamArray0
255 #pragma HLS RESET variable=CamArray1
256 #pragma HLS RESET variable=CamArray2
257 #pragma HLS RESET variable=CamArray3
258 #pragma HLS RESET variable=CamArray4
259 #pragma HLS RESET variable=CamArray5
260 #pragma HLS RESET variable=CamArray6
261 #pragma HLS RESET variable=CamArray7
264 static enum FsmStates { CAM_WAIT_4_REQ=0, CAM_LOOKUP_REP, CAM_UPDATE_REP } \
265 cam_fsmState=CAM_WAIT_4_REQ;
266 #pragma HLS RESET variable=cam_fsmState
267 static int cam_startupDelay = 100;
268 #pragma HLS RESET variable=cam_startupDelay
273 static int cam_idleCnt = 0;
278 if (cam_startupDelay) {
279 *poMMIO_CamReady = 0;
284 *poMMIO_CamReady = 1;
290 switch (cam_fsmState) {
292 if (!siTOE_SssLkpReq.empty()) {
293 siTOE_SssLkpReq.read(cam_request);
295 cam_fsmState = CAM_LOOKUP_REP;
297 else if (!siTOE_SssUpdReq.empty()) {
298 siTOE_SssUpdReq.read(cam_update);
300 cam_fsmState = CAM_UPDATE_REP;
305 if (cam_idleCnt > 0) {
316 printInfo(myName,
"Received a session lookup request from %d for socket pair: \n",
317 cam_request.
source.to_int());
322 cam_fsmState = CAM_WAIT_4_REQ;
327 if (cam_idleCnt > 0) {
342 printInfo(myName,
"Received a session cam_update request (%d) from %d for socket pair: \n",
343 cam_update.
op, cam_update.
source.to_int());
348 cam_fsmState = CAM_WAIT_4_REQ;
366 #if HLS_VERSION == 2017
371 ap_uint<1> *poMMIO_CamReady,
375 stream<CamSessionLookupRequest> &siTOE_SssLkpReq,
376 stream<CamSessionLookupReply> &soTOE_SssLkpRep,
377 stream<CamSessionUpdateRequest> &siTOE_SssUpdReq,
378 stream<CamSessionUpdateReply> &soTOE_SssUpdRep)
381 #pragma HLS INTERFACE ap_ctrl_none port=return
388 #pragma HLS INTERFACE ap_none register port=poMMIO_CamReady name=poMMIO_CamReady
390 #pragma HLS resource core=AXI4Stream variable=siTOE_SssLkpReq metadata="-bus_bundle siTOE_SssLkpReq"
391 #pragma HLS DATA_PACK variable=siTOE_SssLkpReq
392 #pragma HLS resource core=AXI4Stream variable=soTOE_SssLkpRep metadata="-bus_bundle soTOE_SssLkpRep"
393 #pragma HLS DATA_PACK variable=soTOE_SssLkpRep
394 #pragma HLS resource core=AXI4Stream variable=siTOE_SssUpdReq metadata="-bus_bundle siTOE_SssUpdReq"
395 #pragma HLS DATA_PACK variable=siTOE_SssUpdReq
396 #pragma HLS resource core=AXI4Stream variable=soTOE_SssUpdRep metadata="-bus_bundle soTOE_SssUpdRep"
397 #pragma HLS DATA_PACK variable=soTOE_SssUpdRep
418 ap_uint<1> *poMMIO_CamReady,
422 stream<CamSessionLookupRequest> &siTOE_SssLkpReq,
423 stream<CamSessionLookupReply> &soTOE_SssLkpRep,
424 stream<CamSessionUpdateRequest> &siTOE_SssUpdReq,
425 stream<CamSessionUpdateReply> &soTOE_SssUpdRep)
428 #pragma HLS INTERFACE ap_ctrl_none port=return
430 #pragma HLS INTERFACE ap_none register port=poMMIO_CamReady name=poMMIO_CamReady
432 #pragma HLS INTERFACE axis off port=siTOE_SssLkpReq
433 #pragma HLS DATA_PACK variable=siTOE_SssLkpReq
434 #pragma HLS INTERFACE axis register both port=soTOE_SssLkpRep
435 #pragma HLS DATA_PACK variable=soTOE_SssLkpRep
436 #pragma HLS INTERFACE axis off port=siTOE_SssUpdReq
437 #pragma HLS DATA_PACK variable=siTOE_SssUpdReq
438 #pragma HLS INTERFACE axis register both port=soTOE_SssUpdRep
439 #pragma HLS DATA_PACK variable=soTOE_SssUpdRep
442 #pragma HLS DATAFLOW disable_start_propagation
bool camLookup(FourTuple key, RtlSessId &value)
Search the CAM array for a key.
bool camDelete(FourTuple key)
Remove a key-value pair from the CAM array.
bool camInsert(KeyValuePair kVP)
Insert a new key-value pair in the CAM array.
void toecam(ap_uint< 1 > *poMMIO_CamReady, stream< CamSessionLookupRequest > &siTOE_SssLkpReq, stream< CamSessionLookupReply > &soTOE_SssLkpRep, stream< CamSessionUpdateRequest > &siTOE_SssUpdReq, stream< CamSessionUpdateReply > &soTOE_SssUpdRep)
Main process of the Content-Addressable Memory (TOECAM).
void toecam_top(ap_uint< 1 > *poMMIO_CamReady, stream< CamSessionLookupRequest > &siTOE_SssLkpReq, stream< CamSessionLookupReply > &soTOE_SssLkpRep, stream< CamSessionUpdateRequest > &siTOE_SssUpdReq, stream< CamSessionUpdateReply > &soTOE_SssUpdRep)
Top of Content-Addressable Memory (TOECAM).
#define printInfo(callerName, format,...)
A macro to print an information message.
#define concat3(firstCharConst, secondCharConst, thirdCharConst)
void printSockPair(const char *callerName, SocketPair sockPair)
Print a socket pair association.
: Content-Addressable Memory (CAM) for TCP Offload Engine (TOE)