68 #define THIS_NAME "UOE"
70 #define TRACE_OFF 0x0000
71 #define TRACE_IHA 1 << 1
72 #define TRACE_IHS 1 << 2
73 #define TRACE_RPH 1 << 3
74 #define TRACE_TAI 1 << 4
75 #define TRACE_TDH 1 << 5
76 #define TRACE_UCA 1 << 6
77 #define TRACE_UCC 1 << 7
78 #define TRACE_UHA 1 << 8
79 #define TRACE_UPT 1 << 9
80 #define TRACE_ALL 0xFFFF
82 #define DEBUG_LEVEL (TRACE_OFF)
111 stream<AxisIp4> &siIPRX_Data,
112 stream<AxisUdp> &soUcc_UdpDgrm,
113 stream<UdpCsum> &soUcc_PsdHdrSum,
114 stream<AxisIp4> &soRph_Ip4Hdr,
115 stream<SigBit> &siUcc_ClearToSend,
116 stream<ap_uint<16> > &soMMIO_DropCnt)
119 #pragma HLS INLINE off
120 #pragma HLS pipeline II=1 enable_flush
125 static enum FsmStates {FSM_IHS_IDLE=0,
126 FSM_IHS_IPW0, FSM_IHS_IPW1,
127 FSM_IHS_IPW2, FSM_IHS_OPT,
128 FSM_IHS_UDP_HEADER, FSM_IHS_UDP_HEADER_ALIGNED,
129 FSM_IHS_FORWARD, FSM_IHS_FORWARD_ALIGNED,
130 FSM_IHS_RESIDUE, FSM_IHS_DONE,
131 FSM_IHS_DROP } ihs_fsmState=FSM_IHS_IDLE;
132 #pragma HLS RESET variable=ihs_fsmState
133 static ap_uint<16> ihs_dropCounter=0;
134 #pragma HLS reset variable=ihs_dropCounter
137 static ap_uint<4> ihs_bitCount;
138 static ap_uint<3> ihs_ipHdrCnt;
141 static ap_uint<17> ihs_psdHdrSum;
147 switch(ihs_fsmState) {
149 if ((piMMIO_En ==
CMD_DISABLE) and !siIPRX_Data.empty()) {
150 printWarn(myName,
"FSM_IHS_IDLE - UOE is disabled. This packet will be dropped.\n");
151 ihs_fsmState = FSM_IHS_DROP;
153 else if (siUcc_ClearToSend.empty() and !siIPRX_Data.empty()) {
154 printWarn(myName,
"FSM_IHS_IDLE - UOE buffers are full. This packet will be dropped.\n");
155 ihs_fsmState = FSM_IHS_DROP;
157 else if (!siUcc_ClearToSend.empty()) {
160 ihs_fsmState = FSM_IHS_IPW0;
164 if (!siIPRX_Data.empty() and (soUcc_PsdHdrSum.full() or soRph_Ip4Hdr.full())) {
165 printWarn(myName,
"FSM_IHS_IPW0 - Header-buffer space is exhausted. This packet will be dropped.\n");
166 ihs_fsmState = FSM_IHS_DROP;
168 else if (!siIPRX_Data.empty() and !soUcc_PsdHdrSum.full() and !soRph_Ip4Hdr.full()) {
170 siIPRX_Data.read(currIp4Chunk);
172 if (ihs_ip4HdrLen < 5) {
173 printWarn(myName,
"FSM_IHS_IPW0 - Received an IPv4 packet with invalid IHL. This packet will be dropped.\n");
174 ihs_fsmState = FSM_IHS_DROP;
177 soRph_Ip4Hdr.write(currIp4Chunk);
179 printInfo(myName,
"Received a new IPv4 packet (IHL=%d|TotLen=%d)\n",
180 ihs_ip4HdrLen.to_uint(), currIp4Chunk.
getIp4TotalLen().to_ushort());
184 ihs_fsmState = FSM_IHS_IPW1;
189 if (soRph_Ip4Hdr.full()) {
190 printWarn(myName,
"FSM_IHS_IPW1 - Header-buffer space is exhausted. The remaining of this packet will be dropped.\n");
191 ihs_fsmState = FSM_IHS_DROP;
193 else if (!siIPRX_Data.empty()) {
195 siIPRX_Data.read(currIp4Chunk);
196 soRph_Ip4Hdr.write(currIp4Chunk);
198 ihs_psdHdrSum = (0x00, currIp4Chunk.
getIp4Prot());
200 ihs_psdHdrSum = (ihs_psdHdrSum & 0xFFFF) + (ihs_psdHdrSum >> 16);
202 ihs_psdHdrSum = (ihs_psdHdrSum & 0xFFFF) + (ihs_psdHdrSum >> 16);
204 ihs_fsmState = FSM_IHS_IPW2;
209 if (soRph_Ip4Hdr.full()) {
210 printWarn(myName,
"FSM_IHS_IPW2 - Header-buffer space is exhausted. The remaining of this packet will be dropped.\n");
211 ihs_fsmState = FSM_IHS_DROP;
213 else if (!siIPRX_Data.empty()) {
215 siIPRX_Data.read(currIp4Chunk);
218 ihs_psdHdrSum = (ihs_psdHdrSum & 0xFFFF) + (ihs_psdHdrSum >> 16);
220 ihs_psdHdrSum = (ihs_psdHdrSum & 0xFFFF) + (ihs_psdHdrSum >> 16);
221 if (ihs_ip4HdrLen == 1) {
224 ihs_fsmState = FSM_IHS_UDP_HEADER;
226 else if (ihs_ip4HdrLen == 2 ) {
227 printWarn(myName,
"This IPv4 packet contains one 32-bit option! FYI, IPV4 options are not supported.\n");
229 ihs_fsmState = FSM_IHS_UDP_HEADER_ALIGNED;
232 printWarn(myName,
"This IPv4 packet contains two+ 32-bit options! FYI, IPV4 options are not supported.\n");
235 ihs_fsmState = FSM_IHS_OPT;
241 if (soRph_Ip4Hdr.full()) {
242 printWarn(myName,
"FSM_IHS_OPT - Header-buffer space is exhausted. The remaining of this packet will be dropped.\n");
243 ihs_fsmState = FSM_IHS_DROP;
245 else if (!siIPRX_Data.empty()) {
246 printWarn(myName,
"This IPv4 packet contains options! FYI, IPV4 options are not supported and will be dropped.\n");
248 siIPRX_Data.read(currIp4Chunk);
249 if (ihs_ip4HdrLen == 1) {
250 printWarn(myName,
"This IPv4 packet contains three 32-bit options!\n");
252 ihs_fsmState = FSM_IHS_UDP_HEADER;
254 else if (ihs_ip4HdrLen == 2 ) {
255 printWarn(myName,
"This IPv4 packet contains four 32-bit options!\n");
257 ihs_fsmState = FSM_IHS_UDP_HEADER_ALIGNED;
260 printWarn(myName,
"This IPv4 packet contains four+ 32-bit options!\n");
263 ihs_fsmState = FSM_IHS_OPT;
268 case FSM_IHS_UDP_HEADER:
270 if (!siIPRX_Data.empty()) {
272 siIPRX_Data.read(currIp4Chunk);
274 ihs_psdHdrSum += currIp4Chunk.
getUdpLen();
275 ihs_psdHdrSum = (ihs_psdHdrSum & 0xFFFF) + (ihs_psdHdrSum >> 16);
277 soUcc_PsdHdrSum.write(ihs_psdHdrSum(15, 0));
283 if (currIp4Chunk.
getTKeep() == 0xF0) {
284 printWarn(myName,
"Received a UDP datagram of length = 0!\n");
286 ihs_fsmState = FSM_IHS_DONE;
291 ihs_fsmState = FSM_IHS_RESIDUE;
295 ihs_fsmState = FSM_IHS_FORWARD;
297 soUcc_UdpDgrm.write(sendChunk);
301 case FSM_IHS_UDP_HEADER_ALIGNED:
303 if (!siIPRX_Data.empty()) {
305 siIPRX_Data.read(currIp4Chunk);
307 AxisUdp currUdpChunk(currIp4Chunk);
309 ihs_psdHdrSum += currUdpChunk.
getUdpLen();
310 ihs_psdHdrSum = (ihs_psdHdrSum & 0xFFFF) + (ihs_psdHdrSum >> 16);
312 soUcc_PsdHdrSum.write(ihs_psdHdrSum(15, 0));
314 soUcc_UdpDgrm.write(currUdpChunk);
316 printWarn(myName,
"Received a UDP datagram of length = 0!\n");
317 ihs_fsmState = FSM_IHS_DONE;
320 ihs_fsmState = FSM_IHS_FORWARD_ALIGNED;
325 case FSM_IHS_FORWARD:
327 if (!siIPRX_Data.empty()) {
329 siIPRX_Data.read(currIp4Chunk);
336 if (currIp4Chunk.
getTKeep() <= 0xF0) {
338 ihs_fsmState = FSM_IHS_DONE;
342 ihs_fsmState = FSM_IHS_RESIDUE;
347 ihs_fsmState = FSM_IHS_FORWARD;
349 soUcc_UdpDgrm.write(sendChunk);
353 case FSM_IHS_FORWARD_ALIGNED:
355 if (!siIPRX_Data.empty()) {
357 siIPRX_Data.read(currIp4Chunk);
359 AxisUdp currUdpChunk(currIp4Chunk);
360 soUcc_UdpDgrm.write(currUdpChunk);
362 ihs_fsmState = FSM_IHS_DONE;
365 ihs_fsmState = FSM_IHS_FORWARD_ALIGNED;
370 case FSM_IHS_RESIDUE:
378 soUcc_UdpDgrm.write(sendChunk);
379 ihs_fsmState = FSM_IHS_DONE;
384 siUcc_ClearToSend.read();
385 ihs_fsmState = FSM_IHS_IDLE;
389 if (!siIPRX_Data.empty()) {
391 siIPRX_Data.read(currIp4Chunk);
394 ihs_fsmState = FSM_IHS_IDLE;
402 ihs_prevChunk = currIp4Chunk;
403 if (!soMMIO_DropCnt.full()) {
404 soMMIO_DropCnt.write(ihs_dropCounter);
407 printWarn(myName,
"Cannot write soMMIO_DropCnt stream...");
431 stream<AxisUdp> &siIhs_UdpDgrm,
432 stream<UdpCsum> &siIhs_PsdHdrSum,
433 stream<AxisUdp> &soRph_UdpDgrm,
434 stream<ValBool> &soRph_CsumVal,
435 stream<SigBit> &soIhs_ClearToSend)
438 #pragma HLS INLINE off
439 #pragma HLS pipeline II=1 enable_flush
444 static enum FsmStates { FSM_UCC_INIT=0, FSM_UCC_IDLE, FSM_UCC_START,
445 FSM_UCC_CHK0, FSM_UCC_CHK1, FSM_UCC_ACCUMULATE,
446 FSM_UCC_STREAM } ucc_fsmState=FSM_UCC_INIT;
447 #pragma HLS RESET variable=ucc_fsmState
448 static ap_uint<10> ucc_chunkCount=0;
449 #pragma HLS RESET variable=ucc_chunkCount
452 static ap_uint<17> ucc_csum0;
453 static ap_uint<17> ucc_csum1;
454 static ap_uint<17> ucc_csum2;
455 static ap_uint<17> ucc_csum3;
461 switch (ucc_fsmState) {
464 soIhs_ClearToSend.write(1);
465 ucc_fsmState = FSM_UCC_IDLE;
468 if (!soIhs_ClearToSend.full()) {
470 soIhs_ClearToSend.write(1);
471 ucc_fsmState = FSM_UCC_START;
475 if (!siIhs_UdpDgrm.empty() and !siIhs_PsdHdrSum.empty() and
476 !soRph_UdpDgrm.full() and !soRph_CsumVal.full()) {
478 siIhs_UdpDgrm.read(currChunk);
480 siIhs_PsdHdrSum.read(ucc_psdHdrCsum);
482 soRph_UdpDgrm.write(currChunk);
486 soRph_CsumVal.write(
true);
487 ucc_fsmState = FSM_UCC_STREAM;
492 ucc_csum0 += ucc_psdHdrCsum;
493 ucc_csum0 = (ucc_csum0 & 0xFFFF) + (ucc_csum0 >> 16);
495 ucc_csum2 = 0x00000 | currChunk.
getUdpLen();
499 ucc_fsmState = FSM_UCC_CHK0;
502 ucc_fsmState = FSM_UCC_ACCUMULATE;
509 if (!siIhs_UdpDgrm.empty() and !soRph_UdpDgrm.full()) {
510 siIhs_UdpDgrm.read(currChunk);
511 soRph_UdpDgrm.write(currChunk);
513 ucc_fsmState = FSM_UCC_IDLE;
518 case FSM_UCC_ACCUMULATE:
519 if (!siIhs_UdpDgrm.empty() and !soRph_UdpDgrm.full()) {
520 siIhs_UdpDgrm.read(currChunk);
524 cleanChunk.range( 7, 0) = (currChunk.
getLE_TData()).range( 7, 0);
526 cleanChunk.range(15, 8) = (currChunk.
getLE_TData()).range(15, 8);
528 cleanChunk.range(23,16) = (currChunk.
getLE_TData()).range(23,16);
530 cleanChunk.range(31,24) = (currChunk.
getLE_TData()).range(31,24);
532 cleanChunk.range(39,32) = (currChunk.
getLE_TData()).range(39,32);
534 cleanChunk.range(47,40) = (currChunk.
getLE_TData()).range(47,40);
536 cleanChunk.range(55,48) = (currChunk.
getLE_TData()).range(55,48);
538 cleanChunk.range(63,56) = (currChunk.
getLE_TData()).range(63,56);
541 ucc_csum0 +=
byteSwap16(cleanChunk.range(63, 48));
542 ucc_csum0 = (ucc_csum0 & 0xFFFF) + (ucc_csum0 >> 16);
543 ucc_csum1 +=
byteSwap16(cleanChunk.range(47, 32));
544 ucc_csum1 = (ucc_csum1 & 0xFFFF) + (ucc_csum1 >> 16);
545 ucc_csum2 +=
byteSwap16(cleanChunk.range(31, 16));
546 ucc_csum2 = (ucc_csum2 & 0xFFFF) + (ucc_csum2 >> 16);
547 ucc_csum3 +=
byteSwap16(cleanChunk.range(15, 0));
548 ucc_csum3 = (ucc_csum3 & 0xFFFF) + (ucc_csum3 >> 16);
551 ucc_fsmState = FSM_UCC_CHK0;
558 ucc_csum0 += ucc_csum2;
559 ucc_csum0 = (ucc_csum0 & 0xFFFF) + (ucc_csum0 >> 16);
560 ucc_csum1 += ucc_csum3;
561 ucc_csum1 = (ucc_csum1 & 0xFFFF) + (ucc_csum1 >> 16);
562 ucc_fsmState = FSM_UCC_CHK1;
565 if (!soRph_CsumVal.full()) {
567 ucc_csum0 += ucc_csum1;
568 ucc_csum0 = (ucc_csum0 & 0xFFFF) + (ucc_csum0 >> 16);
569 UdpCsum csumChk = ~(ucc_csum0(15, 0));
572 soRph_CsumVal.write(
true);
575 soRph_CsumVal.write(
false);
577 printWarn(myName,
"The current UDP datagram will be dropped because:\n");
578 printWarn(myName,
" csum = 0x%4.4X instead of 0x0000\n", csumChk.to_ushort());
581 ucc_fsmState = FSM_UCC_IDLE;
611 stream<AxisUdp> &siUcc_UdpDgrm,
612 stream<ValBool> &siUcc_CsumVal,
613 stream<AxisIp4> &siIhs_Ip4Hdr,
614 stream<UdpPort> &soUpt_PortStateReq,
615 stream<StsBool> &siUpt_PortStateRep,
616 stream<UdpAppData> &soUAIF_Data,
617 stream<UdpAppMeta> &soUAIF_Meta,
618 stream<UdpAppDLen> &soUAIF_DLen,
619 stream<AxisIcmp> &soICMP_Data)
622 #pragma HLS INLINE off
623 #pragma HLS PIPELINE II=1 enable_flush
628 static enum FsmStates { FSM_RPH_IDLE=0, FSM_RPH_PORT_LOOKUP,
629 FSM_RPH_STREAM, FSM_RPH_STREAM_FIRST,
630 FSM_RPH_DRAIN_DATAGRAM_STREAM,FSM_RPH_DRAIN_IP4HDR_STREAM,
631 FSM_RPH_PORT_UNREACHABLE_1ST, FSM_RPH_PORT_UNREACHABLE_2ND,
632 FSM_RPH_PORT_UNREACHABLE_STREAM,
633 FSM_RPH_PORT_UNREACHABLE_LAST } rph_fsmState=FSM_RPH_IDLE;
634 #pragma HLS RESET variable=rph_fsmState
637 static AxisIp4 rph_1stIp4HdrChunk;
638 static AxisIp4 rph_2ndIp4HdrChunk;
639 static AxisUdp rph_udpHeaderChunk;
640 static FlagBit rph_emptyPayloadFlag;
641 static FlagBool rph_doneWithIpHdrStream;
642 static UdpLen rph_dgrmLen;
646 switch(rph_fsmState) {
648 if (!siUcc_UdpDgrm.empty() and !siIhs_Ip4Hdr.empty() and
649 !soUpt_PortStateReq.full()) {
650 rph_doneWithIpHdrStream =
false;
652 siIhs_Ip4Hdr.read(rph_1stIp4HdrChunk);
654 siUcc_UdpDgrm.read(rph_udpHeaderChunk);
656 soUpt_PortStateReq.write(rph_udpHeaderChunk.
getUdpDstPort());
658 if (rph_udpHeaderChunk.
getUdpLen() > 8) {
659 rph_emptyPayloadFlag = 0;
664 rph_dgrmLen = rph_udpHeaderChunk.
getUdpLen() - 8;
667 rph_emptyPayloadFlag = 1;
671 printInfo(myName,
"FSM_RPH_IDLE - Receive new datagram (UdpLen=%d)\n",
672 rph_udpHeaderChunk.
getUdpLen().to_ushort());
674 rph_fsmState = FSM_RPH_PORT_LOOKUP;
677 case FSM_RPH_PORT_LOOKUP:
678 if (!siUpt_PortStateRep.empty() and !siUcc_CsumVal.empty() and
679 !siIhs_Ip4Hdr.empty() and !soUAIF_DLen.full()) {
680 bool csumResult = siUcc_CsumVal.read();
681 bool portLkpRes = siUpt_PortStateRep.read();
683 siIhs_Ip4Hdr.read(rph_2ndIp4HdrChunk);
686 printInfo(myName,
"FSM_RPH_PORT_LOOKUP - CsumValid=%d and portLkpRes=%d.\n",
687 csumResult, portLkpRes);
689 if(portLkpRes and csumResult) {
690 soUAIF_DLen.write(rph_dgrmLen);
691 rph_fsmState = FSM_RPH_STREAM_FIRST;
693 else if (not csumResult) {
694 rph_fsmState = FSM_RPH_DRAIN_DATAGRAM_STREAM;
697 rph_fsmState = FSM_RPH_PORT_UNREACHABLE_1ST;
701 case FSM_RPH_STREAM_FIRST:
703 if (!siUcc_UdpDgrm.empty() and !siIhs_Ip4Hdr.empty() and
704 !soUAIF_Data.full() and !soUAIF_Meta.full()) {
707 siIhs_Ip4Hdr.read(thirdIp4HdrChunk);
710 rph_doneWithIpHdrStream =
true;
713 if (not rph_emptyPayloadFlag) {
714 soUAIF_Meta.write(rph_udpMeta);
716 siUcc_UdpDgrm.read(dgrmChunk);
719 if (dgrmChunk.
getTLast() or rph_emptyPayloadFlag) {
722 rph_fsmState = FSM_RPH_IDLE;
726 rph_fsmState = FSM_RPH_DRAIN_IP4HDR_STREAM;
730 rph_fsmState = FSM_RPH_STREAM;
735 if (!siUcc_UdpDgrm.empty() and !soUAIF_Data.full() and !soUAIF_Meta.full()) {
738 siUcc_UdpDgrm.read(dgrmChunk);
744 if (rph_doneWithIpHdrStream) {
746 rph_fsmState = FSM_RPH_IDLE;
750 rph_fsmState = FSM_RPH_DRAIN_IP4HDR_STREAM;
753 else if (!siIhs_Ip4Hdr.empty() and not rph_doneWithIpHdrStream) {
756 siIhs_Ip4Hdr.read(currIp4HdrChunk);
758 rph_doneWithIpHdrStream =
true;
765 case FSM_RPH_DRAIN_DATAGRAM_STREAM:
767 if (!siUcc_UdpDgrm.empty()) {
769 siUcc_UdpDgrm.read(currChunk);
771 printInfo(myName,
"FSM_RPH_DRAIN_DATAGRAM_STREAM -\n");
774 if (rph_doneWithIpHdrStream) {
776 rph_fsmState = FSM_RPH_IDLE;
780 rph_fsmState = FSM_RPH_DRAIN_IP4HDR_STREAM;
785 case FSM_RPH_DRAIN_IP4HDR_STREAM :
787 if (!siIhs_Ip4Hdr.empty()) {
789 siIhs_Ip4Hdr.read(currChunk);
791 printInfo(myName,
"FSM_RPH_DRAIN_IP4HDR_STREAM -\n");
794 rph_fsmState = FSM_RPH_IDLE;
798 case FSM_RPH_PORT_UNREACHABLE_1ST:
799 if (!soICMP_Data.full()) {
801 soICMP_Data.write(rph_1stIp4HdrChunk);
803 printInfo(myName,
"FSM_RPH_PORT_UNREACHABLE_1ST -\n");
805 rph_fsmState = FSM_RPH_PORT_UNREACHABLE_2ND;
808 case FSM_RPH_PORT_UNREACHABLE_2ND:
809 if (!soICMP_Data.full()) {
811 soICMP_Data.write(rph_2ndIp4HdrChunk);
813 printInfo(myName,
"FSM_RPH_PORT_UNREACHABLE_2ND -\n");
815 rph_fsmState = FSM_RPH_PORT_UNREACHABLE_STREAM;
818 case FSM_RPH_PORT_UNREACHABLE_STREAM:
819 if (!siIhs_Ip4Hdr.empty() and !soICMP_Data.full()) {
822 siIhs_Ip4Hdr.read(ip4Chunk);
826 printInfo(myName,
"FSM_RPH_PORT_UNREACHABLE_STREAM -\n");
829 rph_doneWithIpHdrStream =
true;
830 rph_fsmState = FSM_RPH_PORT_UNREACHABLE_LAST;
834 case FSM_RPH_PORT_UNREACHABLE_LAST:
836 if (!soICMP_Data.full()) {
839 rph_fsmState = FSM_RPH_DRAIN_DATAGRAM_STREAM;
866 stream<StsBool> &soMMIO_Ready,
867 stream<UdpPort> &siRph_PortStateReq,
868 stream<StsBool> &soRph_PortStateRep,
869 stream<UdpPort> &siUAIF_LsnReq,
870 stream<StsBool> &soUAIF_LsnRep,
871 stream<UdpPort> &siUAIF_ClsReq,
872 stream<StsBool> &soUAIF_ClsRep)
880 static ValBool PORT_TABLE[0x10000];
881 #pragma HLS RESOURCE variable=PORT_TABLE core=RAM_T2P_BRAM
882 #pragma HLS DEPENDENCE variable=PORT_TABLE inter false
885 static enum FsmStates { UPT_WAIT4REQ=0, UPT_RPH_LKP, UPT_LSN_REP,
886 UPT_CLS_REP } upt_fsmState=UPT_WAIT4REQ;
887 #pragma HLS RESET variable=upt_fsmState
888 static bool upt_isInit=
false;
889 #pragma HLS reset variable=upt_isInit
890 static UdpPort upt_initPtr=(0x10000-1);
891 #pragma HLS reset variable=upt_initPtr
899 if (upt_initPtr == 0) {
900 if (!soMMIO_Ready.full()) {
901 soMMIO_Ready.write(
true);
904 printInfo(myName,
"Done with initialization of the PORT_TABLE.\n");
908 printWarn(myName,
"Cannot signal INIT_DONE because HLS stream is not empty.\n");
912 upt_initPtr = upt_initPtr - 1;
917 switch (upt_fsmState) {
919 if (!siRph_PortStateReq.empty()) {
921 siRph_PortStateReq.read(upt_portNum);
922 upt_fsmState = UPT_RPH_LKP;
924 else if (!siUAIF_LsnReq.empty()) {
926 siUAIF_LsnReq.read(upt_portNum);
927 upt_fsmState = UPT_LSN_REP;
929 else if (!siUAIF_ClsReq.empty()) {
931 siUAIF_ClsReq.read(upt_portNum);
932 upt_fsmState = UPT_CLS_REP;
936 if (!soRph_PortStateRep.full()) {
937 soRph_PortStateRep.write(PORT_TABLE[upt_portNum]);
938 upt_fsmState = UPT_WAIT4REQ;
942 if (!soUAIF_LsnRep.full()) {
945 upt_fsmState = UPT_WAIT4REQ;
949 if (!soUAIF_ClsRep.full()) {
952 upt_fsmState = UPT_WAIT4REQ;
984 stream<StsBool> &soMMIO_Ready,
985 stream<AxisIp4> &siIPRX_Data,
986 stream<UdpPort> &siUAIF_LsnReq,
987 stream<StsBool> &soUAIF_LsnRep,
988 stream<UdpPort> &siUAIF_ClsReq,
989 stream<StsBool> &soUAIF_ClsRep,
990 stream<UdpAppData> &soUAIF_Data,
991 stream<UdpAppMeta> &soUAIF_Meta,
992 stream<UdpAppDLen> &soUAIF_DLen,
993 stream<AxisIcmp> &soICMP_Data,
994 stream<ap_uint<16> > &soMMIO_DropCnt)
1004 static stream<AxisIp4> ssIhsToRph_Ip4Hdr (
"ssIhsToRph_Ip4Hdr");
1005 #pragma HLS STREAM variable=ssIhsToRph_Ip4Hdr depth=cIp4RxHdrsFifoSize
1006 static stream<AxisUdp> ssIhsToUcc_UdpDgrm (
"ssIhsToUcc_UdpDgrm");
1007 #pragma HLS STREAM variable=ssIhsToUcc_UdpDgrm depth=cMtuSize
1008 static stream<UdpCsum> ssIhsToUcc_PsdHdrSum (
"ssIhsToUcc_PsdHdrSum");
1009 #pragma HLS STREAM variable=ssIhsToUcc_PsdHdrSum depth=2
1011 static stream<AxisUdp> ssUccToRph_UdpDgrm (
"ssUccToRph_UdpDgrm");
1012 #pragma HLS STREAM variable=ssUccToRph_UdpDgrm depth=cUdpRxDataFifoSize
1013 static stream<ValBool> ssUccToRph_CsumVal (
"ssUccToRph_CsumVal");
1014 #pragma HLS STREAM variable=ssUccToRph_CsumVal depth=cUdpRxHdrsFifoSize
1015 static stream<SigBit> ssUccToIhs_ClearToSend (
"ssUccToIhs_ClearToSend");
1016 #pragma HLS STREAM variable=ssUccToIhs_ClearToSend depth=2
1019 static stream<UdpPort> ssRphToUpt_PortStateReq (
"ssRphToUpt_PortStateReq");
1020 #pragma HLS STREAM variable=ssRphToUpt_PortStateReq depth=2
1023 static stream<StsBool> ssUptToRph_PortStateRep (
"ssUptToRph_PortStateRep");
1024 #pragma HLS STREAM variable=ssUptToRph_PortStateRep depth=2
1030 ssIhsToUcc_PsdHdrSum,
1032 ssUccToIhs_ClearToSend,
1037 ssIhsToUcc_PsdHdrSum,
1040 ssUccToIhs_ClearToSend);
1046 ssRphToUpt_PortStateReq,
1047 ssUptToRph_PortStateRep,
1055 ssRphToUpt_PortStateReq,
1056 ssUptToRph_PortStateRep,
1103 stream<UdpAppData> &siUAIF_Data,
1104 stream<UdpAppMeta> &siUAIF_Meta,
1105 stream<UdpAppDLen> &siUAIF_DLen,
1106 stream<UdpAppData> &soTdh_Data,
1107 stream<UdpAppMeta> &soTdh_Meta,
1108 stream<UdpAppDLen> &soTdh_DLen)
1111 #pragma HLS INLINE off
1112 #pragma HLS pipeline II=1 enable_flush
1117 static enum FsmStates { FSM_TAI_IDLE=0,
1118 FSM_TAI_DRGM_DATA, FSM_TAI_DRGM_META,
1119 FSM_TAI_STRM_DATA, FSM_TAI_STRM_META,
1120 } tai_fsmState=FSM_TAI_IDLE;
1121 #pragma HLS RESET variable=tai_fsmState
1122 static FlagBool tai_streamMode=
false;
1123 #pragma HLS RESET variable=tai_streamMode
1130 switch(tai_fsmState) {
1132 if (!siUAIF_Meta.empty() and !siUAIF_DLen.empty() and (piMMIO_En ==
CMD_ENABLE)) {
1133 siUAIF_Meta.read(tai_appMeta);
1134 siUAIF_DLen.read(tai_appDLen);
1135 if (tai_appDLen == 0) {
1136 tai_streamMode =
true;
1137 tai_fsmState = FSM_TAI_STRM_DATA;
1140 tai_streamMode =
false;
1141 tai_fsmState = FSM_TAI_DRGM_DATA;
1152 case FSM_TAI_DRGM_DATA:
1153 if (!siUAIF_Data.empty() and !soTdh_Data.full() ) {
1156 tai_appDLen -= currChunk.
getLen();
1157 tai_splitCnt += currChunk.
getLen();
1158 if ((tai_appDLen == 0) or (tai_splitCnt == UDP_MDS)) {
1161 tai_fsmState = FSM_TAI_DRGM_META;
1163 soTdh_Data.write(currChunk);
1165 printInfo(myName,
"FSM_TAI_DRGM_DATA - DLen=%4d - Remainder=%5d \n",
1166 tai_splitCnt.to_ushort(), tai_appDLen.to_ushort());
1170 case FSM_TAI_DRGM_META:
1171 if (!soTdh_Meta.full() and !soTdh_DLen.full()) {
1173 soTdh_Meta.write(tai_appMeta);
1174 soTdh_DLen.write(tai_splitCnt);
1175 if (tai_appDLen == 0) {
1176 tai_fsmState = FSM_TAI_IDLE;
1179 tai_fsmState = FSM_TAI_DRGM_DATA;
1183 printInfo(myName,
"FSM_TAI_DRGM_META - DLen=%4d - Remainder=0 \n",
1184 tai_splitCnt.to_ushort(), tai_appDLen.to_ushort());
1188 case FSM_TAI_STRM_DATA:
1189 if (!siUAIF_Data.empty() and !soTdh_Data.full() ) {
1192 tai_appDLen -= currChunk.
getLen();
1193 tai_splitCnt += currChunk.
getLen();
1195 tai_streamMode =
false;
1196 tai_fsmState = FSM_TAI_STRM_META;
1198 else if (tai_splitCnt == UDP_MDS) {
1201 tai_fsmState = FSM_TAI_STRM_META;
1203 soTdh_Data.write(currChunk);
1205 printInfo(myName,
"FSM_TAI_STRM_DATA - DLen=%4d \n",
1206 tai_splitCnt.to_ushort());
1210 case FSM_TAI_STRM_META:
1211 if (!soTdh_Meta.full() and !soTdh_DLen.full()) {
1213 soTdh_Meta.write(tai_appMeta);
1214 soTdh_DLen.write(tai_splitCnt);
1215 if (tai_streamMode ==
false) {
1216 tai_fsmState = FSM_TAI_IDLE;
1219 tai_fsmState = FSM_TAI_STRM_DATA;
1223 printInfo(myName,
"FSM_TAI_STRM_META - DLen=%4d - Remainder=0 \n",
1224 tai_splitCnt.to_ushort(), tai_appDLen.to_ushort());
1255 stream<UdpAppData> &siUAIF_Data,
1256 stream<UdpAppMeta> &siUAIF_Meta,
1257 stream<UdpAppDLen> &siUAIF_DLen,
1258 stream<UdpAppData> &soUha_Data,
1259 stream<UdpAppMeta> &soUha_Meta,
1260 stream<UdpAppDLen> &soUha_DLen,
1261 stream<AxisPsd4> &soUca_Data)
1264 #pragma HLS INLINE off
1265 #pragma HLS pipeline II=1 enable_flush
1270 static enum FsmStates { FSM_TDH_PSD_PKT1=0, FSM_TDH_PSD_PKT2, FSM_TDH_PSD_PKT3,
1271 FSM_TDH_PSD_PKT4, FSM_TDH_STREAM, FSM_TDH_PSD_RESIDUE,
1272 FSM_TDH_LAST } tdh_fsmState=FSM_TDH_PSD_PKT1;
1273 #pragma HLS RESET variable=tdh_fsmState
1279 static UdpLen tdh_udpLen;
1281 switch(tdh_fsmState) {
1282 case FSM_TDH_PSD_PKT1:
1283 if (!siUAIF_Meta.empty() and
1284 !soUha_Meta.full() and !soUca_Data.full()) {
1285 siUAIF_Meta.read(tdh_udpMeta);
1287 AxisPsd4 firstPseudoPktChunk(0, 0xFF, 0);
1291 soUca_Data.write(firstPseudoPktChunk);
1292 soUha_Meta.write(tdh_udpMeta);
1293 tdh_fsmState = FSM_TDH_PSD_PKT2;
1295 printInfo(myName,
"FSM_TDH_PSD_PKT1 - Receive new metadata information.\n");
1301 case FSM_TDH_PSD_PKT2:
1302 if (!siUAIF_DLen.empty() and
1303 !soUha_DLen.full() and !soUca_Data.full()) {
1304 siUAIF_DLen.read(tdh_appLen);
1308 AxisPsd4 secondPseudoPktChunk(0, 0xFF, 0);
1314 soUha_DLen.write(tdh_appLen);
1315 soUca_Data.write(secondPseudoPktChunk);
1316 tdh_fsmState = FSM_TDH_PSD_PKT3;
1320 case FSM_TDH_PSD_PKT3:
1321 if (!siUAIF_Data.empty() and
1322 !soUca_Data.full() and !soUha_Data.full()) {
1324 siUAIF_Data.read(tdh_currChunk);
1326 AxisPsd4 thirdPseudoPktChunk(0, 0xFF, 0);
1327 thirdPseudoPktChunk.
setUdpLen(tdh_udpLen);
1332 soUha_Data.write(tdh_currChunk);
1335 tdh_fsmState = FSM_TDH_PSD_PKT1;
1341 tdh_fsmState = FSM_TDH_PSD_PKT4;
1345 tdh_fsmState = FSM_TDH_STREAM;
1347 soUca_Data.write(thirdPseudoPktChunk);
1351 case FSM_TDH_PSD_PKT4:
1352 if (!soUca_Data.full()) {
1357 soUca_Data.write(fourthPseudoPktChunk);
1358 tdh_fsmState = FSM_TDH_PSD_PKT1;
1362 case FSM_TDH_STREAM:
1365 if (!siUAIF_Data.empty() and
1366 !soUha_Data.full() and !soUca_Data.full()) {
1368 soUha_Data.write(tdh_currChunk);
1370 AxisPsd4 currPseudoChunk(0, 0xFF, 0);
1372 siUAIF_Data.read(tdh_currChunk);
1379 tdh_fsmState = FSM_TDH_PSD_RESIDUE;
1383 tdh_fsmState = FSM_TDH_LAST;
1388 soUca_Data.write(currPseudoChunk);
1393 if (!soUha_Data.full()) {
1394 soUha_Data.write(tdh_currChunk);
1395 tdh_fsmState = FSM_TDH_PSD_PKT1;
1399 case FSM_TDH_PSD_RESIDUE:
1400 if (!soUha_Data.full() and !soUca_Data.full()) {
1402 soUha_Data.write(tdh_currChunk);
1407 soUca_Data.write(lastPseudoPktChunk);
1408 tdh_fsmState = FSM_TDH_PSD_PKT1;
1416 stream<AxisPsd4> &siTdh_Data,
1417 stream<UdpCsum> &soUha_Csum)
1420 #pragma HLS INLINE off
1421 #pragma HLS PIPELINE II=1 enable_flush
1426 static enum FsmStates { FSM_UCA_ACCUMULATE=0, FSM_UCA_LAST, FSM_UCA_DONE } \
1427 uca_fsmState=FSM_UCA_ACCUMULATE;
1428 #pragma HLS RESET variable=uca_fsmState
1429 static ap_uint<17> uca_csum0;
1430 #pragma HLS RESET variable=uca_csum0
1431 static ap_uint<17> uca_csum1;
1432 #pragma HLS RESET variable=uca_csum1
1433 static ap_uint<17> uca_csum2;
1434 #pragma HLS RESET variable=uca_csum2
1435 static ap_uint<17> uca_csum3;
1436 #pragma HLS RESET variable=uca_csum3
1438 #pragma HLS RESET variable=uca_lastChunk
1440 switch (uca_fsmState) {
1441 case FSM_UCA_ACCUMULATE:
1442 if (!siTdh_Data.empty()) {
1443 AxisPsd4 currChunk = siTdh_Data.read();
1445 uca_lastChunk = currChunk;
1447 uca_fsmState = FSM_UCA_LAST;
1451 uca_csum0 = (uca_csum0 & 0xFFFF) + (uca_csum0 >> 16);
1453 uca_csum1 = (uca_csum1 & 0xFFFF) + (uca_csum1 >> 16);
1455 uca_csum2 = (uca_csum2 & 0xFFFF) + (uca_csum2 >> 16);
1457 uca_csum3 = (uca_csum3 & 0xFFFF) + (uca_csum3 >> 16);
1460 printAxisRaw(myName,
"Received a new pseudo-header chunk: ", currChunk);
1466 uca_csum0 = (uca_csum0 & 0xFFFF) + (uca_csum0 >> 16);
1468 uca_csum1 = (uca_csum1 & 0xFFFF) + (uca_csum1 >> 16);
1470 uca_csum2 = (uca_csum2 & 0xFFFF) + (uca_csum2 >> 16);
1472 uca_csum3 = (uca_csum3 & 0xFFFF) + (uca_csum3 >> 16);
1473 uca_fsmState = FSM_UCA_DONE;
1476 if (!soUha_Csum.full()) {
1477 ap_uint<17> csum01, csum23, csum0123;
1478 csum01 = uca_csum0 + uca_csum1;
1479 csum01 = (csum01 & 0xFFFF) + (csum01 >> 16);
1480 csum23 = uca_csum2 + uca_csum3;
1481 csum23 = (csum23 & 0xFFFF) + (csum23 >> 16);
1482 csum0123 = csum01 + csum23;
1483 csum0123 = (csum0123 & 0xFFFF) + (csum0123 >> 16);
1484 csum0123 = ~csum0123;
1485 soUha_Csum.write(csum0123.range(15, 0));
1492 printInfo(myName,
"End of pseudo-header packet.\n");
1494 uca_fsmState = FSM_UCA_ACCUMULATE;
1517 stream<UdpAppData> &siTdh_Data,
1518 stream<UdpAppDLen> &siTdh_DLen,
1519 stream<UdpAppMeta> &siTdh_Meta,
1520 stream<UdpCsum> &siUca_Csum,
1521 stream<AxisUdp> &soIha_Data,
1522 stream<IpAddrPair> &soIha_IpPair,
1523 stream<UdpLen> &soIha_UdpLen)
1526 #pragma HLS INLINE off
1527 #pragma HLS PIPELINE II=1 enable_flush
1532 static enum FsmStates{ UHA_IDLE=0, UHA_STREAM} uha_fsmState;
1533 #pragma HLS RESET variable=uha_fsmState
1538 switch(uha_fsmState) {
1540 if (!siTdh_DLen.empty() and !siTdh_Meta.empty() and !siUca_Csum.empty() and
1541 !soIha_UdpLen.full() and !soIha_Data.full() and !soIha_IpPair.full()) {
1543 siTdh_DLen.read(uha_appDLen);
1545 soIha_UdpLen.write(udpLen);
1553 soIha_Data.write(udpHdrChunk);
1555 soIha_IpPair.write(ipAddrPair);
1556 uha_fsmState = UHA_STREAM;
1561 if (!siTdh_Data.empty() and !soIha_Data.full()) {
1563 if (uha_appDLen > 8) {
1566 printWarn(myName,
"Malformed - TLAST bit is set but end of Axis stream is not reached !!!\n");
1568 uha_fsmState = UHA_IDLE;
1573 printWarn(myName,
"Malformed - End of Axis stream is reached but TLAST bit is not set!!!\n");
1578 uha_fsmState = UHA_IDLE;
1600 stream<AxisUdp> &siUha_Data,
1601 stream<IpAddrPair> &siUha_IpPair,
1602 stream<UdpLen> &siUha_UdpLen,
1603 stream<AxisIp4> &soIPTX_Data)
1606 #pragma HLS INLINE off
1607 #pragma HLS pipeline II=1 enable_flush
1612 static enum FsmStates { IPH_IP1=0, IPH_IP2, IPH_IP3, IPH_FORWARD,
1613 IPH_RESIDUE} iha_fsmState;
1614 #pragma HLS RESET variable=iha_fsmState
1619 static AxisUdp iha_prevUdpChunk;
1624 switch(iha_fsmState) {
1626 if(!siUha_UdpLen.empty() and !siUha_Data.empty() and !siUha_IpPair.empty() and
1627 !soIPTX_Data.full()) {
1628 UdpLen udpLen = siUha_UdpLen.read();
1638 soIPTX_Data.write(firstIp4Chunk);
1639 iha_fsmState = IPH_IP2;
1644 if(!siUha_IpPair.empty() and !siUha_Data.empty() and
1645 !soIPTX_Data.full()) {
1646 iha_ipPair = siUha_IpPair.read();
1652 soIPTX_Data.write(secondIp4Chunk);
1653 iha_fsmState = IPH_IP3;
1658 if(!siUha_Data.empty() and !soIPTX_Data.full()) {
1659 currUdpChunk = siUha_Data.read();
1664 soIPTX_Data.write(thirdIp4Chunk);
1665 iha_fsmState = IPH_FORWARD;
1670 if(!siUha_Data.empty() and !soIPTX_Data.full()) {
1671 currUdpChunk = siUha_Data.read();
1677 iha_fsmState = IPH_RESIDUE;
1683 iha_fsmState = IPH_IP1;
1686 soIPTX_Data.write(forwardIp4Chunk);
1691 if (!soIPTX_Data.full()) {
1696 soIPTX_Data.write(forwardIp4Chunk);
1697 iha_fsmState = IPH_IP1;
1702 iha_prevUdpChunk = currUdpChunk;
1720 stream<UdpAppData> &siUAIF_Data,
1721 stream<UdpAppMeta> &siUAIF_Meta,
1722 stream<UdpAppDLen> &siUAIF_DLen,
1723 stream<AxisIp4> &soIPTX_Data)
1735 static stream<UdpAppData> ssTaiToTdh_Data (
"ssTaiToTdh_Data");
1736 #pragma HLS STREAM variable=ssTaiToTdh_Data depth=1024
1737 static stream<UdpAppMeta> ssTaiToTdh_Meta (
"ssTaiToTdh_Meta");
1738 #pragma HLS STREAM variable=ssTaiToTdh_Meta depth=32
1739 #pragma HLS DATA_PACK variable=ssTaiToTdh_Meta
1740 static stream<UdpAppDLen> ssTaiToTdh_DLen (
"ssTaiToTdh_DLen");
1741 #pragma HLS STREAM variable=ssTaiToTdh_DLen depth=32
1744 static stream<UdpAppData> ssTdhToUha_Data (
"ssTdhToUha_Data");
1745 #pragma HLS STREAM variable=ssTdhToUha_Data depth=1024
1746 static stream<UdpAppMeta> ssTdhToUha_Meta (
"ssTdhToUha_Meta");
1747 #pragma HLS STREAM variable=ssTdhToUha_Meta depth=32
1748 #pragma HLS DATA_PACK variable=ssTdhToUha_Meta
1749 static stream<UdpAppDLen> ssTdhToUha_DLen (
"ssTdhToUha_DLen");
1750 #pragma HLS STREAM variable=ssTdhToUha_DLen depth=32
1751 static stream<AxisPsd4> ssTdhToUca_Data (
"ssTdhToUca_Data");
1752 #pragma HLS STREAM variable=ssTdhToUca_Data depth=8
1755 static stream<UdpCsum> ssUcaToUha_Csum (
"ssUcaToUha_Csum");
1756 #pragma HLS STREAM variable=ssUcaToUha_Csum depth=32
1759 static stream<AxisUdp> ssUhaToIha_Data (
"ssUhaToIha_Data");
1760 #pragma HLS STREAM variable=ssUhaToIha_Data depth=1024
1761 static stream<UdpLen> ssUhaToIha_UdpLen (
"ssUhaToIha_UdpLen");
1762 #pragma HLS STREAM variable=ssUhaToIha_UdpLen depth=32
1763 static stream<IpAddrPair> ssUhaToIha_IpPair (
"ssUhaToIha_IpPair");
1764 #pragma HLS STREAM variable=ssUhaToIha_IpPair depth=32
1765 #pragma HLS DATA_PACK variable=ssUhaToIha_IpPair
1843 stream<ap_uint<16> > &soMMIO_DropCnt,
1844 stream<StsBool> &soMMIO_Ready,
1848 stream<AxisIp4> &siIPRX_Data,
1852 stream<AxisIp4> &soIPTX_Data,
1856 stream<UdpAppLsnReq> &siUAIF_LsnReq,
1857 stream<UdpAppLsnRep> &soUAIF_LsnRep,
1858 stream<UdpAppClsReq> &siUAIF_ClsReq,
1859 stream<UdpAppClsRep> &soUAIF_ClsRep,
1863 stream<UdpAppData> &soUAIF_Data,
1864 stream<UdpAppMeta> &soUAIF_Meta,
1865 stream<UdpAppDLen> &soUAIF_DLen,
1869 stream<UdpAppData> &siUAIF_Data,
1870 stream<UdpAppMeta> &siUAIF_Meta,
1871 stream<UdpAppDLen> &siUAIF_DLen,
1875 stream<AxisIcmp> &soICMP_Data)
1879 #pragma HLS INTERFACE ap_ctrl_none port=return
1880 #if HLS_VERSION == 2017
1881 #pragma HLS DATAFLOW
1883 #pragma HLS DATAFLOW disable_start_propagation
1938 #if HLS_VERSION == 2017
1944 stream<ap_uint<16> > &soMMIO_DropCnt,
1945 stream<StsBool> &soMMIO_Ready,
1949 stream<AxisIp4> &siIPRX_Data,
1953 stream<AxisIp4> &soIPTX_Data,
1957 stream<UdpAppLsnReq> &siUAIF_LsnReq,
1958 stream<UdpAppLsnRep> &soUAIF_LsnRep,
1959 stream<UdpAppClsReq> &siUAIF_ClsReq,
1960 stream<UdpAppClsRep> &soUAIF_ClsRep,
1964 stream<UdpAppData> &soUAIF_Data,
1965 stream<UdpAppMeta> &soUAIF_Meta,
1966 stream<UdpAppDLen> &soUAIF_DLen,
1970 stream<UdpAppData> &siUAIF_Data,
1971 stream<UdpAppMeta> &siUAIF_Meta,
1972 stream<UdpAppDLen> &siUAIF_DLen,
1976 stream<AxisIcmp> &soICMP_Data)
1980 #pragma HLS INTERFACE ap_ctrl_none port=return
1986 #pragma HLS INTERFACE ap_stable port=piMMIO_En name=piMMIO_En
1988 #pragma HLS RESOURCE core=AXI4Stream variable=soMMIO_DropCnt metadata="-bus_bundle soMMIO_DropCnt"
1989 #pragma HLS RESOURCE core=AXI4Stream variable=soMMIO_Ready metadata="-bus_bundle soMMIO_Ready"
1991 #pragma HLS RESOURCE core=AXI4Stream variable=siIPRX_Data metadata="-bus_bundle siIPRX_Data"
1992 #pragma HLS RESOURCE core=AXI4Stream variable=soIPTX_Data metadata="-bus_bundle soIPTX_Data"
1994 #pragma HLS RESOURCE core=AXI4Stream variable=siUAIF_LsnReq metadata="-bus_bundle siUAIF_LsnReq"
1995 #pragma HLS RESOURCE core=AXI4Stream variable=soUAIF_LsnRep metadata="-bus_bundle soUAIF_LsnRep"
1996 #pragma HLS RESOURCE core=AXI4Stream variable=siUAIF_ClsReq metadata="-bus_bundle siUAIF_ClsReq"
1997 #pragma HLS RESOURCE core=AXI4Stream variable=soUAIF_ClsRep metadata="-bus_bundle soUAIF_ClsRep"
1999 #pragma HLS RESOURCE core=AXI4Stream variable=soUAIF_Data metadata="-bus_bundle soUAIF_Data"
2000 #pragma HLS RESOURCE core=AXI4Stream variable=soUAIF_Meta metadata="-bus_bundle soUAIF_Meta"
2001 #pragma HLS DATA_PACK variable=soUAIF_Meta
2002 #pragma HLS RESOURCE core=AXI4Stream variable=soUAIF_DLen metadata="-bus_bundle soUAIF_DLen"
2004 #pragma HLS RESOURCE core=AXI4Stream variable=siUAIF_Data metadata="-bus_bundle siUAIF_Data"
2005 #pragma HLS RESOURCE core=AXI4Stream variable=siUAIF_Meta metadata="-bus_bundle siUAIF_Meta"
2006 #pragma HLS DATA_PACK variable=siUAIF_Meta
2007 #pragma HLS RESOURCE core=AXI4Stream variable=siUAIF_DLen metadata="-bus_bundle siUAIF_DLen"
2009 #pragma HLS RESOURCE core=AXI4Stream variable=soICMP_Data metadata="-bus_bundle soICMP_Data"
2012 #pragma HLS DATAFLOW
2047 stream<ap_uint<16> > &soMMIO_DropCnt,
2048 stream<StsBool> &soMMIO_Ready,
2052 stream<AxisRaw> &siIPRX_Data,
2056 stream<AxisRaw> &soIPTX_Data,
2060 stream<UdpAppLsnReq> &siUAIF_LsnReq,
2061 stream<UdpAppLsnRep> &soUAIF_LsnRep,
2062 stream<UdpAppClsReq> &siUAIF_ClsReq,
2063 stream<UdpAppClsRep> &soUAIF_ClsRep,
2067 stream<UdpAppData> &soUAIF_Data,
2068 stream<UdpAppMeta> &soUAIF_Meta,
2069 stream<UdpAppDLen> &soUAIF_DLen,
2073 stream<UdpAppData> &siUAIF_Data,
2074 stream<UdpAppMeta> &siUAIF_Meta,
2075 stream<UdpAppDLen> &siUAIF_DLen,
2079 stream<AxisRaw> &soICMP_Data)
2083 #pragma HLS INTERFACE ap_ctrl_none port=return
2085 #pragma HLS INTERFACE ap_stable port=piMMIO_En name=piMMIO_En
2087 #pragma HLS INTERFACE axis register both port=soMMIO_DropCnt name=soMMIO_DropCnt
2088 #pragma HLS INTERFACE axis register both port=soMMIO_Ready name=soMMIO_Ready
2090 #pragma HLS INTERFACE axis off port=siIPRX_Data name=siIPRX_Data
2091 #pragma HLS INTERFACE axis register both port=soIPTX_Data name=soIPTX_Data
2093 #pragma HLS INTERFACE axis off port=siUAIF_LsnReq name=siUAIF_LsnReq
2094 #pragma HLS INTERFACE axis off port=soUAIF_LsnRep name=soUAIF_LsnRep
2095 #pragma HLS INTERFACE axis off port=siUAIF_ClsReq name=siUAIF_ClsReq
2096 #pragma HLS INTERFACE axis off port=soUAIF_ClsRep name=soUAIF_ClsRep
2098 #pragma HLS INTERFACE axis off port=soUAIF_Data name=soUAIF_Data
2099 #pragma HLS INTERFACE axis off port=soUAIF_Meta name=soUAIF_Meta
2100 #pragma HLS DATA_PACK variable=soUAIF_Meta instance=soUAIF_Meta
2101 #pragma HLS INTERFACE axis off port=soUAIF_DLen name=soUAIF_DLen
2103 #pragma HLS INTERFACE axis off port=siUAIF_Data name=siUAIF_Data
2104 #pragma HLS INTERFACE axis off port=siUAIF_Meta name=siUAIF_Meta
2105 #pragma HLS DATA_PACK variable=siUAIF_Meta instance=siUAIF_Meta
2106 #pragma HLS INTERFACE axis off port=siUAIF_DLen name=siUAIF_DLen
2108 #pragma HLS INTERFACE axis register both port=soICMP_Data name=soICMP_Data
2111 #pragma HLS DATAFLOW disable_start_propagation
2114 static stream<AxisIp4> ssiIPRX_Data;
2115 #pragma HLS STREAM variable=ssiIPRX_Data depth=32
2116 static stream<AxisIp4> ssoIPTX_Data;
2117 static stream<AxisIcmp> ssoICMP_Data;
UdpLen getUdpLen(int Lo=0)
void setIp4FragOff(Ip4FragOff offset)
void setIp4Prot(Ip4Prot prot)
void setIp4HdrLen(Ip4HdrLen ihl)
Ip4TotalLen getIp4TotalLen()
void setIp4HdrCsum(Ip4HdrCsum csum)
void setUdpSrcPort(UdpPort port, int Lo=32)
void setIp4DstAddr(Ip4Addr addr)
void setIp4TotalLen(Ip4TotalLen len)
void setIp4Flags(Ip4Flags flags)
void setIp4Version(Ip4Version ver)
LE_Ip4Addr getLE_Ip4DstAddr()
void setIp4Ident(Ip4Ident id)
void setIp4ToS(Ip4ToS tos)
void setIp4SrcAddr(Ip4Addr addr)
void setIp4TtL(Ip4TtL ttl)
void setUdpDstPort(UdpPort port, int Lo=48)
void setUdpDstPort(UdpPort port)
void setPsd4Len(Ly4Len len)
void setPsd4DstAddr(Ip4Addr addr)
void setUdpLen(UdpLen len)
void setUdpCsum(UdpCsum csum)
void setPsd4Prot(Ip4Prot prot)
void setUdpSrcPort(UdpPort port)
void setPsd4SrcAddr(Ip4Addr addr)
void setTLast(tLast last)
void setTDataHi(tDataHalf halfData)
void setTDataLo(tDataHalf halfData)
tDataHalf getTDataLo() const
LE_tKeep getLE_TKeep(int leHi=64/8-1, int leLo=0) const
void setTKeepLo(tKeepHalf halfKeep)
tKeepHalf getTKeepHi() const
LE_tData getLE_TData(int leHi=64 -1, int leLo=0) const
void setTKeepHi(tKeepHalf halfKeep)
void setTKeep(tKeep keep)
LE_tDataHalf getLE_TDataHi() const
tKeep getTKeep(int leHi=64/8-1, int leLo=0) const
tDataHalf getTDataHi() const
tKeepHalf getTKeepLo() const
LE_tLast getLE_TLast() const
void setUdpSrcPort(UdpPort port)
void setUdpDstPort(UdpPort port)
void setUdpCsum(UdpCsum csum)
void setUdpLen(UdpLen length)
void pUdpChecksumAccumulator(stream< AxisPsd4 > &siTdh_Data, stream< UdpCsum > &soUha_Csum)
void pUdpPortTable(stream< StsBool > &soMMIO_Ready, stream< UdpPort > &siRph_PortStateReq, stream< StsBool > &soRph_PortStateRep, stream< UdpPort > &siUAIF_LsnReq, stream< StsBool > &soUAIF_LsnRep, stream< UdpPort > &siUAIF_ClsReq, stream< StsBool > &soUAIF_ClsRep)
void pRxEngine(CmdBit piMMIO_En, stream< StsBool > &soMMIO_Ready, stream< AxisIp4 > &siIPRX_Data, stream< UdpPort > &siUAIF_LsnReq, stream< StsBool > &soUAIF_LsnRep, stream< UdpPort > &siUAIF_ClsReq, stream< StsBool > &soUAIF_ClsRep, stream< UdpAppData > &soUAIF_Data, stream< UdpAppMeta > &soUAIF_Meta, stream< UdpAppDLen > &soUAIF_DLen, stream< AxisIcmp > &soICMP_Data, stream< ap_uint< 16 > > &soMMIO_DropCnt)
void pRxPacketHandler(stream< AxisUdp > &siUcc_UdpDgrm, stream< ValBool > &siUcc_CsumVal, stream< AxisIp4 > &siIhs_Ip4Hdr, stream< UdpPort > &soUpt_PortStateReq, stream< StsBool > &siUpt_PortStateRep, stream< UdpAppData > &soUAIF_Data, stream< UdpAppMeta > &soUAIF_Meta, stream< UdpAppDLen > &soUAIF_DLen, stream< AxisIcmp > &soICMP_Data)
void pUdpChecksumChecker(stream< AxisUdp > &siIhs_UdpDgrm, stream< UdpCsum > &siIhs_PsdHdrSum, stream< AxisUdp > &soRph_UdpDgrm, stream< ValBool > &soRph_CsumVal, stream< SigBit > &soIhs_ClearToSend)
void pIp4HeaderAdder(stream< AxisUdp > &siUha_Data, stream< IpAddrPair > &siUha_IpPair, stream< UdpLen > &siUha_UdpLen, stream< AxisIp4 > &soIPTX_Data)
void pTxApplicationInterface(CmdBit piMMIO_En, stream< UdpAppData > &siUAIF_Data, stream< UdpAppMeta > &siUAIF_Meta, stream< UdpAppDLen > &siUAIF_DLen, stream< UdpAppData > &soTdh_Data, stream< UdpAppMeta > &soTdh_Meta, stream< UdpAppDLen > &soTdh_DLen)
void uoe_top(CmdBit piMMIO_En, stream< ap_uint< 16 > > &soMMIO_DropCnt, stream< StsBool > &soMMIO_Ready, stream< AxisRaw > &siIPRX_Data, stream< AxisRaw > &soIPTX_Data, stream< UdpAppLsnReq > &siUAIF_LsnReq, stream< UdpAppLsnRep > &soUAIF_LsnRep, stream< UdpAppClsReq > &siUAIF_ClsReq, stream< UdpAppClsRep > &soUAIF_ClsRep, stream< UdpAppData > &soUAIF_Data, stream< UdpAppMeta > &soUAIF_Meta, stream< UdpAppDLen > &soUAIF_DLen, stream< UdpAppData > &siUAIF_Data, stream< UdpAppMeta > &siUAIF_Meta, stream< UdpAppDLen > &siUAIF_DLen, stream< AxisRaw > &soICMP_Data)
Top of UDP Offload Engine (UOE)
void uoe(CmdBit piMMIO_En, stream< ap_uint< 16 > > &soMMIO_DropCnt, stream< StsBool > &soMMIO_Ready, stream< AxisIp4 > &siIPRX_Data, stream< AxisIp4 > &soIPTX_Data, stream< UdpAppLsnReq > &siUAIF_LsnReq, stream< UdpAppLsnRep > &soUAIF_LsnRep, stream< UdpAppClsReq > &siUAIF_ClsReq, stream< UdpAppClsRep > &soUAIF_ClsRep, stream< UdpAppData > &soUAIF_Data, stream< UdpAppMeta > &soUAIF_Meta, stream< UdpAppDLen > &soUAIF_DLen, stream< UdpAppData > &siUAIF_Data, stream< UdpAppMeta > &siUAIF_Meta, stream< UdpAppDLen > &siUAIF_DLen, stream< AxisIcmp > &soICMP_Data)
Main process of the UDP Offload Engine (UOE).
void pTxEngine(CmdBit piMMIO_En, stream< UdpAppData > &siUAIF_Data, stream< UdpAppMeta > &siUAIF_Meta, stream< UdpAppDLen > &siUAIF_DLen, stream< AxisIp4 > &soIPTX_Data)
void pTxDatagramHandler(stream< UdpAppData > &siUAIF_Data, stream< UdpAppMeta > &siUAIF_Meta, stream< UdpAppDLen > &siUAIF_DLen, stream< UdpAppData > &soUha_Data, stream< UdpAppMeta > &soUha_Meta, stream< UdpAppDLen > &soUha_DLen, stream< AxisPsd4 > &soUca_Data)
void pUdpHeaderAdder(stream< UdpAppData > &siTdh_Data, stream< UdpAppDLen > &siTdh_DLen, stream< UdpAppMeta > &siTdh_Meta, stream< UdpCsum > &siUca_Csum, stream< AxisUdp > &soIha_Data, stream< IpAddrPair > &soIha_IpPair, stream< UdpLen > &soIha_UdpLen)
void pIpHeaderStripper(CmdBit piMMIO_En, stream< AxisIp4 > &siIPRX_Data, stream< AxisUdp > &soUcc_UdpDgrm, stream< UdpCsum > &soUcc_PsdHdrSum, stream< AxisIp4 > &soRph_Ip4Hdr, stream< SigBit > &siUcc_ClearToSend, stream< ap_uint< 16 > > &soMMIO_DropCnt)
void printAxisRaw(const char *callerName, AxisRaw chunk)
Prints an Axis raw data chunk (used for debugging).
void pAxisRawCast(hls::stream< TypeIn > &si, hls::stream< TypeOut > &so)
AxisRaw cast - Casts an AxisRaw stream to/from an AxisRaw derived class.
#define printInfo(callerName, format,...)
A macro to print an information message.
#define printWarn(callerName, format,...)
A macro to print a warning message.
#define concat3(firstCharConst, secondCharConst, thirdCharConst)
void printSockPair(const char *callerName, SocketPair sockPair)
Print a socket pair association.
ap_uint< 16 > byteSwap16(ap_uint< 16 > inputVector)
: UDP Offload Engine (UOE)