42 #include <hls_stream.h>
78 #define XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_BASE 0x200
79 #define XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_HIGH 0x3ff
80 #define XNAL_PIFMC_NAL_CTRLLINK_AXI_WIDTH_CTRLLINK_V 32
81 #define XNAL_PIFMC_NAL_CTRLLINK_AXI_DEPTH_CTRLLINK_V 96
82 #define NAL_CTRL_LINK_SIZE (XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_HIGH/4)
83 #define NAL_CTRL_LINK_CONFIG_START_ADDR (0x200/4)
84 #define NAL_CTRL_LINK_CONFIG_END_ADDR (0x23F/4)
85 #define NAL_CTRL_LINK_STATUS_START_ADDR (0x240/4)
86 #define NAL_CTRL_LINK_STATUS_END_ADDR (0x27F/4)
87 #define NAL_CTRL_LINK_MRT_START_ADDR (0x280/4)
88 #define NAL_CTRL_LINK_MRT_END_ADDR (0x37F/4)
94 #define MAX_MRT_SIZE 64
97 #include "../../FMC/src/fmc.hpp"
99 #include "../../../../../hls/network.hpp"
100 #include "../../network_utils.hpp"
102 #include "../../simulation_utils.hpp"
109 #ifndef __SYNTHESIS__
113 #define THIS_NAME "NAL"
115 #define TRACE_OFF 0x0000
116 #define TRACE_RDP 1 << 1
117 #define TRACE_WRP 1 << 2
118 #define TRACE_SAM 1 << 3
119 #define TRACE_LSN 1 << 4
120 #define TRACE_CON 1 << 5
121 #define TRACE_ALL 0xFFFF
123 #define DEBUG_LEVEL (TRACE_ALL)
138 #define DEFAULT_TX_PORT 2718
139 #define DEFAULT_RX_PORT 2718
186 #define MAX_NAL_SESSIONS (TOE_MAX_SESSIONS)
187 #define NAL_STREAMING_SPLIT_TCP (ZYC2_MSS)
190 #define NAL_MAX_FIFO_DEPTHS_BYTES 2000
191 #define NUMBER_CONFIG_WORDS 16
192 #define NUMBER_STATUS_WORDS 16
193 #define NAL_NUMBER_CONFIG_WORDS NUMBER_CONFIG_WORDS
194 #define NAL_NUMBER_STATUS_WORDS NUMBER_STATUS_WORDS
196 #define NAL_CONNECTION_TIMEOUT 160000000
197 #define NAL_TCP_RX_DATA_DELAY_CYCLES 80
199 #define NAL_MMIO_STABILIZE_TIME 150
201 #define UNUSED_TABLE_ENTRY_VALUE 0x111000
202 #define UNUSED_SESSION_ENTRY_VALUE 0xFFFE
203 #define INVALID_MRT_VALUE 0xFFFFF
215 #define NAL_CONFIG_OWN_RANK 0
216 #define NAL_CONFIG_MRT_VERSION 1
217 #define NAL_CONFIG_SAVED_UDP_PORTS 2
218 #define NAL_CONFIG_SAVED_TCP_PORTS 3
219 #define NAL_CONFIG_SAVED_FMC_PORTS 4
221 #define NAL_STATUS_MRT_VERSION 0
222 #define NAL_STATUS_OPEN_UDP_PORTS 1
223 #define NAL_STATUS_OPEN_TCP_PORTS 2
224 #define NAL_STATUS_FMC_PORT_PROCESSED 3
225 #define NAL_STATUS_OWN_RANK 13
229 #define NAL_UNAUTHORIZED_ACCESS 4
231 #define NAL_AUTHORIZED_ACCESS 5
233 #define NAL_STATUS_SEND_STATE 6
234 #define NAL_STATUS_RECEIVE_STATE 7
235 #define NAL_STATUS_GLOBAL_STATE 8
236 #define NAL_STATUS_LAST_RX_NODE_ID 9
237 #define NAL_STATUS_RX_NODEID_ERROR 10
238 #define NAL_STATUS_LAST_TX_NODE_ID 11
239 #define NAL_STATUS_TX_NODEID_ERROR 12
241 #define NAL_STATUS_PACKET_CNT_RX 14
242 #define NAL_STATUS_PACKET_CNT_TX 15
350 ap_uint<1> *piNTS_ready,
352 ap_uint<16> *piMMIO_FmcLsnPort,
353 ap_uint<32> *piMMIO_CfrmIp4Addr,
358 ap_uint<32> *pi_udp_rx_ports,
359 stream<NetworkWord> &siUdp_data,
360 stream<NetworkWord> &soUdp_data,
365 ap_uint<32> *pi_tcp_rx_ports,
366 stream<NetworkWord> &siTcp_data,
367 stream<NetworkMetaStream> &siTcp_meta,
368 stream<NetworkWord> &soTcp_data,
369 stream<NetworkMetaStream> &soTcp_meta,
372 stream<NetworkWord> &siFMC_data,
373 stream<TcpSessId> &siFMC_SessId,
374 stream<NetworkWord> &soFMC_data,
375 stream<TcpSessId> &soFMC_SessId,
378 stream<UdpPort> &soUOE_LsnReq,
379 stream<StsBool> &siUOE_LsnRep,
380 stream<UdpPort> &soUOE_ClsReq,
381 stream<StsBool> &siUOE_ClsRep,
384 stream<UdpAppData> &siUOE_Data,
385 stream<UdpAppMeta> &siUOE_Meta,
386 stream<UdpAppDLen> &siUOE_DLen,
389 stream<UdpAppData> &soUOE_Data,
390 stream<UdpAppMeta> &soUOE_Meta,
391 stream<UdpAppDLen> &soUOE_DLen,
394 stream<TcpAppNotif> &siTOE_Notif,
395 stream<TcpAppRdReq> &soTOE_DReq,
396 stream<TcpAppData> &siTOE_Data,
397 stream<TcpAppMeta> &siTOE_SessId,
399 stream<TcpAppLsnReq> &soTOE_LsnReq,
400 stream<TcpAppLsnRep> &siTOE_LsnRep,
402 stream<TcpAppData> &soTOE_Data,
403 stream<TcpAppSndReq> &soTOE_SndReq,
404 stream<TcpAppSndRep> &siTOE_SndRep,
406 stream<TcpAppOpnReq> &soTOE_OpnReq,
407 stream<TcpAppOpnRep> &siTOE_OpnRep,
409 stream<TcpAppClsReq> &soTOE_ClsReq
: A Content Address Memory (CAM) for 16 entries.
ap_uint< 1 > layer_7_enabled
ap_uint< 1 > layer_4_enabled
NalTriple newTriple(Ip4Addr ipRemoteAddres, TcpPort tcpRemotePort, TcpPort tcpLocalPort)
#define NUMBER_CONFIG_WORDS
#define NUMBER_STATUS_WORDS
stream< NetworkMetaStream > soUdp_meta("soUdp_meta")
uint8_t extractByteCnt(AxisRaw currWord)
TcpPort getLocalPortFromTriple(NalTriple triple)
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)
Ip4Addr getRemoteIpAddrFromTriple(NalTriple triple)
ap_uint< 32 > getRightmostBitPos(ap_uint< 32 > num)
TcpPort getRemotePortFromTriple(NalTriple triple)
ap_uint< 1 > role_decoupled
stream< NetworkMetaStream > siUdp_meta("siUdp_meta")
ap_uint< 32 > myIpAddress
ap_uint< 32 > ctrlLink[64+16+16]
: The Housekeeping Sub System (HSS) of the NAL core.
ap_uint< 16 > config_addr
ap_uint< 32 > update_value
NalConfigUpdate(ap_uint< 16 > ca, ap_uint< 32 > uv)
NalEventNotif(NalCntIncType nt, ap_uint< 32 > uv)
ap_uint< 32 > update_value
NalMrtUpdate(NodeId node, Ip4Addr addr)
NalNewTableEntry(NalTriple nt, SessionId sid)
NalNewTcpConRep(NalTriple nt, SessionId ns, bool fail)
NalPortUpdate(PortType pt, ap_uint< 32 > nv)
ap_uint< 16 > status_addr
NalStatusUpdate(ap_uint< 16 > sa, ap_uint< 32 > nv)
NalWaitingData(SessionId si, bool is_fmc)
: The TCP Sub System (TSS) of the NAL core.
: The UDP Sub System (USS) of the NAL core.