cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
nal.cpp
Go to the documentation of this file.
1 
17 
33 #include "nal.hpp"
34 
35 //#include "hls_math.h"
36 //ap_uint<32> getRightmostBitPos(ap_uint<32> num)
37 //{
38 //#pragma HLS INLINE
39 // return (ap_uint<32>) ((half) hls::log2((half)(num & -num)));
40 //}
41 
42 //returns the ZERO-based bit position (so 0 for LSB)
43 ap_uint<32> getRightmostBitPos(ap_uint<32> num)
44 {
45 #pragma HLS INLINE off
46  ap_uint<32> one_hot = num & -num;
47  ap_uint<32> pos = 0;
48  for (int i = 0; i < 32; i++)
49  {
50 #pragma HLS unroll
51  if(one_hot <= 1)
52  {
53  break;
54  }
55  pos++;
56  one_hot >>= 1;
57  }
58  //printf("[NAL:RigthmostBit] returning %d for input %d\n", (int) pos, (int) num);
59  return pos;
60 }
61 
62 NalTriple newTriple(Ip4Addr ipRemoteAddres, TcpPort tcpRemotePort, TcpPort tcpLocalPort)
63 {
64 #pragma HLS INLINE
65  NalTriple new_entry = (((ap_uint<64>) ipRemoteAddres) << 32) | (((ap_uint<32>) tcpRemotePort) << 16) | tcpLocalPort;
66  return new_entry;
67 }
68 
69 
71 {
72 #pragma HLS INLINE
73  ap_uint<32> ret = ((ap_uint<32>) (triple >> 32)) & 0xFFFFFFFF;
74  return (Ip4Addr) ret;
75 }
76 
77 
79 {
80 #pragma HLS INLINE
81  ap_uint<16> ret = ((ap_uint<16>) (triple >> 16)) & 0xFFFF;
82  return (TcpPort) ret;
83 }
84 
85 
87 {
88 #pragma HLS INLINE
89  ap_uint<16> ret = (ap_uint<16>) (triple & 0xFFFF);
90  return (TcpPort) ret;
91 }
92 
93 
94 uint8_t extractByteCnt(AxisRaw currWord)
95 {
96 #pragma HLS INLINE
97 
98  uint8_t ret = 0;
99 
100  switch (currWord.getLE_TKeep()) {
101  case 0b11111111:
102  ret = 8;
103  break;
104  case 0b01111111:
105  ret = 7;
106  break;
107  case 0b00111111:
108  ret = 6;
109  break;
110  case 0b00011111:
111  ret = 5;
112  break;
113  case 0b00001111:
114  ret = 4;
115  break;
116  case 0b00000111:
117  ret = 3;
118  break;
119  case 0b00000011:
120  ret = 2;
121  break;
122  default:
123  case 0b00000001:
124  ret = 1;
125  break;
126  }
127  return ret;
128 }
129 
130 uint8_t extractByteCnt(NetworkWord currWord)
131 {
132 #pragma HLS INLINE
133 
134  uint8_t ret = 0;
135 
136  switch (currWord.tkeep) {
137  case 0b11111111:
138  ret = 8;
139  break;
140  case 0b01111111:
141  ret = 7;
142  break;
143  case 0b00111111:
144  ret = 6;
145  break;
146  case 0b00011111:
147  ret = 5;
148  break;
149  case 0b00001111:
150  ret = 4;
151  break;
152  case 0b00000111:
153  ret = 3;
154  break;
155  case 0b00000011:
156  ret = 2;
157  break;
158  default:
159  case 0b00000001:
160  ret = 1;
161  break;
162  }
163  return ret;
164 }
165 
166 
181  stream<NalEventNotif> &internal_event_fifo,
182  ap_uint<1> *layer_7_enabled,
183  ap_uint<1> *role_decoupled,
184  stream<NalConfigUpdate> &sConfigUpdate,
185  stream<uint32_t> &mrt_version_update,
186  stream<NalPortUpdate> &sNalPortUpdate,
187  stream<NalStatusUpdate> &sStatusUpdate
188 
189  )
190 { //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
191 #pragma HLS INLINE off
192 #pragma HLS pipeline II=1
193  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
194  static ap_uint<32> node_id_missmatch_RX_cnt = 0;
195  static NodeId last_rx_node_id = 0;
196  static NrcPort last_rx_port = 0;
197  static ap_uint<32> node_id_missmatch_TX_cnt = 0;
198  static NodeId last_tx_node_id = 0;
199  static NrcPort last_tx_port = 0;
200  static ap_uint<16> port_corrections_TX_cnt = 0;
201  static ap_uint<32> unauthorized_access_cnt = 0;
202  static ap_uint<32> authorized_access_cnt = 0;
203  static ap_uint<32> fmc_tcp_bytes_cnt = 0;
204 
205  static ap_uint<32> packet_count_RX = 0;
206  static ap_uint<32> packet_count_TX = 0;
207  static NodeId own_rank = 0;
208 
209  static ap_uint<16> tcp_new_connection_failure_cnt = 0;
210 
211 
212  static bool tables_initialized = false;
213  static uint8_t status_update_i = 0;
214 
215 #pragma HLS reset variable=node_id_missmatch_RX_cnt
216 #pragma HLS reset variable=node_id_missmatch_TX_cnt
217 #pragma HLS reset variable=port_corrections_TX_cnt
218 #pragma HLS reset variable=packet_count_RX
219 #pragma HLS reset variable=packet_count_TX
220 #pragma HLS reset variable=last_rx_node_id
221 #pragma HLS reset variable=last_rx_port
222 #pragma HLS reset variable=last_tx_node_id
223 #pragma HLS reset variable=last_tx_port
224 #pragma HLS reset variable=unauthorized_access_cnt
225 #pragma HLS reset variable=authorized_access_cnt
226 #pragma HLS reset variable=fmc_tcp_bytes_cnt
227 #pragma HLS reset variable=tcp_new_connection_failure_cnt
228 #pragma HLS reset variable=tables_initialized
229 #pragma HLS reset variable=status_update_i
230 #pragma HLS reset variable=own_rank
231 
232  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
233 
234  static ap_uint<32> status[NUMBER_STATUS_WORDS];
235  static ap_uint<32> old_status[NUMBER_STATUS_WORDS];
236 
237 #pragma HLS ARRAY_PARTITION variable=status complete dim=1
238 #pragma HLS ARRAY_PARTITION variable=old_status complete dim=1
239 
240  // ----- tables init -----
241  if(!tables_initialized)
242  {
243  for(int i = 0; i < NUMBER_STATUS_WORDS; i++)
244  {
245  status[i] = 0x0;
246  old_status[i] = 0x0;
247  }
248  tables_initialized = true;
249  } else if( *layer_7_enabled == 0 || *role_decoupled == 1
250  && (packet_count_TX > 0 || packet_count_RX > 0 )
251  )
252  {
253  //reset counters
254  packet_count_TX = 0x0;
255  packet_count_RX = 0x0;
256  last_rx_port = 0x0;
257  last_rx_node_id = 0x0;
258  last_tx_port = 0x0;
259  last_tx_node_id = 0x0;
260  } else if(!sConfigUpdate.empty())
261  {
262  NalConfigUpdate ca = sConfigUpdate.read();
264  {
265  own_rank = ca.update_value;
266  status[NAL_STATUS_OWN_RANK] = (ap_uint<32>) own_rank;
267  }
268  } else if(!mrt_version_update.empty())
269  {
270  status[NAL_STATUS_MRT_VERSION] = mrt_version_update.read();
272  //packet_count_TX = 0x0;
273  //packet_count_RX = 0x0;
274  //last_rx_port = 0x0;
275  //last_rx_node_id = 0x0;
276  //last_tx_port = 0x0;
277  //last_tx_node_id = 0x0;
278  }
279  else if(!sNalPortUpdate.empty())
280  {
281  NalPortUpdate update = sNalPortUpdate.read();
282  switch(update.port_type)
283  {
284  case FMC:
285  status[NAL_STATUS_FMC_PORT_PROCESSED] = update.new_value;
286  break;
287  case UDP:
288  status[NAL_STATUS_OPEN_UDP_PORTS] = update.new_value;
289  break;
290  case TCP:
291  status[NAL_STATUS_OPEN_TCP_PORTS] = update.new_value;
292  break;
293  }
294  }
295  else if(!internal_event_fifo.empty())
296  {
297  NalEventNotif nevs = internal_event_fifo.read();
298  //printf("[DEBUG] Process event %d with update value %d\n", \
299  // (int) nevs.type, (int) nevs.update_value);
300 
301  switch(nevs.type)
302  {
303  case NID_MISS_RX:
304  node_id_missmatch_RX_cnt += nevs.update_value;
305  break;
306  case NID_MISS_TX:
307  node_id_missmatch_TX_cnt += nevs.update_value;
308  break;
309  case PCOR_TX:
310  port_corrections_TX_cnt += (ap_uint<16>) nevs.update_value;
311  break;
312  case TCP_CON_FAIL:
313  tcp_new_connection_failure_cnt += (ap_uint<16>) nevs.update_value;
314  break;
315  case LAST_RX_PORT:
316  last_rx_port = (ap_uint<16>) nevs.update_value;
317  break;
318  case LAST_RX_NID:
319  last_rx_node_id = (NodeId) nevs.update_value;
320  break;
321  case LAST_TX_PORT:
322  last_tx_port = (ap_uint<16>) nevs.update_value;
323  break;
324  case LAST_TX_NID:
325  last_tx_node_id = (NodeId) nevs.update_value;
326  break;
327  case PACKET_RX:
328  packet_count_RX += nevs.update_value;
329  break;
330  case PACKET_TX:
331  packet_count_TX += nevs.update_value;
332  break;
333  case UNAUTH_ACCESS:
334  unauthorized_access_cnt += nevs.update_value;
335  break;
336  case AUTH_ACCESS:
337  authorized_access_cnt += nevs.update_value;
338  break;
339  case FMC_TCP_BYTES:
340  fmc_tcp_bytes_cnt += nevs.update_value;
341  break;
342  default:
343  printf("[ERROR] Internal Event Processing received invalid event %d with update value %d\n", \
344  (int) nevs.type, (int) nevs.update_value);
345  break;
346  }
347 
348  } else {
349 
350  //update status entries
351  //status[NAL_STATUS_MRT_VERSION] = *mrt_version_processed;
352  //status[NAL_STATUS_OPEN_UDP_PORTS] = *udp_rx_ports_processed;
353  //status[NAL_STATUS_OPEN_TCP_PORTS] = *tcp_rx_ports_processed;
354  //status[NAL_STATUS_FMC_PORT_PROCESSED] = (ap_uint<32>) *processed_FMC_listen_port;
355  //status[NAL_STATUS_OWN_RANK] = (ap_uint<32>) *own_rank;
356 
357  //udp
358  //status[NAL_STATUS_SEND_STATE] = (ap_uint<32>) fsmStateRX_Udp;
359  //status[NAL_STATUS_RECEIVE_STATE] = (ap_uint<32>) fsmStateTXenq_Udp;
360  //status[NAL_STATUS_GLOBAL_STATE] = (ap_uint<32>) fsmStateTXdeq_Udp;
361 
362  //tcp
363  //status[NAL_STATUS_SEND_STATE] = (ap_uint<32>) wrpFsmState;
364  //status[NAL_STATUS_RECEIVE_STATE] = (ap_uint<32>) rdpFsmState;
365  //status[NAL_STATUS_GLOBAL_STATE] = (ap_uint<32>) opnFsmState;
366 
367  status[NAL_STATUS_GLOBAL_STATE] = fmc_tcp_bytes_cnt;
368 
369  //status[NAL_STATUS_RX_NODEID_ERROR] = (ap_uint<32>) node_id_missmatch_RX_cnt;
370  status[NAL_STATUS_RX_NODEID_ERROR] = (((ap_uint<32>) port_corrections_TX_cnt) << 16) | ( 0xFFFF & ((ap_uint<16>) node_id_missmatch_RX_cnt));
371  status[NAL_STATUS_LAST_RX_NODE_ID] = (ap_uint<32>) (( (ap_uint<32>) last_rx_port) << 16) | ( (ap_uint<32>) last_rx_node_id);
372  //status[NAL_STATUS_TX_NODEID_ERROR] = (ap_uint<32>) node_id_missmatch_TX_cnt;
373  status[NAL_STATUS_TX_NODEID_ERROR] = (((ap_uint<32>) tcp_new_connection_failure_cnt) << 16) | ( 0xFFFF & ((ap_uint<16>) node_id_missmatch_TX_cnt));
374  status[NAL_STATUS_LAST_TX_NODE_ID] = (ap_uint<32>) (((ap_uint<32>) last_tx_port) << 16) | ((ap_uint<32>) last_tx_node_id);
375  //status[NAL_STATUS_TX_PORT_CORRECTIONS] = (((ap_uint<32>) tcp_new_connection_failure_cnt) << 16) | ((ap_uint<16>) port_corrections_TX_cnt);
376  status[NAL_STATUS_PACKET_CNT_RX] = (ap_uint<32>) packet_count_RX;
377  status[NAL_STATUS_PACKET_CNT_TX] = (ap_uint<32>) packet_count_TX;
378 
379  status[NAL_UNAUTHORIZED_ACCESS] = (ap_uint<32>) unauthorized_access_cnt;
380  status[NAL_AUTHORIZED_ACCESS] = (ap_uint<32>) authorized_access_cnt;
381 
382 
383  //check for differences
384  if(!sStatusUpdate.full())
385  {
386  if(old_status[status_update_i] != status[status_update_i])
387  {
388  ap_uint<32> uv = status[status_update_i];
389  NalStatusUpdate su = NalStatusUpdate(status_update_i, uv);
390  sStatusUpdate.write(su);
391  old_status[status_update_i] = status[status_update_i];
392  //printf("[INFO] Internal Event Processing detected status change on address %d with new value %d\n", \
393  // (int) su.status_addr, (int) su.new_value);
394  }
395  //one at a time is enough
396  }
397  status_update_i++;
398  if(status_update_i >= NUMBER_STATUS_WORDS)
399  {
400  status_update_i = 0;
401  }
402  } // else
403 
404 }
405 
406 
407 
413  stream<NalEventNotif> &internal_event_fifo_0,
414  stream<NalEventNotif> &internal_event_fifo_1,
415  stream<NalEventNotif> &internal_event_fifo_2,
416  stream<NalEventNotif> &internal_event_fifo_3,
417  stream<NalEventNotif> &merged_fifo
418  )
419 {
420  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
421 #pragma HLS INLINE off
422 #pragma HLS pipeline II=1
423  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
424  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
425  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
426 
427  //if else tree for lower latency, the event fifos should have enough buffer...
428 
429  if(!internal_event_fifo_0.empty() && !merged_fifo.full())
430  {
431  NalEventNotif tmp = internal_event_fifo_0.read();
432  printf("[INFO] Internal Event Processing received event %d with update value %d from fifo_0\n", \
433  (int) tmp.type, (int) tmp.update_value);
434  merged_fifo.write(tmp);
435  }
436  else if(!internal_event_fifo_1.empty() && !merged_fifo.full() )
437  {
438  NalEventNotif tmp = internal_event_fifo_1.read();
439  printf("[INFO] Internal Event Processing received event %d with update value %d from fifo_1\n", \
440  (int) tmp.type, (int) tmp.update_value);
441  merged_fifo.write(tmp);
442  }
443  else if(!internal_event_fifo_2.empty() && !merged_fifo.full())
444  {
445  NalEventNotif tmp = internal_event_fifo_2.read();
446  printf("[INFO] Internal Event Processing received event %d with update value %d from fifo_2\n", \
447  (int) tmp.type, (int) tmp.update_value);
448  merged_fifo.write(tmp);
449  }
450  else if(!internal_event_fifo_3.empty() && !merged_fifo.full())
451  {
452  NalEventNotif tmp = internal_event_fifo_3.read();
453  printf("[INFO] Internal Event Processing received event %d with update value %d from fifo_3\n", \
454  (int) tmp.type, (int) tmp.update_value);
455  merged_fifo.write(tmp);
456  }
457 }
458 
459 
460 
464 void nal_main(
465  // ----- link to FMC -----
467  //state of the FPGA
468  ap_uint<1> *layer_4_enabled,
469  ap_uint<1> *layer_7_enabled,
470  ap_uint<1> *role_decoupled,
471  // ready signal from NTS
472  ap_uint<1> *piNTS_ready,
473  // ----- link to MMIO ----
474  ap_uint<16> *piMMIO_FmcLsnPort,
475  ap_uint<32> *piMMIO_CfrmIp4Addr,
476  // -- my IP address
477  ap_uint<32> *myIpAddress,
478 
479  //-- ROLE UDP connection
480  ap_uint<32> *pi_udp_rx_ports,
481  stream<NetworkWord> &siUdp_data,
482  stream<NetworkWord> &soUdp_data,
483  stream<NetworkMetaStream> &siUdp_meta,
484  stream<NetworkMetaStream> &soUdp_meta,
485 
486  // -- ROLE TCP connection
487  ap_uint<32> *pi_tcp_rx_ports,
488  stream<NetworkWord> &siTcp_data,
489  stream<NetworkMetaStream> &siTcp_meta,
490  stream<NetworkWord> &soTcp_data,
491  stream<NetworkMetaStream> &soTcp_meta,
492 
493  // -- FMC TCP connection
494  stream<NetworkWord> &siFMC_data,
495  stream<TcpSessId> &siFMC_SessId,
496  stream<NetworkWord> &soFMC_data,
497  stream<TcpSessId> &soFMC_SessId,
498 
499  //-- UOE / Control Port Interfaces
500  stream<UdpPort> &soUOE_LsnReq,
501  stream<StsBool> &siUOE_LsnRep,
502  stream<UdpPort> &soUOE_ClsReq,
503  stream<StsBool> &siUOE_ClsRep,
504 
505  //-- UOE / Rx Data Interfaces
506  stream<UdpAppData> &siUOE_Data,
507  stream<UdpAppMeta> &siUOE_Meta,
508  stream<UdpAppDLen> &siUOE_DLen,
509 
510  //-- UOE / Tx Data Interfaces
511  stream<UdpAppData> &soUOE_Data,
512  stream<UdpAppMeta> &soUOE_Meta,
513  stream<UdpAppDLen> &soUOE_DLen,
514 
515  //-- TOE / Rx Data Interfaces
516  stream<TcpAppNotif> &siTOE_Notif,
517  stream<TcpAppRdReq> &soTOE_DReq,
518  stream<TcpAppData> &siTOE_Data,
519  stream<TcpAppMeta> &siTOE_SessId,
520  //-- TOE / Listen Interfaces
521  stream<TcpAppLsnReq> &soTOE_LsnReq,
522  stream<TcpAppLsnRep> &siTOE_LsnRep,
523  //-- TOE / Tx Data Interfaces
524  stream<TcpAppData> &soTOE_Data,
525  stream<TcpAppSndReq> &soTOE_SndReq,
526  stream<TcpAppSndRep> &siTOE_SndRep,
527  //-- TOE / Open Interfaces
528  stream<TcpAppOpnReq> &soTOE_OpnReq,
529  stream<TcpAppOpnRep> &siTOE_OpnRep,
530  //-- TOE / Close Interfaces
531  stream<TcpAppClsReq> &soTOE_ClsReq
532  )
533 {
534 
535  // ----- directives for AXI buses (AXI4 stream, AXI4 Lite) -----
536 #pragma HLS INTERFACE s_axilite depth=512 port=ctrlLink bundle=piFMC_NAL_ctrlLink_AXI
537 
538 #pragma HLS INTERFACE axis register both port=siUdp_data
539 #pragma HLS INTERFACE axis register both port=soUdp_data
540 
541 #pragma HLS INTERFACE axis register both port=siUdp_meta
542 #pragma HLS INTERFACE axis register both port=soUdp_meta
543 
544 #pragma HLS INTERFACE axis register both port=soUOE_LsnReq
545 #pragma HLS INTERFACE axis register both port=siUOE_LsnRep
546 #pragma HLS INTERFACE axis register both port=soUOE_ClsReq
547 #pragma HLS INTERFACE axis register both port=siUOE_ClsRep
548 
549 #pragma HLS INTERFACE axis register both port=siUOE_Data
550 #pragma HLS INTERFACE axis register both port=siUOE_Meta
551 #pragma HLS DATA_PACK variable=siUOE_Meta
552 #pragma HLS INTERFACE axis register both port=siUOE_DLen
553 
554 #pragma HLS INTERFACE axis register both port=soUOE_Data
555 #pragma HLS INTERFACE axis register both port=soUOE_Meta
556 #pragma HLS DATA_PACK variable=soUOE_Meta
557 #pragma HLS INTERFACE axis register both port=soUOE_DLen
558 
559 #pragma HLS INTERFACE axis register both port=siTcp_data
560 #pragma HLS INTERFACE axis register both port=soTcp_data
561 #pragma HLS INTERFACE axis register both port=siTcp_meta
562 #pragma HLS INTERFACE axis register both port=soTcp_meta
563 
564 #pragma HLS INTERFACE axis register both port=siTOE_Notif
565 #pragma HLS DATA_PACK variable=siTOE_Notif
566 #pragma HLS INTERFACE axis register both port=soTOE_DReq
567 #pragma HLS DATA_PACK variable=soTOE_DReq
568 #pragma HLS INTERFACE axis register both port=siTOE_Data
569 #pragma HLS INTERFACE axis register both port=siTOE_SessId
570 
571 #pragma HLS INTERFACE axis register both port=soTOE_LsnReq
572 #pragma HLS INTERFACE axis register both port=siTOE_LsnRep
573 
574 #pragma HLS INTERFACE axis register both port=soTOE_Data
575 #pragma HLS INTERFACE axis register both port=soTOE_SndReq
576 #pragma HLS DATA_PACK variable=soTOE_SndReq
577 #pragma HLS INTERFACe axis register both port=siTOE_SndRep
578 #pragma HLS DATA_PACK variable=siTOE_SndRep
579 
580 #pragma HLS INTERFACE axis register both port=soTOE_OpnReq
581 #pragma HLS DATA_PACK variable=soTOE_OpnReq
582 #pragma HLS INTERFACE axis register both port=siTOE_OpnRep
583 #pragma HLS DATA_PACK variable=siTOE_OpnRep
584 
585 #pragma HLS INTERFACE axis register both port=soTOE_ClsReq
586 
587  // ----- common directives -----
588 
589 #pragma HLS INTERFACE ap_ctrl_none port=return
590 
591 #pragma HLS INTERFACE ap_vld register port=layer_4_enabled name=piLayer4enabled
592 #pragma HLS INTERFACE ap_vld register port=layer_7_enabled name=piLayer7enabled
593 #pragma HLS INTERFACE ap_vld register port=role_decoupled name=piRoleDecoup_active
594 #pragma HLS INTERFACE ap_vld register port=piNTS_ready name=piNTS_ready
595 
596 #pragma HLS INTERFACE ap_vld register port=myIpAddress name=piMyIpAddress
597 #pragma HLS INTERFACE ap_vld register port=pi_udp_rx_ports name=piROL_Udp_Rx_ports
598 #pragma HLS INTERFACE ap_vld register port=piMMIO_FmcLsnPort name=piMMIO_FmcLsnPort
599 #pragma HLS INTERFACE ap_vld register port=piMMIO_CfrmIp4Addr name=piMMIO_CfrmIp4Addr
600 
601 #pragma HLS INTERFACE ap_vld register port=pi_tcp_rx_ports name=piROL_Tcp_Rx_ports
602 
603 #pragma HLS INTERFACE ap_fifo port=siFMC_data
604 #pragma HLS INTERFACE ap_fifo port=soFMC_data
605 #pragma HLS INTERFACE ap_fifo port=siFMC_SessId
606 #pragma HLS INTERFACE ap_fifo port=soFMC_SessId
607 
608 
609 #pragma HLS DATAFLOW
610 
611 
612  //===========================================================
613  // core wide STATIC variables
614 
615  static stream<NalEventNotif> internal_event_fifo_0 ("internal_event_fifo_0");
616  static stream<NalEventNotif> internal_event_fifo_1 ("internal_event_fifo_1");
617  static stream<NalEventNotif> internal_event_fifo_2 ("internal_event_fifo_2");
618  static stream<NalEventNotif> internal_event_fifo_3 ("internal_event_fifo_3");
619  static stream<NalEventNotif> merged_fifo ("sEvent_Merged_Fifo");
620  //static stream<NalConfigUpdate> sA4lToTcpAgency ("sA4lToTcpAgency"); //(currently not used)
621  static stream<NalConfigUpdate> sA4lToPortLogic ("sA4lToPortLogic");
622  static stream<NalConfigUpdate> sA4lToUdpRx ("sA4lToUdpRx");
623  static stream<NalConfigUpdate> sA4lToTcpRx ("sA4lToTcpRx");
624  static stream<NalConfigUpdate> sA4lToStatusProc ("sA4lToStatusProc");
625  static stream<NalMrtUpdate> sA4lMrtUpdate ("sA4lMrtUpdate");
626  static stream<NalStatusUpdate> sStatusUpdate ("sStatusUpdate");
627  static stream<NodeId> sGetIpReq_UdpTx ("sGetIpReq_UdpTx");
628  static stream<Ip4Addr> sGetIpRep_UdpTx ("sGetIpRep_UdpTx");
629  static stream<NodeId> sGetIpReq_TcpTx ("sGetIpReq_TcpTx");
630  static stream<Ip4Addr> sGetIpRep_TcpTx ("sGetIpRep_TcpTx");
631  static stream<Ip4Addr> sGetNidReq_UdpRx ("sGetNidReq_UdpRx");
632  static stream<NodeId> sGetNidRep_UdpRx ("sGetNidRep_UdpRx");
633  static stream<Ip4Addr> sGetNidReq_TcpRx ("sGetNidReq_TcpRx");
634  static stream<NodeId> sGetNidRep_TcpRx ("sGetNidRep_TcpRx");
635  static stream<Ip4Addr> sGetNidReq_TcpTx ("sGetNidReq_TcpTx");
636  static stream<NodeId> sGetNidRep_TcpTx ("sGetNidRep_TcpTx");
637 
638  static stream<UdpPort> sUdpPortsToClose ("sUdpPortsToClose");
639  static stream<UdpPort> sUdpPortsToOpen ("sUdpPortsToOpen");
640  static stream<TcpPort> sTcpPortsToOpen ("sTcpPortsToOpen");
641  static stream<bool> sUdpPortsOpenFeedback ("sUdpPortsOpenFeedback");
642  static stream<bool> sTcpPortsOpenFeedback ("sTcpPortsOpenFeedback");
643 
644 
645  static stream<NetworkWord> sRoleTcpDataRx_buffer ("sRoleTcpDataRx_buffer");
646  static stream<NetworkMetaStream> sRoleTcpMetaRx_buffer ("sRoleTcpMetaRx_buffer");
647  static stream<TcpAppData> sTcpWrp2Wbu_data ("sTcpWrp2Wbu_data");
648  static stream<TcpAppMeta> sTcpWrp2Wbu_sessId ("sTcpWrp2Wbu_sessId");
649  static stream<TcpDatLen> sTcpWrp2Wbu_len ("sTcpWrp2Wbu_len");
650 
651  static stream<SessionId> sGetTripleFromSid_Req ("sGetTripleFromSid_Req");
652  static stream<NalTriple> sGetTripleFromSid_Rep ("sGetTripleFromSid_Rep");
653  static stream<NalTriple> sGetSidFromTriple_Req ("sGetSidFromTriple_Req");
654  static stream<SessionId> sGetSidFromTriple_Rep ("sGetSidFromTriple_Rep");
655  static stream<NalNewTableEntry> sAddNewTriple_TcpRrh ("sAddNewTriple_TcpRrh");
656  static stream<NalNewTableEntry> sAddNewTriple_TcpCon ("sAddNewTriple_TcpCon");
657  static stream<SessionId> sDeleteEntryBySid ("sDeleteEntryBySid");
658  static stream<SessionId> sMarkAsPriv ("sMarkAsPriv");
659  static stream<bool> sMarkToDel_unpriv ("sMarkToDel_unpriv");
660  static stream<bool> sGetNextDelRow_Req ("sGetNextDelRow_Req");
661  static stream<SessionId> sGetNextDelRow_Rep ("sGetNextDelRow_Rep");
662  static stream<TcpAppRdReq> sRDp_ReqNotif ("sRDp_ReqNotif");
663 
664  static stream<NalTriple> sNewTcpCon_Req ("sNewTcpCon_Req");
665  static stream<NalNewTcpConRep> sNewTcpCon_Rep ("sNewTcpConRep");
666  static stream<TcpAppNotif> sTcpNotif_buffer ("sTcpNotif_buffer");
667 
668  //static ap_uint<32> localMRT[MAX_MRT_SIZE];
669 
670  static stream<uint32_t> sMrtVersionUpdate_0 ("sMrtVersionUpdate_0");
671  static stream<uint32_t> sMrtVersionUpdate_1 ("sMrtVersionUpdate_1");
672 
673  static stream<bool> sCacheInvalSig_0 ("sCacheInvalSig_0");
674  static stream<bool> sCacheInvalSig_1 ("sCacheInvalSig_1");
675  static stream<bool> sCacheInvalSig_2 ("sCacheInvalSig_2");
676  static stream<bool> sCacheInvalSig_3 ("sCacheInvalSig_3");
677 
678  static stream<PacketLen> sRoleFifoEmptySig ("sRoleFifoEmptySig");
679  static stream<PacketLen> sFmcFifoEmptySig ("sFmcFifoEmptySig");
680 
681  static stream<bool> sStartTclCls_sig ("sStartTclCls_sig");
682  static stream<NalPortUpdate> sNalPortUpdate ("sNalPortUpdate");
683 
684  static stream<NetworkWord> sRoleUdpDataRx_buffer ("sRoleUdpDataRx_buffer");
685  static stream<NetworkMetaStream> sRoleUdpMetaRx_buffer ("sRoleUdpMetaRx_buffer");
686 
687  static stream<UdpAppData> sUoeTxBuffer_Data ("sUoeTxBuffer_Data");
688  static stream<UdpAppMeta> sUoeTxBuffer_Meta ("sUoeTxBuffer_Meta");
689  static stream<UdpAppDLen> sUoeTxBuffer_DLen ("sUoeTxBuffer_DLen");
690 
691  static stream<bool> sCacheInvalDel_Notif ("sCacheInvalDel_Notif");
692 
693  static stream<NetworkWord> sFmcTcpDataRx_buffer ("sFmcTcpDataRx_buffer");
694  static stream<TcpSessId> sFmcTcpMetaRx_buffer ("sFmcTcpMetaRx_buffer");
695 
696 
697 #pragma HLS STREAM variable=internal_event_fifo_0 depth=16
698 #pragma HLS STREAM variable=internal_event_fifo_1 depth=16
699 #pragma HLS STREAM variable=internal_event_fifo_2 depth=16
700 #pragma HLS STREAM variable=internal_event_fifo_3 depth=16
701 #pragma HLS STREAM variable=merged_fifo depth=64
702 
703  //#pragma HLS STREAM variable=sA4lToTcpAgency depth=16 //(currently not used)
704 #pragma HLS STREAM variable=sA4lToPortLogic depth=8
705 #pragma HLS STREAM variable=sA4lToUdpRx depth=8
706 #pragma HLS STREAM variable=sA4lToTcpRx depth=8
707 #pragma HLS STREAM variable=sA4lToStatusProc depth=8
708 #pragma HLS STREAM variable=sA4lMrtUpdate depth=16
709 #pragma HLS STREAM variable=sStatusUpdate depth=128 //should be larger than ctrlLink size
710 
711 #pragma HLS STREAM variable=sGetIpReq_UdpTx depth=16 //MRT process takes longer -> better more buffer
712 #pragma HLS STREAM variable=sGetIpRep_UdpTx depth=16
713 #pragma HLS STREAM variable=sGetIpReq_TcpTx depth=16
714 #pragma HLS STREAM variable=sGetIpRep_TcpTx depth=16
715 #pragma HLS STREAM variable=sGetNidReq_UdpRx depth=16
716 #pragma HLS STREAM variable=sGetNidRep_UdpRx depth=16
717 #pragma HLS STREAM variable=sGetNidReq_TcpRx depth=16
718 #pragma HLS STREAM variable=sGetNidRep_TcpRx depth=16
719 #pragma HLS STREAM variable=sGetNidReq_TcpTx depth=16
720 #pragma HLS STREAM variable=sGetNidRep_TcpTx depth=16
721 
722 #pragma HLS STREAM variable=sUdpPortsToClose depth=4
723 #pragma HLS STREAM variable=sUdpPortsToOpen depth=4
724 #pragma HLS STREAM variable=sUdpPortsOpenFeedback depth=4
725 #pragma HLS STREAM variable=sTcpPortsToOpen depth=4
726 #pragma HLS STREAM variable=sTcpPortsOpenFeedback depth=4
727 
728 
729 #pragma HLS STREAM variable=sRoleTcpDataRx_buffer depth=252 //NAL_MAX_FIFO_DEPTS_BYTES/8 (+2)
730 #pragma HLS STREAM variable=sRoleTcpMetaRx_buffer depth=32
731 
732 #pragma HLS STREAM variable=sTcpWrp2Wbu_data depth=252 //NAL_MAX_FIFO_DEPTS_BYTES/8 (+2)
733 #pragma HLS STREAM variable=sTcpWrp2Wbu_sessId depth=32
734 #pragma HLS STREAM variable=sTcpWrp2Wbu_len depth=32
735 
736 
737 #pragma HLS STREAM variable=sGetTripleFromSid_Req depth=8
738 #pragma HLS STREAM variable=sGetTripleFromSid_Rep depth=8
739 #pragma HLS STREAM variable=sGetSidFromTriple_Req depth=8
740 #pragma HLS STREAM variable=sGetSidFromTriple_Rep depth=8
741 #pragma HLS STREAM variable=sAddNewTriple_TcpRrh depth=8
742 #pragma HLS STREAM variable=sAddNewTriple_TcpCon depth=8
743 #pragma HLS STREAM variable=sDeleteEntryBySid depth=8
744 #pragma HLS STREAM variable=sMarkAsPriv depth=8
745 #pragma HLS STREAM variable=sMarkToDel_unpriv depth=8
746 #pragma HLS STREAM variable=sGetNextDelRow_Req depth=8
747 #pragma HLS STREAM variable=sGetNextDelRow_Rep depth=8
748 #pragma HLS STREAM variable=sRDp_ReqNotif depth=8
749 
750 #pragma HLS STREAM variable=sNewTcpCon_Req depth=4
751 #pragma HLS STREAM variable=sNewTcpCon_Rep depth=4
752 
753  //#pragma HLS STREAM variable=sTcpNotif_buffer depth=1024
754 #pragma HLS STREAM variable=sTcpNotif_buffer depth=8192
755 
756  //#pragma HLS RESOURCE variable=localMRT core=RAM_2P_BRAM
757  //#pragma HLS ARRAY_PARTITION variable=localMRT cyclic factor=8 dim=1
758  //#pragma HLS ARRAY_PARTITION variable=localMRT complete dim=1
759 
760 #pragma HLS STREAM variable=sMrtVersionUpdate_0 depth=4
761 #pragma HLS STREAM variable=sMrtVersionUpdate_1 depth=4
762 
763 #pragma HLS STREAM variable=sCacheInvalSig_0 depth=4
764 #pragma HLS STREAM variable=sCacheInvalSig_1 depth=4
765 #pragma HLS STREAM variable=sCacheInvalSig_2 depth=4
766 #pragma HLS STREAM variable=sCacheInvalSig_3 depth=4
767 
768 #pragma HLS STREAM variable=sRoleFifoEmptySig depth=8
769 #pragma HLS STREAM variable=sFmcFifoEmptySig depth=8
770 
771 #pragma HLS STREAM variable=sStartTclCls_sig depth=4
772 #pragma HLS STREAM variable=sNalPortUpdate depth=8
773 
774  //#pragma HLS STREAM variable=sRoleUdpDataRx_buffer depth=252 //NAL_MAX_FIFO_DEPTS_BYTES/8 (+2)
775  //#pragma HLS STREAM variable=sRoleUdpMetaRx_buffer depth=32
776 #pragma HLS STREAM variable=sRoleUdpDataRx_buffer depth=512 // ~2 * NAL_MAX_FIFO_DEPTS_BYTES/8 (+2)
777 #pragma HLS STREAM variable=sRoleUdpMetaRx_buffer depth=64
778 
779 #pragma HLS STREAM variable=sUoeTxBuffer_Data depth=252 //NAL_MAX_FIFO_DEPTS_BYTES/8 (+2)
780 #pragma HLS STREAM variable=sUoeTxBuffer_Meta depth=32
781 #pragma HLS STREAM variable=sUoeTxBuffer_DLen depth=32
782 
783 #pragma HLS STREAM variable=sCacheInvalDel_Notif depth=4
784 
785 #pragma HLS STREAM variable=sFmcTcpDataRx_buffer depth=252 //NAL_MAX_FIFO_DEPTS_BYTES/8 (+2)
786 #pragma HLS STREAM variable=sFmcTcpMetaRx_buffer depth=32
787 
788 
789  //===========================================================
790  // check for chache invalidation and changes to ports
791  // restore saved states after a reset
792 
793  pCacheInvalDetection(layer_4_enabled, layer_7_enabled, role_decoupled, piNTS_ready, sMrtVersionUpdate_0,
794  sCacheInvalDel_Notif, sCacheInvalSig_0, sCacheInvalSig_1, sCacheInvalSig_2, sCacheInvalSig_3);
795 
796  pPortLogic(layer_4_enabled, layer_7_enabled, role_decoupled, piNTS_ready, piMMIO_FmcLsnPort,
797  pi_udp_rx_ports, pi_tcp_rx_ports, sA4lToPortLogic, sUdpPortsToOpen, sUdpPortsToClose,
798  sTcpPortsToOpen, sUdpPortsOpenFeedback, sTcpPortsOpenFeedback, sMarkToDel_unpriv,
799  sNalPortUpdate, sStartTclCls_sig);
800 
801  //=================================================================================================
802  // TX UDP
803 
804  pUdpTX(siUdp_data, siUdp_meta, sUoeTxBuffer_Data, sUoeTxBuffer_Meta, sUoeTxBuffer_DLen,
805  sGetIpReq_UdpTx, sGetIpRep_UdpTx,
806  myIpAddress, sCacheInvalSig_0, internal_event_fifo_0);
807 
808  pUoeUdpTxDeq(layer_4_enabled, piNTS_ready, sUoeTxBuffer_Data, sUoeTxBuffer_Meta, sUoeTxBuffer_DLen,
809  soUOE_Data, soUOE_Meta, soUOE_DLen);
810 
811  //=================================================================================================
812  // RX UDP
813 
814  pUdpLsn(soUOE_LsnReq, siUOE_LsnRep, sUdpPortsToOpen, sUdpPortsOpenFeedback);
815 
816  pUdpRx(layer_7_enabled, role_decoupled, sRoleUdpDataRx_buffer, sRoleUdpMetaRx_buffer,
817  siUOE_Data, siUOE_Meta, siUOE_DLen,
818  sA4lToUdpRx, sGetNidReq_UdpRx, sGetNidRep_UdpRx,
819  sCacheInvalSig_1, internal_event_fifo_1);
820 
821  pRoleUdpRxDeq(layer_7_enabled, role_decoupled, sRoleUdpDataRx_buffer, sRoleUdpMetaRx_buffer,
822  soUdp_data, soUdp_meta);
823 
824  //=================================================================================================
825  // UDP Port Close
826 
827  pUdpCls(soUOE_ClsReq, siUOE_ClsRep, sUdpPortsToClose);
828 
829  //=================================================================================================
830  // TCP pListen
831  pTcpLsn(soTOE_LsnReq, siTOE_LsnRep, sTcpPortsToOpen, sTcpPortsOpenFeedback);
832 
833  //=================================================================================================
834  // TCP Read Request Handler
835 
836  pTcpRxNotifEnq(layer_4_enabled, piNTS_ready, siTOE_Notif, sTcpNotif_buffer);
837 
838  pTcpRRh(layer_4_enabled, piNTS_ready, piMMIO_CfrmIp4Addr, piMMIO_FmcLsnPort, sTcpNotif_buffer,
839  soTOE_DReq, sAddNewTriple_TcpRrh, sMarkAsPriv, sDeleteEntryBySid, sRDp_ReqNotif,
840  sFmcFifoEmptySig, sRoleFifoEmptySig);
841 
842  //=================================================================================================
843  // TCP Read Path
844  pTcpRDp(layer_4_enabled, piNTS_ready, sRDp_ReqNotif, siTOE_Data, siTOE_SessId,
845  sFmcTcpDataRx_buffer, sFmcTcpMetaRx_buffer,
846  sRoleTcpDataRx_buffer, sRoleTcpMetaRx_buffer,
847  sA4lToTcpRx, sGetNidReq_TcpRx, sGetNidRep_TcpRx, sGetTripleFromSid_Req, sGetTripleFromSid_Rep,
848  //sMarkAsPriv,
849  piMMIO_CfrmIp4Addr, piMMIO_FmcLsnPort, layer_7_enabled, role_decoupled,
850  sCacheInvalSig_2, internal_event_fifo_2);
851 
852  pFmcTcpRxDeq(sFmcTcpDataRx_buffer, sFmcTcpMetaRx_buffer, soFMC_data, soFMC_SessId, sFmcFifoEmptySig);
853 
854  pRoleTcpRxDeq(layer_7_enabled, role_decoupled, sRoleTcpDataRx_buffer, sRoleTcpMetaRx_buffer, soTcp_data, soTcp_meta, sRoleFifoEmptySig);
855 
856  //=================================================================================================
857  // TCP Write Path
858  pTcpWRp(layer_4_enabled, piNTS_ready, siFMC_data, siFMC_SessId, siTcp_data, siTcp_meta,
859  sTcpWrp2Wbu_data, sTcpWrp2Wbu_sessId, sTcpWrp2Wbu_len,
860  sGetIpReq_TcpTx, sGetIpRep_TcpTx,
861  //sGetNidReq_TcpTx, sGetNidRep_TcpTx,
862  sGetSidFromTriple_Req, sGetSidFromTriple_Rep, sNewTcpCon_Req, sNewTcpCon_Rep,
863  sCacheInvalSig_3, internal_event_fifo_3);
864 
865  pTcpWBu(layer_4_enabled, piNTS_ready, sTcpWrp2Wbu_data, sTcpWrp2Wbu_sessId, sTcpWrp2Wbu_len,
866  soTOE_Data, soTOE_SndReq, siTOE_SndRep);
867 
868  //=================================================================================================
869  // TCP start remote connection
870  pTcpCOn(soTOE_OpnReq, siTOE_OpnRep, sAddNewTriple_TcpCon, sNewTcpCon_Req, sNewTcpCon_Rep);
871 
872  //=================================================================================================
873  // TCP connection close
874  pTcpCls(soTOE_ClsReq, sGetNextDelRow_Req, sGetNextDelRow_Rep, sStartTclCls_sig);
875 
876  //=================================================================================================
877  // TCP Table Management
878 
879  pTcpAgency(sGetTripleFromSid_Req, sGetTripleFromSid_Rep, sGetSidFromTriple_Req, sGetSidFromTriple_Rep,
880  sAddNewTriple_TcpRrh, sAddNewTriple_TcpCon, sDeleteEntryBySid, sCacheInvalDel_Notif,
881  sMarkAsPriv, sMarkToDel_unpriv, sGetNextDelRow_Req, sGetNextDelRow_Rep);
882 
883  //===========================================================
884  // update status, config, MRT
885 
886  eventFifoMerge( internal_event_fifo_0, internal_event_fifo_1, internal_event_fifo_2, internal_event_fifo_3, merged_fifo);
887 
888  pStatusMemory(merged_fifo, layer_7_enabled, role_decoupled, sA4lToStatusProc, sMrtVersionUpdate_1, sNalPortUpdate, sStatusUpdate);
889 
890 
892  //sA4lToTcpAgency, //(currently not used)
893  sA4lToPortLogic, sA4lToUdpRx,
894  sA4lToTcpRx, sA4lToStatusProc,
895  sA4lMrtUpdate,
896  //localMRT,
897  sMrtVersionUpdate_0, sMrtVersionUpdate_1,
898  sStatusUpdate);
899 
900 
901  pMrtAgency(sA4lMrtUpdate, sGetIpReq_UdpTx, sGetIpRep_UdpTx, sGetIpReq_TcpTx, sGetIpRep_TcpTx, sGetNidReq_UdpRx, sGetNidRep_UdpRx, sGetNidReq_TcpRx, sGetNidRep_TcpRx);
902 
903 
904 }
905 
906 
LE_tKeep getLE_TKeep(int leHi=64/8-1, int leLo=0) const
Definition: AxisRaw.hpp:264
ap_uint< 1 > layer_7_enabled
Definition: tb_fmc.cpp:68
ap_uint< 1 > layer_4_enabled
Definition: tb_fmc.cpp:66
bool tables_initialized
Definition: fmc.cpp:156
void pUdpCls(stream< UdpPort > &soUOE_ClsReq, stream< StsBool > &siUOE_ClsRep, stream< UdpPort > &sUdpPortsToClose)
Asks the UOE to close UDP ports, based on the request from pPortLogic.
Definition: uss.cpp:747
NalTriple newTriple(Ip4Addr ipRemoteAddres, TcpPort tcpRemotePort, TcpPort tcpLocalPort)
Definition: nal.cpp:62
#define NUMBER_CONFIG_WORDS
Definition: nal.hpp:191
#define NAL_STATUS_FMC_PORT_PROCESSED
Definition: nal.hpp:224
void axi4liteProcessing(ap_uint< 32 > ctrlLink[64+16+16], stream< NalConfigUpdate > &sToPortLogic, stream< NalConfigUpdate > &sToUdpRx, stream< NalConfigUpdate > &sToTcpRx, stream< NalConfigUpdate > &sToStatusProc, stream< NalMrtUpdate > &sMrtUpdate, stream< uint32_t > &mrt_version_update_0, stream< uint32_t > &mrt_version_update_1, stream< NalStatusUpdate > &sStatusUpdate)
Contains the Axi4 Lite secondary endpoint and reads the MRT and configuration values from it as well ...
Definition: hss.cpp:79
void pFmcTcpRxDeq(stream< NetworkWord > &sFmcTcpDataRx_buffer, stream< TcpSessId > &sFmcTcpMetaRx_buffer, stream< NetworkWord > &soFmc_data, stream< TcpSessId > &soFmc_meta, stream< PacketLen > &fmc_write_cnt_sig)
Terminates the internal TCP RX FIFOs and forwards packets to the FMC.
Definition: tss.cpp:1012
void pUdpTX(stream< NetworkWord > &siUdp_data, stream< NetworkMetaStream > &siUdp_meta, stream< UdpAppData > &soUOE_Data, stream< UdpAppMeta > &soUOE_Meta, stream< UdpAppDLen > &soUOE_DLen, stream< NodeId > &sGetIpReq_UdpTx, stream< Ip4Addr > &sGetIpRep_UdpTx, const ap_uint< 32 > *ipAddrBE, stream< bool > &cache_inval_sig, stream< NalEventNotif > &internal_event_fifo)
Processes the outgoing UDP packets (i.e. ROLE -> Network).
Definition: uss.cpp:51
#define NAL_UNAUTHORIZED_ACCESS
Definition: nal.hpp:229
#define NAL_STATUS_LAST_TX_NODE_ID
Definition: nal.hpp:238
void pTcpLsn(stream< TcpAppLsnReq > &soTOE_LsnReq, stream< TcpAppLsnRep > &siTOE_LsnRep, stream< TcpPort > &sTcpPortsToOpen, stream< bool > &sTcpPortsOpenFeedback)
Request the TOE to start listening (LSn) for incoming connections on a specific port (....
Definition: tss.cpp:53
#define NUMBER_STATUS_WORDS
Definition: nal.hpp:192
void pTcpWRp(ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *piNTS_ready, stream< NetworkWord > &siFMC_data, stream< TcpSessId > &siFMC_SessId, stream< NetworkWord > &siTcp_data, stream< NetworkMetaStream > &siTcp_meta, stream< TcpAppData > &soTOE_Data, stream< TcpAppMeta > &soTOE_SessId, stream< TcpDatLen > &soTOE_len, stream< NodeId > &sGetIpReq_TcpTx, stream< Ip4Addr > &sGetIpRep_TcpTx, stream< NalTriple > &sGetSidFromTriple_Req, stream< SessionId > &sGetSidFromTriple_Rep, stream< NalTriple > &sNewTcpCon_Req, stream< NalNewTcpConRep > &sNewTcpCon_Rep, stream< bool > &cache_inval_sig, stream< NalEventNotif > &internal_event_fifo)
Write Path (WRp) - From ROLE or FMC to TOE. Process waits for a new data segment to write and forward...
Definition: tss.cpp:1104
void pRoleUdpRxDeq(ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *role_decoupled, stream< NetworkWord > &sRoleUdpDataRx_buffer, stream< NetworkMetaStream > &sRoleUdpMetaRx_buffer, stream< NetworkWord > &soUdp_data, stream< NetworkMetaStream > &soUdp_meta)
Terminates the internal UDP RX FIFOs and forwards packets to the Role.
Definition: uss.cpp:673
stream< NetworkMetaStream > soUdp_meta("soUdp_meta")
void pTcpCOn(stream< TcpAppOpnReq > &soTOE_OpnReq, stream< TcpAppOpnRep > &siTOE_OpnRep, stream< NalNewTableEntry > &sAddNewTriple_TcpCon, stream< NalTriple > &sNewTcpCon_Req, stream< NalNewTcpConRep > &sNewTcpCon_Rep)
Client connection to remote HOST or FPGA socket (COn).
Definition: tss.cpp:1751
void pCacheInvalDetection(ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *role_decoupled, ap_uint< 1 > *piNTS_ready, stream< uint32_t > &mrt_version_update, stream< bool > &inval_del_sig, stream< bool > &cache_inval_0, stream< bool > &cache_inval_1, stream< bool > &cache_inval_2, stream< bool > &cache_inval_3)
Detects if the caches of the USS and TSS have to be invalidated and signals this to the concerned pro...
Definition: hss.cpp:889
void pTcpRxNotifEnq(ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *piNTS_ready, stream< TcpAppNotif > &siTOE_Notif, stream< TcpAppNotif > &sTcpNotif_buffer)
Enqueus the incoming notificiations from TOE into the internal buffer.
Definition: tss.cpp:152
#define NAL_STATUS_RX_NODEID_ERROR
Definition: nal.hpp:237
void pTcpAgency(stream< SessionId > &sGetTripleFromSid_Req, stream< NalTriple > &sGetTripleFromSid_Rep, stream< NalTriple > &sGetSidFromTriple_Req, stream< SessionId > &sGetSidFromTriple_Rep, stream< NalNewTableEntry > &sAddNewTriple_TcpRrh, stream< NalNewTableEntry > &sAddNewTriple_TcpCon, stream< SessionId > &sDeleteEntryBySid, stream< bool > &inval_del_sig, stream< SessionId > &sMarkAsPriv, stream< bool > &sMarkToDel_unpriv, stream< bool > &sGetNextDelRow_Req, stream< SessionId > &sGetNextDelRow_Rep)
Contains the SessionId-Triple CAM for TCP sessions. It replies to stram requests.
Definition: hss.cpp:1017
#define NAL_STATUS_PACKET_CNT_TX
Definition: nal.hpp:242
void pUdpLsn(stream< UdpPort > &soUOE_LsnReq, stream< StsBool > &siUOE_LsnRep, stream< UdpPort > &sUdpPortsToOpen, stream< bool > &sUdpPortsOpenFeedback)
Asks the UOE to open new UDP ports for listening, based on the request from pPortLogic.
Definition: uss.cpp:358
#define NAL_STATUS_MRT_VERSION
Definition: nal.hpp:221
#define MAX_MRT_SIZE
Definition: nal.hpp:94
uint8_t extractByteCnt(AxisRaw currWord)
Definition: nal.cpp:94
ap_uint< 64 > NalTriple
Definition: nal.hpp:273
#define NAL_STATUS_LAST_RX_NODE_ID
Definition: nal.hpp:236
TcpPort getLocalPortFromTriple(NalTriple triple)
Definition: nal.cpp:86
void eventFifoMerge(stream< NalEventNotif > &internal_event_fifo_0, stream< NalEventNotif > &internal_event_fifo_1, stream< NalEventNotif > &internal_event_fifo_2, stream< NalEventNotif > &internal_event_fifo_3, stream< NalEventNotif > &merged_fifo)
Merges multiple fifos, where the order of the fifo represents also the priorities.
Definition: nal.cpp:412
void nal_main(ap_uint< 32 > ctrlLink[64+16+16], ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *role_decoupled, ap_uint< 1 > *piNTS_ready, ap_uint< 16 > *piMMIO_FmcLsnPort, ap_uint< 32 > *piMMIO_CfrmIp4Addr, ap_uint< 32 > *myIpAddress, ap_uint< 32 > *pi_udp_rx_ports, stream< NetworkWord > &siUdp_data, stream< NetworkWord > &soUdp_data, stream< NetworkMetaStream > &siUdp_meta, stream< NetworkMetaStream > &soUdp_meta, ap_uint< 32 > *pi_tcp_rx_ports, stream< NetworkWord > &siTcp_data, stream< NetworkMetaStream > &siTcp_meta, stream< NetworkWord > &soTcp_data, stream< NetworkMetaStream > &soTcp_meta, stream< NetworkWord > &siFMC_data, stream< TcpSessId > &siFMC_SessId, stream< NetworkWord > &soFMC_data, stream< TcpSessId > &soFMC_SessId, stream< UdpPort > &soUOE_LsnReq, stream< StsBool > &siUOE_LsnRep, stream< UdpPort > &soUOE_ClsReq, stream< StsBool > &siUOE_ClsRep, stream< UdpAppData > &siUOE_Data, stream< UdpAppMeta > &siUOE_Meta, stream< UdpAppDLen > &siUOE_DLen, stream< UdpAppData > &soUOE_Data, stream< UdpAppMeta > &soUOE_Meta, stream< UdpAppDLen > &soUOE_DLen, stream< TcpAppNotif > &siTOE_Notif, stream< TcpAppRdReq > &soTOE_DReq, stream< TcpAppData > &siTOE_Data, stream< TcpAppMeta > &siTOE_SessId, stream< TcpAppLsnReq > &soTOE_LsnReq, stream< TcpAppLsnRep > &siTOE_LsnRep, stream< TcpAppData > &soTOE_Data, stream< TcpAppSndReq > &soTOE_SndReq, stream< TcpAppSndRep > &siTOE_SndRep, stream< TcpAppOpnReq > &soTOE_OpnReq, stream< TcpAppOpnRep > &siTOE_OpnRep, stream< TcpAppClsReq > &soTOE_ClsReq)
Main process of the Network Abstraction Layer (NAL)
Definition: nal.cpp:464
void pTcpWBu(ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *piNTS_ready, stream< TcpAppData > &siWrp_Data, stream< TcpAppMeta > &siWrp_SessId, stream< TcpDatLen > &siWrp_len, stream< TcpAppData > &soTOE_Data, stream< TcpAppSndReq > &soTOE_SndReq, stream< TcpAppSndRep > &siTOE_SndRep)
Write Buffer (WBu) - From WRp to TOE. Process to synchronize with TOE's TX buffer (and it's available...
Definition: tss.cpp:1552
void pRoleTcpRxDeq(ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *role_decoupled, stream< NetworkWord > &sRoleTcpDataRx_buffer, stream< NetworkMetaStream > &sRoleTcpMetaRx_buffer, stream< NetworkWord > &soTcp_data, stream< NetworkMetaStream > &soTcp_meta, stream< PacketLen > &role_write_cnt_sig)
Terminates the internal TCP RX FIFOs and forwards packets to the Role.
Definition: tss.cpp:929
Ip4Addr getRemoteIpAddrFromTriple(NalTriple triple)
Definition: nal.cpp:70
ap_uint< 32 > getRightmostBitPos(ap_uint< 32 > num)
Definition: nal.cpp:43
void pTcpRRh(ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *piNTS_ready, ap_uint< 32 > *piMMIO_CfrmIp4Addr, ap_uint< 16 > *piMMIO_FmcLsnPort, stream< TcpAppNotif > &siTOE_Notif, stream< TcpAppRdReq > &soTOE_DReq, stream< NalNewTableEntry > &sAddNewTriple_TcpRrh, stream< SessionId > &sMarkAsPriv, stream< SessionId > &sDeleteEntryBySid, stream< TcpAppRdReq > &sRDp_ReqNotif, stream< PacketLen > &fmc_write_cnt_sig, stream< PacketLen > &role_write_cnt_sig)
ReadRequestHandler (RRh). Waits for a notification indicating the availability of new data for the RO...
Definition: tss.cpp:219
void pTcpCls(stream< TcpAppClsReq > &soTOE_ClsReq, stream< bool > &sGetNextDelRow_Req, stream< SessionId > &sGetNextDelRow_Rep, stream< bool > &sStartTclCls)
Asks the TOE to close Tcp connections, based on the request from pPortLogic.
Definition: tss.cpp:1892
TcpPort getRemotePortFromTriple(NalTriple triple)
Definition: nal.cpp:78
ap_uint< 1 > role_decoupled
Definition: tb_nal.cpp:134
#define NAL_STATUS_PACKET_CNT_RX
Definition: nal.hpp:241
stream< NetworkMetaStream > siUdp_meta("siUdp_meta")
#define NAL_STATUS_OWN_RANK
Definition: nal.hpp:225
#define NAL_STATUS_GLOBAL_STATE
Definition: nal.hpp:235
ap_uint< 32 > myIpAddress
Definition: tb_nal.cpp:140
#define NAL_CONFIG_OWN_RANK
Definition: nal.hpp:215
ap_uint< 32 > ctrlLink[64+16+16]
Definition: tb_nal.cpp:137
void pMrtAgency(stream< NalMrtUpdate > &sMrtUpdate, stream< NodeId > &sGetIpReq_UdpTx, stream< Ip4Addr > &sGetIpRep_UdpTx, stream< NodeId > &sGetIpReq_TcpTx, stream< Ip4Addr > &sGetIpRep_TcpTx, stream< Ip4Addr > &sGetNidReq_UdpRx, stream< NodeId > &sGetNidRep_UdpRx, stream< Ip4Addr > &sGetNidReq_TcpRx, stream< NodeId > &sGetNidRep_TcpRx)
Can access the BRAM that contains the MRT and replies to lookup requests.
Definition: hss.cpp:386
#define NAL_STATUS_OPEN_TCP_PORTS
Definition: nal.hpp:223
void pUdpRx(ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *role_decoupled, stream< NetworkWord > &soUdp_data, stream< NetworkMetaStream > &soUdp_meta, stream< UdpAppData > &siUOE_Data, stream< UdpAppMeta > &siUOE_Meta, stream< UdpAppDLen > &siUOE_DLen, stream< NalConfigUpdate > &sConfigUpdate, stream< Ip4Addr > &sGetNidReq_UdpRx, stream< NodeId > &sGetNidRep_UdpRx, stream< bool > &cache_inval_sig, stream< NalEventNotif > &internal_event_fifo)
Processes the incoming UDP packets (i.e. Network -> ROLE ).
Definition: uss.cpp:467
void pStatusMemory(stream< NalEventNotif > &internal_event_fifo, ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *role_decoupled, stream< NalConfigUpdate > &sConfigUpdate, stream< uint32_t > &mrt_version_update, stream< NalPortUpdate > &sNalPortUpdate, stream< NalStatusUpdate > &sStatusUpdate)
Maps the individual event notification of the USS/TSS processes to the status array as part of the Ax...
Definition: nal.cpp:180
#define NAL_STATUS_TX_NODEID_ERROR
Definition: nal.hpp:239
#define NAL_AUTHORIZED_ACCESS
Definition: nal.hpp:231
#define NAL_STATUS_OPEN_UDP_PORTS
Definition: nal.hpp:222
void pTcpRDp(ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *piNTS_ready, stream< TcpAppRdReq > &sRDp_ReqNotif, stream< TcpAppData > &siTOE_Data, stream< TcpAppMeta > &siTOE_SessId, stream< NetworkWord > &soFMC_data, stream< TcpSessId > &soFMC_SessId, stream< NetworkWord > &soTcp_data, stream< NetworkMetaStream > &soTcp_meta, stream< NalConfigUpdate > &sConfigUpdate, stream< Ip4Addr > &sGetNidReq_TcpRx, stream< NodeId > &sGetNidRep_TcpRx, stream< SessionId > &sGetTripleFromSid_Req, stream< NalTriple > &sGetTripleFromSid_Rep, ap_uint< 32 > *piMMIO_CfrmIp4Addr, ap_uint< 16 > *piMMIO_FmcLsnPort, ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *role_decoupled, stream< bool > &cache_inval_sig, stream< NalEventNotif > &internal_event_fifo)
Read Path (RDp) - From TOE to ROLE or FMC. Process waits for a new data segment to read and forwards ...
Definition: tss.cpp:581
void pPortLogic(ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *role_decoupled, ap_uint< 1 > *piNTS_ready, ap_uint< 16 > *piMMIO_FmcLsnPort, ap_uint< 32 > *pi_udp_rx_ports, ap_uint< 32 > *pi_tcp_rx_ports, stream< NalConfigUpdate > &sConfigUpdate, stream< UdpPort > &sUdpPortsToOpen, stream< UdpPort > &sUdpPortsToClose, stream< TcpPort > &sTcpPortsToOpen, stream< bool > &sUdpPortsOpenFeedback, stream< bool > &sTcpPortsOpenFeedback, stream< bool > &sMarkToDel_unpriv, stream< NalPortUpdate > &sPortUpdate, stream< bool > &sStartTclCls)
Translates the one-hot encoded open-port vectors from the Role (i.e. piUdpRxPorts and piTcpRxPorts) t...
Definition: hss.cpp:545
void pUoeUdpTxDeq(ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *piNTS_ready, stream< UdpAppData > &sUoeTxBuffer_Data, stream< UdpAppMeta > &sUoeTxBuffer_Meta, stream< UdpAppDLen > &sUoeTxBuffer_DLen, stream< UdpAppData > &soUOE_Data, stream< UdpAppMeta > &soUOE_Meta, stream< UdpAppDLen > &soUOE_DLen)
Terminates the internal UDP TX FIFOs and forwards packets to the UOE.
Definition: uss.cpp:277
@ TCP
Definition: nal.hpp:179
@ UDP
Definition: nal.hpp:179
@ FMC
Definition: nal.hpp:179
@ LAST_TX_PORT
Definition: nal.hpp:182
@ NID_MISS_RX
Definition: nal.hpp:181
@ PCOR_TX
Definition: nal.hpp:181
@ PACKET_TX
Definition: nal.hpp:182
@ AUTH_ACCESS
Definition: nal.hpp:183
@ FMC_TCP_BYTES
Definition: nal.hpp:183
@ LAST_TX_NID
Definition: nal.hpp:182
@ PACKET_RX
Definition: nal.hpp:182
@ TCP_CON_FAIL
Definition: nal.hpp:181
@ NID_MISS_TX
Definition: nal.hpp:181
@ UNAUTH_ACCESS
Definition: nal.hpp:182
@ LAST_RX_PORT
Definition: nal.hpp:181
@ LAST_RX_NID
Definition: nal.hpp:182
ap_uint< 32 > Ip4Addr
Definition: AxisIp4.hpp:169
ap_uint< 16 > TcpPort
Definition: AxisTcp.hpp:105
: The cloudFPGA Network Abstraction Layer (NAL) between NTS and ROlE. The NAL core manages the NTS St...
ap_uint< 8 > NodeId
Definition: network.hpp:82
ap_uint< 16 > NrcPort
Definition: network.hpp:81
ap_uint< 16 > config_addr
Definition: nal.hpp:291
ap_uint< 32 > update_value
Definition: nal.hpp:292
ap_uint< 32 > update_value
Definition: nal.hpp:266
NalCntIncType type
Definition: nal.hpp:265
ap_uint< 32 > new_value
Definition: nal.hpp:313
PortType port_type
Definition: nal.hpp:312
ap_uint< 8 > tkeep
Definition: network.hpp:50