cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)

Network Abstraction Layer (NAL). The NAL separates the privileged management traffic from the unprivileged Role traffic. It also abstracts the details of port opening, connection handling and IP Address translation. The documentation of NAL is available at https://pages.github.ibm.com/cloudFPGA/Doc/pages/cfdk.html#network-abstraction-layer-nal. More...

Collaboration diagram for NAL:

Files

file  cam8.hpp
 : A Content Address Memory (CAM) for 16 entries.
 
file  cam8.hpp
 : A Content Address Memory (CAM) for 16 entries.
 
file  hss.cpp
 : The Housekeeping Sub System (HSS) of the NAL core.
 
file  hss.hpp
 : The Housekeeping Sub System (HSS) of the NAL core.
 
file  nal.hpp
 : The cloudFPGA Network Abstraction Layer (NAL) between NTS and ROlE. The NAL core manages the NTS Stack and maps the network streams to the user's ROLE or the FMC while hiding some complexity of UOE and TOE.
 
file  nal.hpp
 : The cloudFPGA Network Abstraction Layer (NAL) between NTS and ROlE. The NAL core manages the NTS Stack and maps the network streams to the user's ROLE or the FMC while hiding some complexity of UOE and TOE.
 
file  tss.cpp
 : The TCP Sub System (TSS) of the NAL core.
 
file  tss.hpp
 : The TCP Sub System (TSS) of the NAL core.
 
file  uss.cpp
 : The UDP Sub System (USS) of the NAL core.
 
file  uss.hpp
 : The UDP Sub System (USS) of the NAL core.
 

Classes

class  KeyValuePair< K, V >
 
struct  Cam16< K, V >
 
struct  Cam8< K, V >
 
struct  NalEventNotif
 
struct  NalNewTableEntry
 
struct  NalNewTcpConRep
 
struct  NalConfigUpdate
 
struct  NalMrtUpdate
 
struct  NalStatusUpdate
 
struct  NalPortUpdate
 
struct  NalWaitingData
 

Macros

#define _NAL_KVP_DEF_
 
#define _NAL_KVP_DEF_
 
#define XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_BASE   0x200
 
#define XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_HIGH   0x3ff
 
#define XNAL_PIFMC_NAL_CTRLLINK_AXI_WIDTH_CTRLLINK_V   32
 
#define XNAL_PIFMC_NAL_CTRLLINK_AXI_DEPTH_CTRLLINK_V   96
 
#define NAL_CTRL_LINK_SIZE   (XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_HIGH/4)
 
#define NAL_CTRL_LINK_CONFIG_START_ADDR   (0x200/4)
 
#define NAL_CTRL_LINK_CONFIG_END_ADDR   (0x23F/4)
 
#define NAL_CTRL_LINK_STATUS_START_ADDR   (0x240/4)
 
#define NAL_CTRL_LINK_STATUS_END_ADDR   (0x27F/4)
 
#define NAL_CTRL_LINK_MRT_START_ADDR   (0x280/4)
 
#define NAL_CTRL_LINK_MRT_END_ADDR   (0x37F/4)
 
#define MAX_MRT_SIZE   64
 
#define THIS_NAME   "NAL"
 
#define TRACE_OFF   0x0000
 
#define TRACE_RDP   1 << 1
 
#define TRACE_WRP   1 << 2
 
#define TRACE_SAM   1 << 3
 
#define TRACE_LSN   1 << 4
 
#define TRACE_CON   1 << 5
 
#define TRACE_ALL   0xFFFF
 
#define DEBUG_LEVEL   (TRACE_ALL)
 
#define DEFAULT_TX_PORT   2718
 
#define DEFAULT_RX_PORT   2718
 
#define MAX_NAL_SESSIONS   (TOE_MAX_SESSIONS)
 
#define NAL_STREAMING_SPLIT_TCP   (ZYC2_MSS)
 
#define NAL_MAX_FIFO_DEPTHS_BYTES   2000
 
#define NUMBER_CONFIG_WORDS   16
 
#define NUMBER_STATUS_WORDS   16
 
#define NAL_NUMBER_CONFIG_WORDS   NUMBER_CONFIG_WORDS
 
#define NAL_NUMBER_STATUS_WORDS   NUMBER_STATUS_WORDS
 
#define NAL_CONNECTION_TIMEOUT   160000000
 
#define NAL_TCP_RX_DATA_DELAY_CYCLES   80
 
#define NAL_MMIO_STABILIZE_TIME   150
 
#define UNUSED_TABLE_ENTRY_VALUE   0x111000
 
#define UNUSED_SESSION_ENTRY_VALUE   0xFFFE
 
#define INVALID_MRT_VALUE   0xFFFFF
 
#define NAL_CONFIG_OWN_RANK   0
 
#define NAL_CONFIG_MRT_VERSION   1
 
#define NAL_CONFIG_SAVED_UDP_PORTS   2
 
#define NAL_CONFIG_SAVED_TCP_PORTS   3
 
#define NAL_CONFIG_SAVED_FMC_PORTS   4
 
#define NAL_STATUS_MRT_VERSION   0
 
#define NAL_STATUS_OPEN_UDP_PORTS   1
 
#define NAL_STATUS_OPEN_TCP_PORTS   2
 
#define NAL_STATUS_FMC_PORT_PROCESSED   3
 
#define NAL_STATUS_OWN_RANK   13
 
#define NAL_UNAUTHORIZED_ACCESS   4
 
#define NAL_AUTHORIZED_ACCESS   5
 
#define NAL_STATUS_SEND_STATE   6
 
#define NAL_STATUS_RECEIVE_STATE   7
 
#define NAL_STATUS_GLOBAL_STATE   8
 
#define NAL_STATUS_LAST_RX_NODE_ID   9
 
#define NAL_STATUS_RX_NODEID_ERROR   10
 
#define NAL_STATUS_LAST_TX_NODE_ID   11
 
#define NAL_STATUS_TX_NODEID_ERROR   12
 
#define NAL_STATUS_PACKET_CNT_RX   14
 
#define NAL_STATUS_PACKET_CNT_TX   15
 
#define VALID   true
 
#define UNVALID   false
 
#define DEBUG_TRACE   true
 
#define THIS_NAME   "TB"
 
#define TRACE_OFF   0x0000
 
#define TRACE_TOE   1 << 1
 
#define TRACE_ROLE   1 << 2
 
#define TRACE_ALL   0xFFFF
 
#define DEBUG_LEVEL   (TRACE_TOE | TRACE_ROLE)
 
#define MAX_SIM_CYCLES   450
 
#define DEFAULT_FPGA_IP4_ADDR   0x0A0CC801
 
#define DEFAULT_FPGA_LSN_PORT   0x0057
 
#define DEFAULT_HOST_IP4_ADDR   0x0A0CC832
 
#define DEFAULT_HOST_LSN_PORT   0x80
 
#define DEFAULT_SESSION_ID   42
 
#define DEFAULT_SESSION_LEN   32
 
#define DEFAULT_TCP_LEN_REP   16
 

Typedefs

typedef bool StsBool
 
typedef ap_uint< 16 > UdpSrcPort
 
typedef ap_uint< 16 > UdpDstPort
 
typedef ap_uint< 16 > UdpPort
 
typedef ap_uint< 16 > UdpLen
 
typedef UdpLen UdpAppDLen
 
typedef UdpAppDLen UdpPLen
 
typedef ap_uint< 16 > PacketLen
 
typedef ap_uint< 64 > NalTriple
 

Enumerations

enum  DropCmd { KEEP_CMD =false , DROP_CMD , KEEP_CMD =false , DROP_CMD }
 
enum  FsmStateUdp {
  FSM_RESET = 0 , FSM_W8FORMETA , FSM_W8FORREQS , FSM_FIRST_ACC ,
  FSM_ACC , FSM_WRITE_META , FSM_DROP_PACKET
}
 
enum  OpnFsmStates { OPN_IDLE = 0 , OPN_REQ , OPN_REP , OPN_DONE }
 
enum  LsnFsmStates { LSN_IDLE = 0 , LSN_SEND_REQ , LSN_WAIT_ACK , LSN_DONE }
 
enum  RrhFsmStates {
  RRH_RESET = 0 , RRH_WAIT_NOTIF , RRH_PROCESS_NOTIF , RRH_START_REQUEST ,
  RRH_PROCESS_REQUEST , RRH_WAIT_FMC , RRH_WAIT_ROLE , RRH_DRAIN
}
 
enum  RrhEnqFsmStates { RRH_ENQ_RESET = 0 , RRH_ENQ_STREAM }
 
enum  RdpFsmStates {
  RDP_RESET = 0 , RDP_WAIT_META , RDP_W8FORREQS_1 , RDP_W8FORREQS_2 ,
  RDP_FILTER_META , RDP_STREAM_ROLE , RDP_STREAM_FMC , RDP_WRITE_META_ROLE ,
  RDP_WRITE_META_FMC , RDP_DROP_PACKET
}
 
enum  WrpFsmStates {
  WRP_RESET = 0 , WRP_WAIT_META , WRP_STREAM_FMC , WRP_W8FORREQS_1 ,
  WRP_W8FORREQS_11 , WRP_W8FORREQS_2 , WRP_W8FORREQS_22 , WRP_WAIT_CONNECTION ,
  WRP_STREAM_ROLE , WRP_DROP_PACKET
}
 
enum  WbuFsmStates {
  WBU_WAIT_META = 0 , WBU_SND_REQ , WBU_WAIT_REP , WBU_STREAM ,
  WBU_DROP , WBU_DRAIN
}
 
enum  CacheInvalFsmStates {
  CACHE_WAIT_FOR_VALID = 0 , CACHE_VALID , CACHE_INV_SEND_0 , CACHE_INV_SEND_1 ,
  CACHE_INV_SEND_2 , CACHE_INV_SEND_3
}
 
enum  ClsFsmStates { CLS_IDLE = 0 , CLS_NEXT , CLS_WAIT4RESP }
 
enum  DeqFsmStates { DEQ_WAIT_META = 0 , DEQ_STREAM_DATA , DEQ_SEND_NOTIF }
 
enum  TableFsmStates { TAB_FSM_READ = 0 , TAB_FSM_WRITE }
 
enum  AxiLiteFsmStates {
  A4L_RESET = 0 , A4L_STATUS_UPDATE , A4L_COPY_CONFIG , A4L_COPY_CONFIG_2 ,
  A4L_COPY_MRT , A4L_COPY_STATUS , A4L_COPY_FINISH , A4L_WAIT_FOR_SUB_FSMS
}
 
enum  ConfigBcastStates {
  CB_WAIT = 0 , CB_START , CB_1 , CB_2 ,
  CB_3_0 , CB_3_1 , CB_3_2
}
 
enum  PortFsmStates {
  PORT_RESET = 0 , PORT_IDLE , PORT_L4_RESET , PORT_NEW_UDP_REQ ,
  PORT_NEW_UDP_REP , PORT_NEW_FMC_REQ , PORT_NEW_FMC_REP , PORT_NEW_TCP_REQ ,
  PORT_NEW_TCP_REP , PORT_L7_RESET , PORT_WAIT_PR , PORT_START_TCP_CLS_0 ,
  PORT_START_TCP_CLS_1 , PORT_START_TCP_CLS_2 , PORT_START_UDP_CLS , PORT_SEND_UPDATE
}
 
enum  PortType { FMC = 0 , UDP , TCP }
 
enum  NalCntIncType {
  NID_MISS_RX = 0 , NID_MISS_TX , PCOR_TX , TCP_CON_FAIL ,
  LAST_RX_PORT , LAST_RX_NID , LAST_TX_PORT , LAST_TX_NID ,
  PACKET_RX , PACKET_TX , UNAUTH_ACCESS , AUTH_ACCESS ,
  FMC_TCP_BYTES
}
 
enum  RxFsmStates { RX_WAIT_META =0 , RX_STREAM }
 
enum  RoleFsmStates { ROLE_WAIT_META =0 , ROLE_STREAM }
 
enum  LsnStates { LSN_WAIT_REQ , LSN_SEND_ACK }
 
enum  OpnStates { OPN_WAIT_REQ , OPN_SEND_REP , OPN_TIMEOUT }
 
enum  RxpStates {
  RXP_SEND_NOTIF , RXP_WAIT_DREQ , RXP_SEND_META , RXP_SEND_DATA ,
  RXP_DONE
}
 
enum  TxpStates { TXP_WAIT_REQ , TXP_WAIT_DATA , TXP_RECV_DATA }
 

Functions

uint8_t selectConfigUpdatePropagation (uint16_t config_addr)
 
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 as writes the status values. It notifies all other concerned processes on MRT or configuration updates and is notified on status updates. More...
 
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. More...
 
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) to absolute port numbers If the input vector changes, or during a reset of the Role, the necessary open or close requests are send to pUdpLsn, pUdpCls, pTcpLsn, and pTcpCls. More...
 
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 processes. More...
 
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. More...
 
ap_uint< 32 > getRightmostBitPos (ap_uint< 32 > num)
 
NalTriple newTriple (Ip4Addr ipRemoteAddres, TcpPort tcpRemotePort, TcpPort tcpLocalPort)
 
Ip4Addr getRemoteIpAddrFromTriple (NalTriple triple)
 
TcpPort getRemotePortFromTriple (NalTriple triple)
 
TcpPort getLocalPortFromTriple (NalTriple triple)
 
uint8_t extractByteCnt (AxisRaw currWord)
 
uint8_t extractByteCnt (NetworkWord currWord)
 
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 Axi4Lite address space. Forwards status changes to Axi4Lite processing. More...
 
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. More...
 
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) More...
 
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 (.i.e open connection for reception mode). More...
 
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. More...
 
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 ROLE or FMC. More...
 
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 it to ROLE or FMC. Invalid packets are dropped. More...
 
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. More...
 
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. More...
 
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 forwards it to TOE. More...
 
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 space). In case of streaming mode (i.e. ROLE's length was 0), WRp takes care of splitting the data and writing the right len. More...
 
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). More...
 
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. More...
 
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). More...
 
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. More...
 
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. More...
 
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 ). More...
 
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. More...
 
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. More...
 
stream< UdpPortsNRC_UOE_LsnReq ("sNRC_UOE_LsnReq")
 
stream< StsBoolsUOE_NRC_LsnRep ("sUOE_NRC_LsnRep")
 
stream< UdpPortsNRC_UOE_ClsReq ("sNRC_UOE_ClsReq")
 
stream< StsBoolsUOE_NRC_ClsRep ("sUOE_NRC_ClsRep")
 
stream< UdpAppDatasUOE_NRC_Data ("sUOE_NRC_Data")
 
stream< UdpAppMetasUOE_NRC_Meta ("sUOE_NRC_Meta")
 
stream< UdpAppDLensUOE_NRC_DLen ("sUOE_NRC_DLen")
 
stream< UdpAppDatasNRC_UOE_Data ("sNRC_UOE_Data")
 
stream< UdpAppMetasNRC_UOE_Meta ("sNRC_UOE_Meta")
 
stream< UdpAppDLensNRC_UOE_DLen ("sNRC_UOE_DLen")
 
stream< NetworkMetaStreamsiUdp_meta ("siUdp_meta")
 
stream< NetworkMetaStreamsoUdp_meta ("soUdp_meta")
 
stream< NetworkWordsROLE_NRC_Data ("sROLE_NRC_Data")
 
stream< NetworkWordsNRC_Role_Data ("sNRC_Role_Data")
 
stream< NetworkWordsROLE_Nrc_Tcp_data ("sROLE_Nrc_Tcp_data")
 
stream< NetworkMetaStreamsROLE_Nrc_Tcp_meta ("sROLE_Nrc_Tcp_meta")
 
stream< NetworkWordsNRC_Role_Tcp_data ("sNRC_Role_Tcp_data")
 
stream< NetworkMetaStreamsNRC_Role_Tcp_meta ("sNRC_Role_Tcp_meta")
 
stream< NetworkWordsFMC_Nrc_Tcp_data ("sFMC_Nrc_Tcp_data")
 
stream< TcpSessIdsFMC_Nrc_Tcp_sessId ("sFMC_Nrc_Tcp_sessId")
 
stream< NetworkWordsNRC_FMC_Tcp_data ("sNRC_FMC_Tcp_data")
 
stream< TcpSessIdsNRC_FMC_Tcp_sessId ("sNRC_FMC_Tcp_sessId")
 
stream< TcpAppNotifsTOE_Nrc_Notif ("sTOE_Nrc_Notif")
 
stream< TcpAppRdReqsNRC_Toe_DReq ("sNrc_TOE_DReq")
 
stream< TcpAppDatasTOE_Nrc_Data ("sTOE_Nrc_Data")
 
stream< TcpAppMetasTOE_Nrc_SessId ("sTOE_Nrc_SessId")
 
stream< TcpAppLsnReqsNRC_Toe_LsnReq ("sNRC_TOE_LsnReq")
 
stream< TcpAppLsnRepsTOE_Nrc_LsnAck ("sTOE_Nrc_LsnAck")
 
stream< TcpAppDatasNRC_Toe_Data ("sNRC_TOE_Data")
 
stream< TcpAppSndReqsNRC_Toe_SndReq ("sNRC_TOE_SndReq")
 
stream< TcpAppSndRepsTOE_Nrc_SndRep ("sTOE_NRC_SndRep")
 
stream< TcpAppOpnReqsNRC_Toe_OpnReq ("sNRC_Toe_OpnReq")
 
stream< TcpAppOpnRepsTOE_Nrc_OpnRep ("sTOE_NRC_OpenRep")
 
stream< TcpAppClsReqsNRC_Toe_ClsReq ("sNRC_TOE_ClsReq")
 
void stepDut ()
 Run a single iteration of the DUT model. More...
 
bool setInputDataStream (stream< UdpAppData > &sDataStream, const string dataStreamName, const string inpFileName)
 Initialize an input data stream from a file. More...
 
bool setInputDataStream (stream< NetworkWord > &sDataStream, const string dataStreamName, const string inpFileName)
 
bool setInputMetaStream (stream< UdpAppMeta > &sMetaStream, const string dataStreamName, const string inpFileName)
 Initialize an input meta stream from a file. More...
 
bool readDataStream (stream< UdpAppData > &sDataStream, UdpAppData *udpWord)
 Read data from a stream. More...
 
bool readMetaStream (stream< UdpAppMeta > &sMetaStream, const string metaStreamName, UdpAppMeta *udpMeta)
 Read an output metadata stream from the DUT. More...
 
bool readPLenStream (stream< UdpPLen > &sPLenStream, const string plenStreamName, UdpPLen *udpPLen)
 Read an output payload length stream from the DUT. More...
 
bool dumpDataToFile (UdpAppData *udpWord, ofstream &outFileStream)
 Dump a data word to a file. More...
 
bool dumpDataToFile (NetworkWord *udpWord, ofstream &outFileStream)
 
bool dumpMetaToFile (UdpAppMeta *udpMeta, ofstream &outFileStream)
 Dump a metadata information to a file. More...
 
bool dumpPLenToFile (UdpPLen *udpPLen, ofstream &outFileStream)
 Dump a payload length information to a file. More...
 
bool getOutputDataStream (stream< UdpAppData > &sDataStream, const string dataStreamName, const string outFileName)
 Fill an output file with data from an output stream. More...
 
bool getOutputDataStream (stream< NetworkWord > &sDataStream, const string dataStreamName, const string outFileName)
 
bool getOutputMetaStream (stream< UdpAppMeta > &sMetaStream, const string metaStreamName, const string outFileName)
 Fill an output file with metadata from an output stream. More...
 
bool getOutputPLenStream (stream< UdpPLen > &sPLenStream, const string plenStreamName, const string outFileName)
 Fill an output file with payload length from an output stream. More...
 
void pFMC (stream< NetworkWord > &siTRIF_Data, stream< TcpSessId > &siTRIF_SessId, stream< NetworkWord > &soTRIF_Data, stream< TcpSessId > &soTRIF_SessId)
 Emulate the behavior of the FMC. More...
 
void pROLE (stream< NetworkWord > &siTRIF_Data, stream< NetworkMetaStream > &siTRIF_meta, stream< NetworkWord > &soTRIF_Data, stream< NetworkMetaStream > &soTRIF_meta)
 Emulate the behavior of the ROLE. More...
 
void pTOE (int &nrErr, stream< TcpAppNotif > &soTRIF_Notif, stream< TcpAppRdReq > &siTRIF_DReq, stream< TcpAppData > &soTRIF_Data, stream< TcpAppMeta > &soTRIF_SessId, stream< TcpAppLsnReq > &siTRIF_LsnReq, stream< TcpAppLsnRep > &soTRIF_LsnAck, stream< TcpAppData > &siTRIF_Data, stream< TcpAppSndReq > &siTRIF_SndReq, stream< TcpAppSndRep > &soTRIF_SndRep, stream< TcpAppOpnReq > &siTRIF_OpnReq, stream< TcpAppOpnRep > &soTRIF_OpnRep)
 
int main ()
 Main Testbench Loop; Emulates also the behavior of the UDP Offload Engine (UOE). More...
 

Variables

bool gTraceEvent
 
ap_uint< 1 > layer_4_enabled = 0b1
 
ap_uint< 1 > layer_7_enabled = 0b1
 
ap_uint< 1 > role_decoupled = 0b0
 
ap_uint< 1 > sNTS_Nrc_ready = 0b1
 
ap_uint< 32 > sIpAddress = 0x0a0b0c0d
 
ap_uint< 32 > ctrlLink [64+16+16]
 
ap_uint< 32 > s_udp_rx_ports = 0x1
 
ap_uint< 32 > s_tcp_rx_ports = 0x1
 
ap_uint< 32 > myIpAddress
 
ap_uint< 16 > sMMIO_FmcLsnPort = 8803
 
ap_uint< 32 > sMMIO_CfrmIp4Addr = 0x0A0CC832
 
unsigned int gSimCycCnt = 0
 
bool gTraceEvent = false
 
bool gFatalError = false
 
unsigned int simCnt
 
int tcp_packets_send = 0
 
int tcp_packets_recv = 0
 
int tcp_recv_frag_cnt = 0
 
int tcp_packets_expected_timeout = 0
 
int tcp_timout_packet_drop = 0
 
enum RxFsmStates rxFsmState = RX_WAIT_META
 
enum RoleFsmStates roleFsmState = ROLE_WAIT_META
 
Ip4Addr hostIp4Addr = 0
 Emulate the behavior of the TCP Offload Engine (TOE). More...
 
TcpPort fpgaLsnPort = -1
 
TcpPort hostSrcPort = 80
 
int loop = 1
 
enum LsnStates lsnState = LSN_WAIT_REQ
 
enum OpnStates opnState = OPN_WAIT_REQ
 
enum RxpStates rxpState = RXP_SEND_NOTIF
 
enum TxpStates txpState = TXP_WAIT_REQ
 
int opnStartupDelay = 0
 
int rxpStartupDelay = 100
 
int txpStartupDelay = 0
 
TcpAppRdReq appRdReq
 
AppMeta sessionId = 42
 
AppMeta sessionId_reply = 42
 
int byteCnt = 0
 
int segCnt = 0
 
int nrSegToSend = 3
 
ap_uint< 64 > data =0
 
TcpSegLen tcpSegLen = 32
 
const char * myLsnName = "NAL" "/" "TOE/Listen"
 
const char * myOpnName = "NAL" "/" "TOE/OpnCon"
 
const char * myRxpName = "NAL" "/" "TOE/RxPath"
 
const char * myTxpName = "NAL" "/" "TOE/TxPath"
 

Detailed Description

Network Abstraction Layer (NAL). The NAL separates the privileged management traffic from the unprivileged Role traffic. It also abstracts the details of port opening, connection handling and IP Address translation. The documentation of NAL is available at https://pages.github.ibm.com/cloudFPGA/Doc/pages/cfdk.html#network-abstraction-layer-nal.

Macro Definition Documentation

◆ _NAL_KVP_DEF_ [1/2]

#define _NAL_KVP_DEF_

Definition at line 40 of file cam16.hpp.

◆ _NAL_KVP_DEF_ [2/2]

#define _NAL_KVP_DEF_

Definition at line 39 of file cam8.hpp.

◆ DEBUG_LEVEL [1/2]

#define DEBUG_LEVEL   (TRACE_ALL)

Definition at line 123 of file nal.hpp.

◆ DEBUG_LEVEL [2/2]

#define DEBUG_LEVEL   (TRACE_TOE | TRACE_ROLE)

Definition at line 58 of file tb_nal.cpp.

◆ DEBUG_TRACE

#define DEBUG_TRACE   true

Definition at line 45 of file tb_nal.cpp.

◆ DEFAULT_FPGA_IP4_ADDR

#define DEFAULT_FPGA_IP4_ADDR   0x0A0CC801

Definition at line 70 of file tb_nal.cpp.

◆ DEFAULT_FPGA_LSN_PORT

#define DEFAULT_FPGA_LSN_PORT   0x0057

Definition at line 71 of file tb_nal.cpp.

◆ DEFAULT_HOST_IP4_ADDR

#define DEFAULT_HOST_IP4_ADDR   0x0A0CC832

Definition at line 72 of file tb_nal.cpp.

◆ DEFAULT_HOST_LSN_PORT

#define DEFAULT_HOST_LSN_PORT   0x80

Definition at line 73 of file tb_nal.cpp.

◆ DEFAULT_RX_PORT

#define DEFAULT_RX_PORT   2718

Definition at line 139 of file nal.hpp.

◆ DEFAULT_SESSION_ID

#define DEFAULT_SESSION_ID   42

Definition at line 75 of file tb_nal.cpp.

◆ DEFAULT_SESSION_LEN

#define DEFAULT_SESSION_LEN   32

Definition at line 76 of file tb_nal.cpp.

◆ DEFAULT_TCP_LEN_REP

#define DEFAULT_TCP_LEN_REP   16

Definition at line 79 of file tb_nal.cpp.

◆ DEFAULT_TX_PORT

#define DEFAULT_TX_PORT   2718

Definition at line 138 of file nal.hpp.

◆ INVALID_MRT_VALUE

#define INVALID_MRT_VALUE   0xFFFFF

Definition at line 203 of file nal.hpp.

◆ MAX_MRT_SIZE

#define MAX_MRT_SIZE   64

Definition at line 94 of file nal.hpp.

◆ MAX_NAL_SESSIONS

#define MAX_NAL_SESSIONS   (TOE_MAX_SESSIONS)

Definition at line 186 of file nal.hpp.

◆ MAX_SIM_CYCLES

#define MAX_SIM_CYCLES   450

Definition at line 63 of file tb_nal.cpp.

◆ NAL_AUTHORIZED_ACCESS

#define NAL_AUTHORIZED_ACCESS   5

Definition at line 231 of file nal.hpp.

◆ NAL_CONFIG_MRT_VERSION

#define NAL_CONFIG_MRT_VERSION   1

Definition at line 216 of file nal.hpp.

◆ NAL_CONFIG_OWN_RANK

#define NAL_CONFIG_OWN_RANK   0

Definition at line 215 of file nal.hpp.

◆ NAL_CONFIG_SAVED_FMC_PORTS

#define NAL_CONFIG_SAVED_FMC_PORTS   4

Definition at line 219 of file nal.hpp.

◆ NAL_CONFIG_SAVED_TCP_PORTS

#define NAL_CONFIG_SAVED_TCP_PORTS   3

Definition at line 218 of file nal.hpp.

◆ NAL_CONFIG_SAVED_UDP_PORTS

#define NAL_CONFIG_SAVED_UDP_PORTS   2

Definition at line 217 of file nal.hpp.

◆ NAL_CONNECTION_TIMEOUT

#define NAL_CONNECTION_TIMEOUT   160000000

Definition at line 196 of file nal.hpp.

◆ NAL_CTRL_LINK_CONFIG_END_ADDR

#define NAL_CTRL_LINK_CONFIG_END_ADDR   (0x23F/4)

Definition at line 84 of file nal.hpp.

◆ NAL_CTRL_LINK_CONFIG_START_ADDR

#define NAL_CTRL_LINK_CONFIG_START_ADDR   (0x200/4)

Definition at line 83 of file nal.hpp.

◆ NAL_CTRL_LINK_MRT_END_ADDR

#define NAL_CTRL_LINK_MRT_END_ADDR   (0x37F/4)

Definition at line 88 of file nal.hpp.

◆ NAL_CTRL_LINK_MRT_START_ADDR

#define NAL_CTRL_LINK_MRT_START_ADDR   (0x280/4)

Definition at line 87 of file nal.hpp.

◆ NAL_CTRL_LINK_SIZE

#define NAL_CTRL_LINK_SIZE   (XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_HIGH/4)

Definition at line 82 of file nal.hpp.

◆ NAL_CTRL_LINK_STATUS_END_ADDR

#define NAL_CTRL_LINK_STATUS_END_ADDR   (0x27F/4)

Definition at line 86 of file nal.hpp.

◆ NAL_CTRL_LINK_STATUS_START_ADDR

#define NAL_CTRL_LINK_STATUS_START_ADDR   (0x240/4)

Definition at line 85 of file nal.hpp.

◆ NAL_MAX_FIFO_DEPTHS_BYTES

#define NAL_MAX_FIFO_DEPTHS_BYTES   2000

Definition at line 190 of file nal.hpp.

◆ NAL_MMIO_STABILIZE_TIME

#define NAL_MMIO_STABILIZE_TIME   150

Definition at line 199 of file nal.hpp.

◆ NAL_NUMBER_CONFIG_WORDS

#define NAL_NUMBER_CONFIG_WORDS   NUMBER_CONFIG_WORDS

Definition at line 193 of file nal.hpp.

◆ NAL_NUMBER_STATUS_WORDS

#define NAL_NUMBER_STATUS_WORDS   NUMBER_STATUS_WORDS

Definition at line 194 of file nal.hpp.

◆ NAL_STATUS_FMC_PORT_PROCESSED

#define NAL_STATUS_FMC_PORT_PROCESSED   3

Definition at line 224 of file nal.hpp.

◆ NAL_STATUS_GLOBAL_STATE

#define NAL_STATUS_GLOBAL_STATE   8

Definition at line 235 of file nal.hpp.

◆ NAL_STATUS_LAST_RX_NODE_ID

#define NAL_STATUS_LAST_RX_NODE_ID   9

Definition at line 236 of file nal.hpp.

◆ NAL_STATUS_LAST_TX_NODE_ID

#define NAL_STATUS_LAST_TX_NODE_ID   11

Definition at line 238 of file nal.hpp.

◆ NAL_STATUS_MRT_VERSION

#define NAL_STATUS_MRT_VERSION   0

Definition at line 221 of file nal.hpp.

◆ NAL_STATUS_OPEN_TCP_PORTS

#define NAL_STATUS_OPEN_TCP_PORTS   2

Definition at line 223 of file nal.hpp.

◆ NAL_STATUS_OPEN_UDP_PORTS

#define NAL_STATUS_OPEN_UDP_PORTS   1

Definition at line 222 of file nal.hpp.

◆ NAL_STATUS_OWN_RANK

#define NAL_STATUS_OWN_RANK   13

Definition at line 225 of file nal.hpp.

◆ NAL_STATUS_PACKET_CNT_RX

#define NAL_STATUS_PACKET_CNT_RX   14

Definition at line 241 of file nal.hpp.

◆ NAL_STATUS_PACKET_CNT_TX

#define NAL_STATUS_PACKET_CNT_TX   15

Definition at line 242 of file nal.hpp.

◆ NAL_STATUS_RECEIVE_STATE

#define NAL_STATUS_RECEIVE_STATE   7

Definition at line 234 of file nal.hpp.

◆ NAL_STATUS_RX_NODEID_ERROR

#define NAL_STATUS_RX_NODEID_ERROR   10

Definition at line 237 of file nal.hpp.

◆ NAL_STATUS_SEND_STATE

#define NAL_STATUS_SEND_STATE   6

Definition at line 233 of file nal.hpp.

◆ NAL_STATUS_TX_NODEID_ERROR

#define NAL_STATUS_TX_NODEID_ERROR   12

Definition at line 239 of file nal.hpp.

◆ NAL_STREAMING_SPLIT_TCP

#define NAL_STREAMING_SPLIT_TCP   (ZYC2_MSS)

Definition at line 187 of file nal.hpp.

◆ NAL_TCP_RX_DATA_DELAY_CYCLES

#define NAL_TCP_RX_DATA_DELAY_CYCLES   80

Definition at line 197 of file nal.hpp.

◆ NAL_UNAUTHORIZED_ACCESS

#define NAL_UNAUTHORIZED_ACCESS   4

Definition at line 229 of file nal.hpp.

◆ NUMBER_CONFIG_WORDS

#define NUMBER_CONFIG_WORDS   16

Definition at line 191 of file nal.hpp.

◆ NUMBER_STATUS_WORDS

#define NUMBER_STATUS_WORDS   16

Definition at line 192 of file nal.hpp.

◆ THIS_NAME [1/2]

#define THIS_NAME   "NAL"

Definition at line 113 of file nal.hpp.

◆ THIS_NAME [2/2]

#define THIS_NAME   "TB"

Definition at line 51 of file tb_nal.cpp.

◆ TRACE_ALL [1/2]

#define TRACE_ALL   0xFFFF

Definition at line 121 of file nal.hpp.

◆ TRACE_ALL [2/2]

#define TRACE_ALL   0xFFFF

Definition at line 56 of file tb_nal.cpp.

◆ TRACE_CON

#define TRACE_CON   1 << 5

Definition at line 120 of file nal.hpp.

◆ TRACE_LSN

#define TRACE_LSN   1 << 4

Definition at line 119 of file nal.hpp.

◆ TRACE_OFF [1/2]

#define TRACE_OFF   0x0000

Definition at line 115 of file nal.hpp.

◆ TRACE_OFF [2/2]

#define TRACE_OFF   0x0000

Definition at line 53 of file tb_nal.cpp.

◆ TRACE_RDP

#define TRACE_RDP   1 << 1

Definition at line 116 of file nal.hpp.

◆ TRACE_ROLE

#define TRACE_ROLE   1 << 2

Definition at line 55 of file tb_nal.cpp.

◆ TRACE_SAM

#define TRACE_SAM   1 << 3

Definition at line 118 of file nal.hpp.

◆ TRACE_TOE

#define TRACE_TOE   1 << 1

Definition at line 54 of file tb_nal.cpp.

◆ TRACE_WRP

#define TRACE_WRP   1 << 2

Definition at line 117 of file nal.hpp.

◆ UNUSED_SESSION_ENTRY_VALUE

#define UNUSED_SESSION_ENTRY_VALUE   0xFFFE

Definition at line 202 of file nal.hpp.

◆ UNUSED_TABLE_ENTRY_VALUE

#define UNUSED_TABLE_ENTRY_VALUE   0x111000

Definition at line 201 of file nal.hpp.

◆ UNVALID

#define UNVALID   false

Definition at line 44 of file tb_nal.cpp.

◆ VALID

#define VALID   true

Definition at line 43 of file tb_nal.cpp.

◆ XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_BASE

#define XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_BASE   0x200

Definition at line 78 of file nal.hpp.

◆ XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_HIGH

#define XNAL_PIFMC_NAL_CTRLLINK_AXI_ADDR_CTRLLINK_V_HIGH   0x3ff

Definition at line 79 of file nal.hpp.

◆ XNAL_PIFMC_NAL_CTRLLINK_AXI_DEPTH_CTRLLINK_V

#define XNAL_PIFMC_NAL_CTRLLINK_AXI_DEPTH_CTRLLINK_V   96

Definition at line 81 of file nal.hpp.

◆ XNAL_PIFMC_NAL_CTRLLINK_AXI_WIDTH_CTRLLINK_V

#define XNAL_PIFMC_NAL_CTRLLINK_AXI_WIDTH_CTRLLINK_V   32

Definition at line 80 of file nal.hpp.

Typedef Documentation

◆ NalTriple

typedef ap_uint<64> NalTriple

Definition at line 273 of file nal.hpp.

◆ PacketLen

typedef ap_uint<16> PacketLen

Definition at line 260 of file nal.hpp.

◆ StsBool

typedef bool StsBool

Definition at line 246 of file nal.hpp.

◆ UdpAppDLen

typedef UdpLen UdpAppDLen

Definition at line 255 of file nal.hpp.

◆ UdpDstPort

typedef ap_uint<16> UdpDstPort

Definition at line 248 of file nal.hpp.

◆ UdpLen

typedef ap_uint<16> UdpLen

Definition at line 250 of file nal.hpp.

◆ UdpPLen

Definition at line 258 of file nal.hpp.

◆ UdpPort

typedef ap_uint<16> UdpPort

Definition at line 249 of file nal.hpp.

◆ UdpSrcPort

typedef ap_uint<16> UdpSrcPort

Definition at line 247 of file nal.hpp.

Enumeration Type Documentation

◆ AxiLiteFsmStates

Enumerator
A4L_RESET 
A4L_STATUS_UPDATE 
A4L_COPY_CONFIG 
A4L_COPY_CONFIG_2 
A4L_COPY_MRT 
A4L_COPY_STATUS 
A4L_COPY_FINISH 
A4L_WAIT_FOR_SUB_FSMS 

Definition at line 168 of file nal.hpp.

169  //A4L_BROADCAST_CONFIG_1, A4L_BROADCAST_CONFIG_2,
@ A4L_COPY_MRT
Definition: nal.hpp:170
@ A4L_COPY_STATUS
Definition: nal.hpp:170
@ A4L_WAIT_FOR_SUB_FSMS
Definition: nal.hpp:170
@ A4L_STATUS_UPDATE
Definition: nal.hpp:168
@ A4L_COPY_CONFIG_2
Definition: nal.hpp:168
@ A4L_RESET
Definition: nal.hpp:168
@ A4L_COPY_CONFIG
Definition: nal.hpp:168
@ A4L_COPY_FINISH
Definition: nal.hpp:170

◆ CacheInvalFsmStates

Enumerator
CACHE_WAIT_FOR_VALID 
CACHE_VALID 
CACHE_INV_SEND_0 
CACHE_INV_SEND_1 
CACHE_INV_SEND_2 
CACHE_INV_SEND_3 

Definition at line 160 of file nal.hpp.

@ CACHE_INV_SEND_1
Definition: nal.hpp:160
@ CACHE_INV_SEND_3
Definition: nal.hpp:160
@ CACHE_VALID
Definition: nal.hpp:160
@ CACHE_INV_SEND_2
Definition: nal.hpp:160
@ CACHE_INV_SEND_0
Definition: nal.hpp:160
@ CACHE_WAIT_FOR_VALID
Definition: nal.hpp:160

◆ ClsFsmStates

Enumerator
CLS_IDLE 
CLS_NEXT 
CLS_WAIT4RESP 

Definition at line 162 of file nal.hpp.

@ CLS_WAIT4RESP
Definition: nal.hpp:162
@ CLS_IDLE
Definition: nal.hpp:162
@ CLS_NEXT
Definition: nal.hpp:162

◆ ConfigBcastStates

Enumerator
CB_WAIT 
CB_START 
CB_1 
CB_2 
CB_3_0 
CB_3_1 
CB_3_2 

Definition at line 172 of file nal.hpp.

@ CB_3_1
Definition: nal.hpp:172
@ CB_START
Definition: nal.hpp:172
@ CB_3_0
Definition: nal.hpp:172
@ CB_3_2
Definition: nal.hpp:172
@ CB_1
Definition: nal.hpp:172
@ CB_WAIT
Definition: nal.hpp:172
@ CB_2
Definition: nal.hpp:172

◆ DeqFsmStates

Enumerator
DEQ_WAIT_META 
DEQ_STREAM_DATA 
DEQ_SEND_NOTIF 

Definition at line 164 of file nal.hpp.

@ DEQ_WAIT_META
Definition: nal.hpp:164
@ DEQ_STREAM_DATA
Definition: nal.hpp:164
@ DEQ_SEND_NOTIF
Definition: nal.hpp:164

◆ DropCmd

enum DropCmd
Enumerator
KEEP_CMD 
DROP_CMD 
KEEP_CMD 
DROP_CMD 

Definition at line 125 of file nal.hpp.

125 {KEEP_CMD=false, DROP_CMD};
@ KEEP_CMD
Definition: nal.hpp:125
@ DROP_CMD
Definition: nal.hpp:125

◆ FsmStateUdp

Enumerator
FSM_RESET 
FSM_W8FORMETA 
FSM_W8FORREQS 
FSM_FIRST_ACC 
FSM_ACC 
FSM_WRITE_META 
FSM_DROP_PACKET 

Definition at line 141 of file nal.hpp.

142  FSM_WRITE_META, FSM_DROP_PACKET};
@ FSM_RESET
Definition: nal.hpp:141
@ FSM_W8FORREQS
Definition: nal.hpp:141
@ FSM_W8FORMETA
Definition: nal.hpp:141
@ FSM_FIRST_ACC
Definition: nal.hpp:141
@ FSM_DROP_PACKET
Definition: nal.hpp:142
@ FSM_ACC
Definition: nal.hpp:141

◆ LsnFsmStates

Enumerator
LSN_IDLE 
LSN_SEND_REQ 
LSN_WAIT_ACK 
LSN_DONE 

Definition at line 146 of file nal.hpp.

@ LSN_IDLE
Definition: nal.hpp:146
@ LSN_SEND_REQ
Definition: nal.hpp:146
@ LSN_WAIT_ACK
Definition: nal.hpp:146
@ LSN_DONE
Definition: nal.hpp:146

◆ LsnStates

enum LsnStates
Enumerator
LSN_WAIT_REQ 
LSN_SEND_ACK 

Definition at line 816 of file tb_nal.cpp.

enum LsnStates lsnState
@ LSN_WAIT_REQ
Definition: tb_nal.cpp:816
@ LSN_SEND_ACK
Definition: tb_nal.cpp:816

◆ NalCntIncType

Enumerator
NID_MISS_RX 
NID_MISS_TX 
PCOR_TX 
TCP_CON_FAIL 
LAST_RX_PORT 
LAST_RX_NID 
LAST_TX_PORT 
LAST_TX_NID 
PACKET_RX 
PACKET_TX 
UNAUTH_ACCESS 
AUTH_ACCESS 
FMC_TCP_BYTES 

Definition at line 181 of file nal.hpp.

183  AUTH_ACCESS, FMC_TCP_BYTES};
@ 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
@ 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

◆ OpnFsmStates

Enumerator
OPN_IDLE 
OPN_REQ 
OPN_REP 
OPN_DONE 

Definition at line 144 of file nal.hpp.

@ OPN_DONE
Definition: nal.hpp:144
@ OPN_REP
Definition: nal.hpp:144
@ OPN_REQ
Definition: nal.hpp:144
@ OPN_IDLE
Definition: nal.hpp:144

◆ OpnStates

enum OpnStates
Enumerator
OPN_WAIT_REQ 
OPN_SEND_REP 
OPN_TIMEOUT 

Definition at line 817 of file tb_nal.cpp.

enum OpnStates opnState
@ OPN_SEND_REP
Definition: tb_nal.cpp:817
@ OPN_TIMEOUT
Definition: tb_nal.cpp:817
@ OPN_WAIT_REQ
Definition: tb_nal.cpp:817

◆ PortFsmStates

Enumerator
PORT_RESET 
PORT_IDLE 
PORT_L4_RESET 
PORT_NEW_UDP_REQ 
PORT_NEW_UDP_REP 
PORT_NEW_FMC_REQ 
PORT_NEW_FMC_REP 
PORT_NEW_TCP_REQ 
PORT_NEW_TCP_REP 
PORT_L7_RESET 
PORT_WAIT_PR 
PORT_START_TCP_CLS_0 
PORT_START_TCP_CLS_1 
PORT_START_TCP_CLS_2 
PORT_START_UDP_CLS 
PORT_SEND_UPDATE 

Definition at line 175 of file nal.hpp.

@ PORT_NEW_UDP_REP
Definition: nal.hpp:175
@ PORT_START_UDP_CLS
Definition: nal.hpp:177
@ PORT_L7_RESET
Definition: nal.hpp:176
@ PORT_START_TCP_CLS_1
Definition: nal.hpp:177
@ PORT_START_TCP_CLS_2
Definition: nal.hpp:177
@ PORT_NEW_FMC_REP
Definition: nal.hpp:176
@ PORT_NEW_TCP_REP
Definition: nal.hpp:176
@ PORT_NEW_UDP_REQ
Definition: nal.hpp:175
@ PORT_SEND_UPDATE
Definition: nal.hpp:177
@ PORT_RESET
Definition: nal.hpp:175
@ PORT_START_TCP_CLS_0
Definition: nal.hpp:177
@ PORT_L4_RESET
Definition: nal.hpp:175
@ PORT_IDLE
Definition: nal.hpp:175
@ PORT_NEW_TCP_REQ
Definition: nal.hpp:176

◆ PortType

enum PortType
Enumerator
FMC 
UDP 
TCP 

Definition at line 179 of file nal.hpp.

179 {FMC = 0, UDP, TCP};
@ TCP
Definition: nal.hpp:179
@ UDP
Definition: nal.hpp:179
@ FMC
Definition: nal.hpp:179

◆ RdpFsmStates

Enumerator
RDP_RESET 
RDP_WAIT_META 
RDP_W8FORREQS_1 
RDP_W8FORREQS_2 
RDP_FILTER_META 
RDP_STREAM_ROLE 
RDP_STREAM_FMC 
RDP_WRITE_META_ROLE 
RDP_WRITE_META_FMC 
RDP_DROP_PACKET 

Definition at line 152 of file nal.hpp.

153  RDP_WRITE_META_ROLE, RDP_WRITE_META_FMC, RDP_DROP_PACKET};
@ RDP_STREAM_FMC
Definition: nal.hpp:152
@ RDP_RESET
Definition: nal.hpp:152
@ RDP_WRITE_META_FMC
Definition: nal.hpp:153
@ RDP_STREAM_ROLE
Definition: nal.hpp:152
@ RDP_W8FORREQS_1
Definition: nal.hpp:152
@ RDP_DROP_PACKET
Definition: nal.hpp:153
@ RDP_WAIT_META
Definition: nal.hpp:152
@ RDP_W8FORREQS_2
Definition: nal.hpp:152
@ RDP_FILTER_META
Definition: nal.hpp:152

◆ RoleFsmStates

Enumerator
ROLE_WAIT_META 
ROLE_STREAM 

Definition at line 734 of file tb_nal.cpp.

enum RoleFsmStates roleFsmState
@ ROLE_STREAM
Definition: tb_nal.cpp:734
@ ROLE_WAIT_META
Definition: tb_nal.cpp:734

◆ RrhEnqFsmStates

Enumerator
RRH_ENQ_RESET 
RRH_ENQ_STREAM 

Definition at line 150 of file nal.hpp.

@ RRH_ENQ_STREAM
Definition: nal.hpp:150
@ RRH_ENQ_RESET
Definition: nal.hpp:150

◆ RrhFsmStates

Enumerator
RRH_RESET 
RRH_WAIT_NOTIF 
RRH_PROCESS_NOTIF 
RRH_START_REQUEST 
RRH_PROCESS_REQUEST 
RRH_WAIT_FMC 
RRH_WAIT_ROLE 
RRH_DRAIN 

Definition at line 148 of file nal.hpp.

@ RRH_DRAIN
Definition: nal.hpp:148
@ RRH_WAIT_FMC
Definition: nal.hpp:148
@ RRH_WAIT_NOTIF
Definition: nal.hpp:148
@ RRH_START_REQUEST
Definition: nal.hpp:148
@ RRH_PROCESS_NOTIF
Definition: nal.hpp:148
@ RRH_WAIT_ROLE
Definition: nal.hpp:148
@ RRH_RESET
Definition: nal.hpp:148
@ RRH_PROCESS_REQUEST
Definition: nal.hpp:148

◆ RxFsmStates

Enumerator
RX_WAIT_META 
RX_STREAM 

Definition at line 681 of file tb_nal.cpp.

enum RxFsmStates rxFsmState
@ RX_WAIT_META
Definition: tb_nal.cpp:681
@ RX_STREAM
Definition: tb_nal.cpp:681

◆ RxpStates

enum RxpStates
Enumerator
RXP_SEND_NOTIF 
RXP_WAIT_DREQ 
RXP_SEND_META 
RXP_SEND_DATA 
RXP_DONE 

Definition at line 818 of file tb_nal.cpp.

enum RxpStates rxpState
@ RXP_SEND_DATA
Definition: tb_nal.cpp:818
@ RXP_SEND_NOTIF
Definition: tb_nal.cpp:818
@ RXP_SEND_META
Definition: tb_nal.cpp:818
@ RXP_WAIT_DREQ
Definition: tb_nal.cpp:818
@ RXP_DONE
Definition: tb_nal.cpp:818

◆ TableFsmStates

Enumerator
TAB_FSM_READ 
TAB_FSM_WRITE 

Definition at line 166 of file nal.hpp.

@ TAB_FSM_READ
Definition: nal.hpp:166
@ TAB_FSM_WRITE
Definition: nal.hpp:166

◆ TxpStates

enum TxpStates
Enumerator
TXP_WAIT_REQ 
TXP_WAIT_DATA 
TXP_RECV_DATA 

Definition at line 819 of file tb_nal.cpp.

enum TxpStates txpState
@ TXP_RECV_DATA
Definition: tb_nal.cpp:819
@ TXP_WAIT_DATA
Definition: tb_nal.cpp:819
@ TXP_WAIT_REQ
Definition: tb_nal.cpp:819

◆ WbuFsmStates

Enumerator
WBU_WAIT_META 
WBU_SND_REQ 
WBU_WAIT_REP 
WBU_STREAM 
WBU_DROP 
WBU_DRAIN 

Definition at line 158 of file nal.hpp.

@ WBU_SND_REQ
Definition: nal.hpp:158
@ WBU_DRAIN
Definition: nal.hpp:158
@ WBU_DROP
Definition: nal.hpp:158
@ WBU_WAIT_META
Definition: nal.hpp:158
@ WBU_STREAM
Definition: nal.hpp:158
@ WBU_WAIT_REP
Definition: nal.hpp:158

◆ WrpFsmStates

Enumerator
WRP_RESET 
WRP_WAIT_META 
WRP_STREAM_FMC 
WRP_W8FORREQS_1 
WRP_W8FORREQS_11 
WRP_W8FORREQS_2 
WRP_W8FORREQS_22 
WRP_WAIT_CONNECTION 
WRP_STREAM_ROLE 
WRP_DROP_PACKET 

Definition at line 155 of file nal.hpp.

156  WRP_STREAM_ROLE, WRP_DROP_PACKET};
@ WRP_WAIT_CONNECTION
Definition: nal.hpp:155
@ WRP_WAIT_META
Definition: nal.hpp:155
@ WRP_W8FORREQS_2
Definition: nal.hpp:155
@ WRP_RESET
Definition: nal.hpp:155
@ WRP_W8FORREQS_11
Definition: nal.hpp:155
@ WRP_STREAM_FMC
Definition: nal.hpp:155
@ WRP_DROP_PACKET
Definition: nal.hpp:156
@ WRP_W8FORREQS_1
Definition: nal.hpp:155
@ WRP_W8FORREQS_22
Definition: nal.hpp:155

Function Documentation

◆ axi4liteProcessing()

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 as writes the status values. It notifies all other concerned processes on MRT or configuration updates and is notified on status updates.

Parameters
[in/out]ctrlLink, the Axi4Lite bus
[out]sToPortLogic,notificationof configuration changes
[out]sToUdpRx,notificationof configuration changes
[out]sToTcpRx,notificationof configuration changes
[out]sToStatusProc,notificationof configuration changes
[out]sMrtUpdate,notificationof MRT content changes
[out]mrt_version_update_0,notificationof MRT version change
[out]mrt_version_update_1,notificationof MRT version change
[in]sStatusUpdate,Satusupdate notification for Axi4Lite proc

Definition at line 79 of file hss.cpp.

92 {
93  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
94 #pragma HLS INLINE off
95  //no pipeline, isn't compatible to AXI4Lite bus
96 
97  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
98  static uint16_t tableCopyVariable = 0;
99  static bool tables_initialized = false;
100  static AxiLiteFsmStates a4lFsm = A4L_COPY_CONFIG; //start with config after reset
101  static ConfigBcastStates cbFsm = CB_WAIT;
102  static uint32_t processed_mrt_version = 0;
103  static ConfigBcastStates mbFsm = CB_WAIT;
104 
105 #pragma HLS reset variable=tableCopyVariable
106 #pragma HLS reset variable=tables_initialized
107 #pragma HLS reset variable=a4lFsm
108 #pragma HLS reset variable=cbFsm
109 #pragma HLS reset variable=processed_mrt_version
110 #pragma HLS reset variable=mbFsm
111 
112  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
113  static ap_uint<32> config[NUMBER_CONFIG_WORDS];
114  static ap_uint<32> status[NUMBER_STATUS_WORDS];
115 
116  static ap_uint<16> configProp = 0x0;
117  static NalConfigUpdate cu_toCB = NalConfigUpdate();
118  static ap_uint<32> new_word;
119 
120  static ap_uint<32> localMRT[MAX_MRT_SIZE];
121  //#pragma HLS RESOURCE variable=localMRT core=RAM_2P_BRAM
122  //#pragma HLS ARRAY_PARTITION variable=localMRT complete dim=1
123  //FIXME: maybe optimize and remove localMRT here (send updates when indicated by version?)
124 
125 
126  //#pragma HLS ARRAY_PARTITION variable=status cyclic factor=4 dim=1
127  //#pragma HLS ARRAY_PARTITION variable=config cyclic factor=4 dim=1
128 
129  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
131  uint32_t new_mrt_version;
132  ap_uint<32> new_ip4node;
133 
134 
135  if(!tables_initialized)
136  {
137  // ----- tables init -----
138  for(int i = 0; i < MAX_MRT_SIZE; i++)
139  {
140  //localMRT[i] = 0x0;
141  localMRT[i] = 0x1; //to force init of MRT agency
142  }
143  for(int i = 0; i < NUMBER_CONFIG_WORDS; i++)
144  {
145  config[i] = 0x0;
146  }
147  for(int i = 0; i < NUMBER_STATUS_WORDS; i++)
148  {
149  status[i] = 0x0;
150  }
151  tables_initialized = true;
152  } else {
153 
154  // ----- AXI4Lite Processing -----
155 
156  switch(a4lFsm)
157  {
158  default:
159  //case A4L_RESET:
160  // // ----- tables init -----
161  // for(int i = 0; i < MAX_MRT_SIZE; i++)
162  // {
163  // localMRT[i] = 0x0;
164  // }
165  // for(int i = 0; i < NUMBER_CONFIG_WORDS; i++)
166  // {
167  // config[i] = 0x0;
168  // }
169  // for(int i = 0; i < NUMBER_STATUS_WORDS; i++)
170  // {
171  // status[i] = 0x0;
172  // }
173  // tableCopyVariable = 0;
174  // a4lFsm = A4L_STATUS_UPDATE;
175  // break;
176  case A4L_STATUS_UPDATE:
177  if(!sStatusUpdate.empty())
178  {
179  // ----- apply updates -----
180  NalStatusUpdate su = sStatusUpdate.read();
181  status[su.status_addr] = su.new_value;
182  printf("[A4l] got status update for address %d with value %d\n", (int) su.status_addr, (int) su.new_value);
183  } else {
184  a4lFsm = A4L_COPY_CONFIG;
185  }
186  break;
187  case A4L_COPY_CONFIG:
188  //TODO: necessary? Or does this AXI4Lite anyways "in the background"?
189  //or do we need to copy it explicetly, but could do this also every ~2 seconds?
190 
191  //printf("[A4l] copy config %d\n", tableCopyVariable);
192  new_word = ctrlLink[tableCopyVariable];
193  if(new_word != config[tableCopyVariable])
194  {
195  configProp = selectConfigUpdatePropagation(tableCopyVariable);
196  cu = NalConfigUpdate(tableCopyVariable, new_word);
197  cbFsm = CB_START;
198  //config[tableCopyVariable] = new_word;
199  a4lFsm = A4L_COPY_CONFIG_2;
200  } else {
201  tableCopyVariable++;
202  if(tableCopyVariable >= NUMBER_CONFIG_WORDS)
203  {
204  tableCopyVariable = 0;
205  a4lFsm = A4L_COPY_MRT;
206  }
207  }
208  break;
209  case A4L_COPY_CONFIG_2:
210  printf("[A4l] waiting CB broadcast\n");
211  if(cbFsm == CB_WAIT)
212  {
213  config[tableCopyVariable] = new_word;
214  tableCopyVariable++;
215  if(tableCopyVariable >= NUMBER_CONFIG_WORDS)
216  {
217  tableCopyVariable = 0;
218  a4lFsm = A4L_COPY_MRT;
219  } else {
220  a4lFsm = A4L_COPY_CONFIG;
221  }
222  }
223  break;
224  case A4L_COPY_MRT:
225  //printf("[A4l] copy MRT %d\n", tableCopyVariable);
226  new_ip4node = ctrlLink[tableCopyVariable + NUMBER_CONFIG_WORDS + NUMBER_STATUS_WORDS];
227  if (new_ip4node != localMRT[tableCopyVariable])
228  {
229  NalMrtUpdate mu = NalMrtUpdate(tableCopyVariable, new_ip4node);
230  sMrtUpdate.write(mu);
231  localMRT[tableCopyVariable] = new_ip4node;
232  printf("[A4l] update MRT at %d with %d\n", tableCopyVariable, (int) new_ip4node);
233  NalMrtUpdate mrt_update = NalMrtUpdate(tableCopyVariable, new_ip4node);
234  sMrtUpdate.write(mrt_update);
235  }
236  tableCopyVariable++;
237  if(tableCopyVariable >= MAX_MRT_SIZE)
238  {
239  tableCopyVariable = 0;
240  a4lFsm = A4L_COPY_STATUS;
241  }
242  break;
243  case A4L_COPY_STATUS:
244  ctrlLink[NUMBER_CONFIG_WORDS + tableCopyVariable] = status[tableCopyVariable];
245  tableCopyVariable++;
246  if(tableCopyVariable >= NUMBER_STATUS_WORDS)
247  {
248  //tableCopyVariable = 0;
249  a4lFsm = A4L_COPY_FINISH;
250  }
251  break;
252  case A4L_COPY_FINISH:
253  tableCopyVariable = 0;
254  //acknowledge the processed version
255  new_mrt_version = (uint32_t) config[NAL_CONFIG_MRT_VERSION];
256  if(new_mrt_version != processed_mrt_version)
257  {
258  printf("\t\t\t[A4L:CtrlLink:Info] Acknowledged MRT version %d.\n", (int) new_mrt_version);
259  mbFsm = CB_START;
260  processed_mrt_version = new_mrt_version;
261  }
262  a4lFsm = A4L_WAIT_FOR_SUB_FSMS;
263  break;
265  printf("[A4l] SubFSMs state mb: %d; cb: %d\n", (int) mbFsm, (int) cbFsm);
266  if(mbFsm == CB_WAIT && cbFsm == CB_WAIT)
267  {
268  a4lFsm = A4L_STATUS_UPDATE;
269  printf("[A4l] SubFSMs done...continue\n");
270  }
271  break;
272  }
273 
274  // ----- Config Broadcast -----
275 
276  switch(cbFsm)
277  {
278  default:
279  case CB_WAIT:
280  //NOP
281  break;
282  case CB_START:
283  cu_toCB = cu;
284  switch (configProp) {
285  default:
286  case 0:
287  cbFsm = CB_WAIT; //currently not used
288  break;
289  case 1:
290  cbFsm = CB_1;
291  break;
292  case 2:
293  cbFsm = CB_2;
294  break;
295  case 3:
296  cbFsm = CB_3_0;
297  printf("[A4l] Issued rank update: %d\n", (int) cu.update_value);
298  break;
299  }
300  break;
301  case CB_1:
302  //(currently not used)
303  //if(!sToTcpAgency.full())
304  //{
305  // sToTcpAgency.write(cu_toCB);
306  cbFsm = CB_WAIT;
307  //}
308  break;
309  case CB_2:
310  if(!sToPortLogic.full())
311  {
312  sToPortLogic.write(cu_toCB);
313  cbFsm = CB_WAIT;
314  }
315  break;
316  case CB_3_0:
317  if(!sToUdpRx.full())
318  {
319  sToUdpRx.write(cu_toCB);
320  cbFsm = CB_3_1;
321  }
322  break;
323  case CB_3_1:
324  if(!sToTcpRx.full())
325  {
326  sToTcpRx.write(cu_toCB);
327  cbFsm = CB_3_2;
328  }
329  break;
330  case CB_3_2:
331  if(!sToStatusProc.full())
332  {
333  sToStatusProc.write(cu_toCB);
334  cbFsm = CB_WAIT;
335  }
336  break;
337  }
338 
339  // ----- MRT version broadcast ----
340 
341  switch(mbFsm)
342  {
343  default:
344  case CB_WAIT:
345  //NOP
346  break;
347  case CB_START:
348  mbFsm = CB_1;
349  printf("[A4l] Issued Mrt update: %d\n", (int) processed_mrt_version);
350  break;
351  case CB_1:
352  if(!mrt_version_update_0.full())
353  {
354  mrt_version_update_0.write(processed_mrt_version);
355  mbFsm = CB_2;
356  }
357  break;
358  case CB_2:
359  if(!mrt_version_update_1.full())
360  {
361  mrt_version_update_1.write(processed_mrt_version);
362  mbFsm = CB_WAIT;
363  }
364  break;
365  }
366 
367  } // else
368 
369 }
bool tables_initialized
Definition: fmc.cpp:156
#define NUMBER_CONFIG_WORDS
Definition: nal.hpp:191
ConfigBcastStates
Definition: nal.hpp:172
uint8_t selectConfigUpdatePropagation(uint16_t config_addr)
Definition: hss.cpp:45
AxiLiteFsmStates
Definition: nal.hpp:168
#define NUMBER_STATUS_WORDS
Definition: nal.hpp:192
#define MAX_MRT_SIZE
Definition: nal.hpp:94
#define NAL_CONFIG_MRT_VERSION
Definition: nal.hpp:216
ap_uint< 32 > ctrlLink[64+16+16]
Definition: tb_nal.cpp:137
ap_uint< 32 > update_value
Definition: nal.hpp:292
ap_uint< 16 > status_addr
Definition: nal.hpp:305
ap_uint< 32 > new_value
Definition: nal.hpp:306
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpDataToFile() [1/2]

bool dumpDataToFile ( NetworkWord udpWord,
ofstream &  outFileStream 
)

Definition at line 462 of file tb_nal.cpp.

462  {
463  if (!outFileStream.is_open()) {
464  printf("### ERROR : Output file stream is not open. \n");
465  return(KO);
466  }
467  outFileStream << hex << noshowbase << uppercase << setfill('0') << setw(16) << udpWord->tdata.to_uint64();
468  outFileStream << " ";
469  outFileStream << hex << noshowbase << nouppercase << setfill('0') << setw(2) << udpWord->tkeep.to_int();
470  outFileStream << " ";
471  outFileStream << setw(1) << udpWord->tlast.to_int() << "\n";
472  return(OK);
473 }
#define OK
Definition: nts_types.hpp:57
#define KO
Definition: nts_types.hpp:58
void uppercase(ap_uint< 32 > *pi_rank, ap_uint< 32 > *pi_size, stream< NetworkWord > &siSHL_This_Data, stream< NetworkWord > &soTHIS_Shl_Data, stream< NetworkMetaStream > &siNrc_meta, stream< NetworkMetaStream > &soNrc_meta, ap_uint< 32 > *po_rx_ports)
Main process of the Uppercase Application directives.
Definition: uppercase.cpp:335
ap_uint< 64 > tdata
Definition: network.hpp:49
ap_uint< 8 > tkeep
Definition: network.hpp:50
ap_uint< 1 > tlast
Definition: network.hpp:51
Here is the call graph for this function:

◆ dumpDataToFile() [2/2]

bool dumpDataToFile ( UdpAppData udpWord,
ofstream &  outFileStream 
)

Dump a data word to a file.

Parameters
[in]udpWord,apointer to the data word to dump.
[in]outFileStream,theoutput file stream to write to.
Returns
OK if successful, otherwise KO.

Definition at line 449 of file tb_nal.cpp.

449  {
450  if (!outFileStream.is_open()) {
451  printf("### ERROR : Output file stream is not open. \n");
452  return(KO);
453  }
454  outFileStream << hex << noshowbase << uppercase << setfill('0') << setw(16) << udpWord->getTData().to_uint64();
455  outFileStream << " ";
456  outFileStream << hex << noshowbase << nouppercase << setfill('0') << setw(2) << udpWord->getTKeep().to_int();
457  outFileStream << " ";
458  outFileStream << setw(1) << udpWord->getTLast().to_int() << "\n";
459  return(OK);
460 }
tData getTData(int leHi=64 -1, int leLo=0) const
Definition: AxisRaw.hpp:191
tLast getTLast() const
Definition: AxisRaw.hpp:219
tKeep getTKeep(int leHi=64/8-1, int leLo=0) const
Definition: AxisRaw.hpp:207
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpMetaToFile()

bool dumpMetaToFile ( UdpAppMeta udpMeta,
ofstream &  outFileStream 
)

Dump a metadata information to a file.

Parameters
[in]udpMeta,apointer to the metadata structure to dump.
[in]outFileStream,theoutput file stream to write to.
Returns
OK if successful, otherwise KO.

Definition at line 483 of file tb_nal.cpp.

483  {
484  if (!outFileStream.is_open()) {
485  printf("### ERROR : Output file stream is not open. \n");
486  return(KO);
487  }
488  outFileStream << hex << noshowbase << setfill('0') << setw(4) << udpMeta->udpSrcPort.to_int();
489  outFileStream << " ";
490  outFileStream << hex << noshowbase << setfill('0') << setw(8) << udpMeta->ip4SrcAddr.to_int();
491  outFileStream << " ";
492  outFileStream << hex << noshowbase << setfill('0') << setw(4) << udpMeta->udpDstPort.to_int();
493  outFileStream << " ";
494  outFileStream << hex << noshowbase << setfill('0') << setw(8) << udpMeta->ip4DstAddr.to_int();
495  outFileStream << "\n";
496  return(OK);
497 }
Ly4Port udpDstPort
Definition: nts.hpp:229
Ly4Port udpSrcPort
Definition: nts.hpp:227
Ip4Addr ip4SrcAddr
Definition: nts.hpp:226
Ip4Addr ip4DstAddr
Definition: nts.hpp:228
Here is the caller graph for this function:

◆ dumpPLenToFile()

bool dumpPLenToFile ( UdpPLen udpPLen,
ofstream &  outFileStream 
)

Dump a payload length information to a file.

Parameters
[in]udpPLen,apointer to the payload length to dump.
[in]outFileStream,theoutput file stream to write to.
Returns
OK if successful, otherwise KO.

Definition at line 507 of file tb_nal.cpp.

507  {
508  if (!outFileStream.is_open()) {
509  printf("### ERROR : Output file stream is not open. \n");
510  return(KO);
511  }
512  outFileStream << hex << noshowbase << setfill('0') << setw(4) << udpPLen->to_int();
513  outFileStream << "\n";
514  return(OK);
515 }
Here is the caller graph for this function:

◆ eventFifoMerge()

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 at line 412 of file nal.cpp.

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 }
Here is the caller graph for this function:

◆ extractByteCnt() [1/2]

uint8_t extractByteCnt ( AxisRaw  currWord)

Definition at line 94 of file nal.cpp.

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 }
LE_tKeep getLE_TKeep(int leHi=64/8-1, int leLo=0) const
Definition: AxisRaw.hpp:264
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extractByteCnt() [2/2]

uint8_t extractByteCnt ( NetworkWord  currWord)

Definition at line 130 of file nal.cpp.

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 }

◆ getLocalPortFromTriple()

TcpPort getLocalPortFromTriple ( NalTriple  triple)

Definition at line 86 of file nal.cpp.

87 {
88 #pragma HLS INLINE
89  ap_uint<16> ret = (ap_uint<16>) (triple & 0xFFFF);
90  return (TcpPort) ret;
91 }
ap_uint< 16 > TcpPort
Definition: AxisTcp.hpp:105
Here is the caller graph for this function:

◆ getOutputDataStream() [1/2]

bool getOutputDataStream ( stream< NetworkWord > &  sDataStream,
const string  dataStreamName,
const string  outFileName 
)

Definition at line 562 of file tb_nal.cpp.

564 {
565  string strLine;
566  ofstream outFileStream;
567  string datFile = "../../../../test/" + outFileName;
568  UdpAppData udpWord;
569  bool rc = OK;
570 
571  //-- STEP-1 : OPEN FILE
572  outFileStream.open(datFile.c_str());
573  if ( !outFileStream ) {
574  cout << "### ERROR : Could not open the output data file " << datFile << endl;
575  return(KO);
576  }
577 
578  //-- STEP-2 : EMPTY STREAM AND DUMP DATA TO FILE
579  while (!sDataStream.empty()) {
580  NetworkWord wordtmp = sDataStream.read();
581  udpWord = UdpAppData(wordtmp.tdata, wordtmp.tkeep, wordtmp.tlast);
582  // Print DUT/Data to console
583  printf("[%4.4d] TB is draining output stream [%s] - Data read = {D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
584  simCnt, dataStreamName.c_str(),
585  udpWord.getTData().to_uint64(), udpWord.getTData().to_int(), udpWord.getTData().to_int());
586  if (!dumpDataToFile(&udpWord, outFileStream)) {
587  rc = KO;
588  break;
589  }
590  }
591 
592  //-- STEP-3: CLOSE FILE
593  outFileStream.close();
594 
595  return(rc);
596 }
unsigned int simCnt
Definition: tb_nal.cpp:158
bool dumpDataToFile(UdpAppData *udpWord, ofstream &outFileStream)
Dump a data word to a file.
Definition: tb_nal.cpp:449
AxisRaw UdpAppData
Definition: nts.hpp:214
Here is the call graph for this function:

◆ getOutputDataStream() [2/2]

bool getOutputDataStream ( stream< UdpAppData > &  sDataStream,
const string  dataStreamName,
const string  outFileName 
)

Fill an output file with data from an output stream.

Parameters
[in]sDataStream,theoutput data stream to set.
[in]dataStreamName,thename of the data stream.
[in]outFileName,thename of the output file to write to.
Returns
OK if successful, otherwise KO.

Definition at line 526 of file tb_nal.cpp.

528 {
529  string strLine;
530  ofstream outFileStream;
531  string datFile = "../../../../test/" + outFileName;
532  UdpAppData udpWord;
533  bool rc = OK;
534 
535  //-- STEP-1 : OPEN FILE
536  outFileStream.open(datFile.c_str());
537  if ( !outFileStream ) {
538  cout << "### ERROR : Could not open the output data file " << datFile << endl;
539  return(KO);
540  }
541 
542  //-- STEP-2 : EMPTY STREAM AND DUMP DATA TO FILE
543  while (!sDataStream.empty()) {
544  if (readDataStream(sDataStream, &udpWord) == VALID) {
545  // Print DUT/Data to console
546  printf("[%4.4d] TB is draining output stream [%s] - Data read = {D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
547  simCnt, dataStreamName.c_str(),
548  udpWord.getTData().to_uint64(), udpWord.getTKeep().to_int(), udpWord.getTLast().to_int());
549  if (!dumpDataToFile(&udpWord, outFileStream)) {
550  rc = KO;
551  break;
552  }
553  }
554  }
555 
556  //-- STEP-3: CLOSE FILE
557  outFileStream.close();
558 
559  return(rc);
560 }
bool readDataStream(stream< UdpAppData > &sDataStream, UdpAppData *udpWord)
Read data from a stream.
Definition: tb_nal.cpp:395
#define VALID
Definition: tb_nal.cpp:43
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOutputMetaStream()

bool getOutputMetaStream ( stream< UdpAppMeta > &  sMetaStream,
const string  metaStreamName,
const string  outFileName 
)

Fill an output file with metadata from an output stream.

Parameters
[in]sMetaStream,theoutput metadata stream to set.
[in]metaStreamName,thename of the metadata stream.
[in]outFileName,thename of the output file to write to.
Returns
OK if successful, otherwise KO.

Definition at line 607 of file tb_nal.cpp.

609 {
610  string strLine;
611  ofstream outFileStream;
612  string datFile = "../../../../test/" + outFileName;
613  UdpAppMeta udpMeta;
614  bool rc = OK;
615 
616  //-- STEP-1 : OPEN FILE
617  outFileStream.open(datFile.c_str());
618  if ( !outFileStream ) {
619  cout << "### ERROR : Could not open the output data file " << datFile << endl;
620  return(KO);
621  }
622 
623  //-- STEP-2 : EMPTY STREAM AND DUMP METADATA TO FILE
624  while (!sMetaStream.empty()) {
625  if (readMetaStream(sMetaStream, metaStreamName, &udpMeta) == VALID) {
626  if (!dumpMetaToFile(&udpMeta, outFileStream)) {
627  rc = KO;
628  break;
629  }
630  }
631  }
632 
633  //-- STEP-3: CLOSE FILE
634  outFileStream.close();
635 
636  return(rc);
637 }
bool readMetaStream(stream< UdpAppMeta > &sMetaStream, const string metaStreamName, UdpAppMeta *udpMeta)
Read an output metadata stream from the DUT.
Definition: tb_nal.cpp:410
bool dumpMetaToFile(UdpAppMeta *udpMeta, ofstream &outFileStream)
Dump a metadata information to a file.
Definition: tb_nal.cpp:483
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOutputPLenStream()

bool getOutputPLenStream ( stream< UdpPLen > &  sPLenStream,
const string  plenStreamName,
const string  outFileName 
)

Fill an output file with payload length from an output stream.

Parameters
[in]sPLenStream,theoutput payload length stream to set.
[in]plenStreamName,thename of the payload length stream.
[in]outFileName,thename of the output file to write to.
Returns
OK if successful, otherwise KO.

Definition at line 648 of file tb_nal.cpp.

650 {
651  string strLine;
652  ofstream outFileStream;
653  string datFile = "../../../../test/" + outFileName;
654  UdpPLen udpPLen;
655  bool rc = OK;
656 
657  //-- STEP-1 : OPEN FILE
658  outFileStream.open(datFile.c_str());
659  if ( !outFileStream ) {
660  cout << "### ERROR : Could not open the output data file " << datFile << endl;
661  return(KO);
662  }
663 
664  //-- STEP-2 : EMPTY STREAM AND DUMP PAYLOAD LENGTH TO FILE
665  while (!sPLenStream.empty()) {
666  if (readPLenStream(sPLenStream, plenStreamName, &udpPLen) == VALID) {
667  if (!dumpPLenToFile(&udpPLen, outFileStream)) {
668  rc = KO;
669  break;
670  }
671  }
672  }
673 
674  //-- STEP-3: CLOSE FILE
675  outFileStream.close();
676 
677  return(rc);
678 }
bool readPLenStream(stream< UdpPLen > &sPLenStream, const string plenStreamName, UdpPLen *udpPLen)
Read an output payload length stream from the DUT.
Definition: tb_nal.cpp:431
UdpAppDLen UdpPLen
Definition: nal.hpp:258
bool dumpPLenToFile(UdpPLen *udpPLen, ofstream &outFileStream)
Dump a payload length information to a file.
Definition: tb_nal.cpp:507
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRemoteIpAddrFromTriple()

Ip4Addr getRemoteIpAddrFromTriple ( NalTriple  triple)

Definition at line 70 of file nal.cpp.

71 {
72 #pragma HLS INLINE
73  ap_uint<32> ret = ((ap_uint<32>) (triple >> 32)) & 0xFFFFFFFF;
74  return (Ip4Addr) ret;
75 }
ap_uint< 32 > Ip4Addr
Definition: AxisIp4.hpp:169
Here is the caller graph for this function:

◆ getRemotePortFromTriple()

TcpPort getRemotePortFromTriple ( NalTriple  triple)

Definition at line 78 of file nal.cpp.

79 {
80 #pragma HLS INLINE
81  ap_uint<16> ret = ((ap_uint<16>) (triple >> 16)) & 0xFFFF;
82  return (TcpPort) ret;
83 }
Here is the caller graph for this function:

◆ getRightmostBitPos()

ap_uint< 32 > getRightmostBitPos ( ap_uint< 32 >  num)

Definition at line 43 of file nal.cpp.

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 }
Here is the caller graph for this function:

◆ main()

int main ( )

Main Testbench Loop; Emulates also the behavior of the UDP Offload Engine (UOE).

Definition at line 1084 of file tb_nal.cpp.

1084  {
1085 
1086  //------------------------------------------------------
1087  //-- TESTBENCH LOCAL VARIABLES
1088  //------------------------------------------------------
1089  int nrErr = 0;
1090 
1091  printf("#####################################################\n");
1092  printf("## TESTBENCH 'tb_nrc' STARTS HERE ##\n");
1093  printf("#####################################################\n");
1094 
1095  simCnt = 0;
1096  nrErr = 0;
1097 
1098  //prepare MRT (routing table)
1099  for(int i = 0; i < MAX_MRT_SIZE + NUMBER_CONFIG_WORDS + NUMBER_STATUS_WORDS; i++)
1100  {
1101  ctrlLink[i] = 0;
1102  }
1103 
1104  //ctrlLink[0] = 1; //own rank
1106  ctrlLink[NUMBER_CONFIG_WORDS + NUMBER_STATUS_WORDS + 0] = 0x0a0b0c01; //10.11.12.1
1107  ctrlLink[NUMBER_CONFIG_WORDS + NUMBER_STATUS_WORDS + 1] = 0x0a0b0c0d; //10.11.12.13
1108  ctrlLink[NUMBER_CONFIG_WORDS + NUMBER_STATUS_WORDS + 2] = 0x0a0b0c0e; //10.11.12.14
1109 
1110  //------------------------------------------------------
1111  //-- STEP-1 : OPEN PORT REQUEST
1112  //------------------------------------------------------
1113  //printf("========================= BEGIN UDP Port Opening =========================\n");
1114  //for (int i=0; i<32; ++i) {
1115  // //we need ~18 cycles to copy all configs, and then a few more to copy the MRT
1116  // stepDut();
1117  // if ( !sNRC_UOE_LsnReq.empty() ) {
1118  // sNRC_UOE_LsnReq.read();
1119  // printf("[%4.4d] NRC->UOE_OpnReq : DUT is requesting to open a port.\n", simCnt);
1120  // stepDut();
1121  // sUOE_NRC_LsnRep.write(true);
1122  // printf("[%4.4d] NRC->UOE_OpnAck : TB acknowledges the port opening.\n", simCnt);
1123  // }
1124  //}
1125  //printf("========================= END UDP Port Opening =========================\n");
1126 
1130  //if (nrErr == 0) {
1131  // if (!setInputDataStream(sROLE_NRC_Data, "sROLE_NRC_Data", "ifsROLE_Urif_Data.dat")) {
1132  // printf("### ERROR : Failed to set input data stream \"sROLE_DataStream\". \n");
1133  // nrErr++;
1134  // }
1135  //
1136  // //there are 2 streams from the ROLE to UDMX
1137  // NetworkMeta tmp_meta = NetworkMeta(1,DEFAULT_RX_PORT,2,DEFAULT_RX_PORT,0);
1138  // siUdp_meta.write(NetworkMetaStream(tmp_meta));
1139  // siUdp_meta.write(NetworkMetaStream(tmp_meta));
1140 
1141  // if (!setInputDataStream(sUOE_NRC_Data, "sUOE_NRC_Data", "ifsUDMX_Urif_Data.dat")) {
1142  // printf("### ERROR : Failed to set input data stream \"sUOE_DataStream\". \n");
1143  // nrErr++;
1144  // }
1145  // //if (!setInputMetaStream(sUDMX_Urif_Meta, "sUDMX_Urif_Meta", "ifsUDMX_Urif_Data.dat")) {
1146  // // printf("### ERROR : Failed to set input meta stream \"sUDMX_MetaStream\". \n");
1147  // // nrErr++;
1148  // //}
1149  // //there are 3 streams from the UDMX to NRC
1150  // //UdpMeta socketPair = SocketPair({DEFAULT_RX_PORT, 0x0A0B0C0E}, {DEFAULT_RX_PORT, 0x0A0B0C01});
1151  // UdpMeta socketPair = SocketPair({0x0A0B0C0E, DEFAULT_RX_PORT}, {0x0A0B0C01, DEFAULT_RX_PORT});
1152  // sUOE_NRC_Meta.write(socketPair);
1153  // sUOE_NRC_Meta.write(socketPair);
1154  // sUOE_NRC_Meta.write(socketPair);
1155  // // Print Metadata to console
1156  // printf("[%4.4d] TB is filling input stream [Meta] - Metadata = {{SP=0x%4.4X,SA=0x%8.8X} {DP=0x%4.4X,DA=0x%8.8X}} \n",
1157  // simCnt, socketPair.udpSrcPort.to_int(), socketPair.ip4SrcAddr.to_int(), socketPair.udpDstPort.to_int(), socketPair.ip4DstAddr.to_int());
1158  //}
1159 
1160  //------------------------------------------------------
1161  //-- STEP-3 : MAIN TRAFFIC LOOP
1162  //------------------------------------------------------
1163  bool sof = true;
1164  gSimCycCnt = simCnt; // Simulation cycle counter as a global variable
1165  nrErr = 0; // Total number of testbench errors
1166 
1167  printf("#####################################################\n");
1168  printf("## MAIN LOOP STARTS HERE ##\n");
1169  printf("#####################################################\n");
1170 
1171  //Test FMC first
1175  fpgaLsnPort = 8803;
1176 
1177 
1178  while (!nrErr)
1179  {
1180 
1181  //if (simCnt < 42)
1182  if (gSimCycCnt < MAX_SIM_CYCLES)
1183  {
1184 
1185  if(simCnt < 32)
1186  {
1187  //UDP port logic
1188  if ( !sNRC_UOE_LsnReq.empty() ) {
1189  sNRC_UOE_LsnReq.read();
1190  printf("[%4.4d] NRC->UOE_OpnReq : DUT is requesting to open a port.\n", simCnt);
1191  sUOE_NRC_LsnRep.write(true);
1192  printf("[%4.4d] NRC->UOE_OpnAck : TB acknowledges the port opening.\n", simCnt);
1193  }
1194  }
1195 
1196  //------------------------------------------------------
1197  //-- CREATE UDP TRAFFIC AS INPUT STREAMS
1198  //------------------------------------------------------
1199  if (simCnt == 32)
1200  {
1201  //by now, the config should have been copied
1202 
1203  if (!setInputDataStream(sROLE_NRC_Data, "sROLE_NRC_Data", "ifsROLE_Urif_Data.dat")) {
1204  printf("### ERROR : Failed to set input data stream \"sROLE_DataStream\". \n");
1205  nrErr++;
1206  }
1207 
1208  //there are 2 streams from the ROLE to UDMX
1210  siUdp_meta.write(NetworkMetaStream(tmp_meta));
1211  siUdp_meta.write(NetworkMetaStream(tmp_meta));
1212 
1213  if (!setInputDataStream(sUOE_NRC_Data, "sUOE_NRC_Data", "ifsUDMX_Urif_Data.dat")) {
1214  printf("### ERROR : Failed to set input data stream \"sUOE_DataStream\". \n");
1215  nrErr++;
1216  }
1217  //if (!setInputMetaStream(sUDMX_Urif_Meta, "sUDMX_Urif_Meta", "ifsUDMX_Urif_Data.dat")) {
1218  // printf("### ERROR : Failed to set input meta stream \"sUDMX_MetaStream\". \n");
1219  // nrErr++;
1220  //}
1221  //there are 3 streams from the UDMX to NRC
1222  //UdpMeta socketPair = SocketPair({0x0A0B0C0E, DEFAULT_RX_PORT}, {0x0A0B0C01, DEFAULT_RX_PORT});
1223  UdpAppMeta udpMeta = UdpAppMeta(0x0A0B0C0E, DEFAULT_RX_PORT, 0x0A0B0C01, DEFAULT_RX_PORT);
1224  sUOE_NRC_Meta.write(udpMeta);
1225  sUOE_NRC_Meta.write(udpMeta);
1226  sUOE_NRC_Meta.write(udpMeta);
1227  //the length of the streams are in ifsUDMX_Urif_Data.dat
1228  sUOE_NRC_DLen.write(38);
1229  sUOE_NRC_DLen.write(23);
1230  sUOE_NRC_DLen.write(60);
1231 
1232  // Print Metadata to console
1233  //printf("[%4.4d] TB is filling input stream [Meta] - Metadata = {{SP=0x%4.4X,SA=0x%8.8X} {DP=0x%4.4X,DA=0x%8.8X}} \n",
1234  //simCnt, socketPair.udpSrcPort.to_int(), socketPair.ip4SrcAddr.to_int(), socketPair.udpDstPort.to_int(), socketPair.ip4DstAddr.to_int());
1235  }
1236 
1237  //-------------------------------------------------
1238  //-- EMULATE TOE
1239  //-------------------------------------------------
1240  pTOE(
1241  nrErr,
1242  //-- TOE / Tx Data Interfaces
1244  sNRC_Toe_DReq,
1245  sTOE_Nrc_Data,
1247  //-- TOE / Listen Interfaces
1250  //-- TOE / Tx Data Interfaces
1251  sNRC_Toe_Data,
1254  //sTOE_Nrc_DSts,
1255  //-- TOE / Open Interfaces
1258  );
1259 
1260  //-------------------------------------------------
1261  //-- RUN DUT
1262  //-------------------------------------------------
1263  stepDut();
1264 
1265  //UDP meta
1266  if( !soUdp_meta.empty())
1267  {
1268  NetworkMetaStream tmp_meta = soUdp_meta.read();
1269  printf("Role received NRCmeta stream from rank %d.\n", (int) tmp_meta.tdata.src_rank);
1270  }
1271 
1272  //-------------------------------------------------
1273  //-- EMULATE APP 1 (FMC)
1274  //-------------------------------------------------
1275  pFMC(
1276  //-- TRIF / Rx Data Interface
1279  //-- TRIF / Tx Data Interface
1282 
1283  //if(simCnt % 50 == 0)
1284  //{
1285  // //to update MRT version
1286  // ctrlLink[NAL_CONFIG_MRT_VERSION] = ctrlLink[NAL_NUMBER_CONFIG_WORDS + NAL_STATUS_MRT_VERSION];
1287  //}
1288 
1289  //-------------------------------------------------
1290  //-- EMULATE APP 2 (ROLE-TCP)
1291  //-------------------------------------------------
1292  pROLE(
1293  //-- TRIF / Rx Data Interface
1296  //-- TRIF / Tx Data Interface
1299 
1300  //------------------------------------------------------
1301  //-- INCREMENT SIMULATION COUNTER
1302  //------------------------------------------------------
1303  fflush(stdout);
1304  fflush(stderr);
1305  gSimCycCnt++;
1306  if (gTraceEvent || ((gSimCycCnt % 1000) == 0)) {
1307  printf("-- [@%4.4d] -----------------------------\n", gSimCycCnt);
1308  gTraceEvent = false;
1309  }
1310  if(simCnt == 180)
1311  {
1312  if(rxpState != RXP_DONE)
1313  {
1314  nrErr++;
1315  printf("[TB-ERROR] RXP engine is not in expected state!\n");
1316  }
1317  //now test ROLE
1321  fpgaLsnPort = 2718;
1323  //i.e. three segments (nrSegToSend)
1324  }
1325  if(simCnt == 210)
1326  {
1327  s_tcp_rx_ports = 0b101;
1328  //open 2720
1329  }
1330  if(simCnt == 223)
1331  {
1332  if(rxpState != RXP_DONE)
1333  {
1334  nrErr++;
1335  printf("[TB-ERROR] RXP engine is not in expected state!\n");
1336  }
1341  fpgaLsnPort = 2720;
1343  //i.e. three segments (nrSegToSend)
1344  }
1345 
1346  //if(simCnt == 243)
1347  //{
1348  // s_tcp_rx_ports = 0b1101;
1349  //}
1350  if(simCnt == 269)
1351  {
1352  if(rxpState != RXP_DONE)
1353  {
1354  nrErr++;
1355  printf("[TB-ERROR] RXP engine is not in expected state!\n");
1356  }
1357  //test again, but this time with connection timeout
1362  fpgaLsnPort = 2720;
1363  hostSrcPort = 8443;
1368  }
1369 
1370  if(simCnt >= 269 && tcp_timout_packet_drop > 0 && !sNRC_Toe_OpnReq.empty())
1371  {
1372  //drain OpnReq stream
1374  printf("=== Drain OpenReq: ");
1375  printSockAddr("Main-Loop", sNRC_Toe_OpnReq.read());
1376  }
1377 
1378  //TODO:
1379  //open other ports later?
1380 
1381  } else {
1382  printf("## End of simulation at cycle=%3d. \n", simCnt);
1383  break;
1384  }
1385 
1386  } // End: while()
1387  printf("-- [@%4.4d] -----------------------------\n", gSimCycCnt);
1388  printf("############################################################################\n");
1389  printf("## TESTBENCH 'tb_nal' ENDS HERE ##\n");
1390 
1393  {
1394  printf("\tERROR: some packets are lost: send %d TCP packets, received %d (fragmented parts %d, expected timeout for packets %d)!\n", tcp_packets_send, tcp_packets_recv-tcp_recv_frag_cnt, tcp_recv_frag_cnt, tcp_packets_expected_timeout);
1395  } else {
1396  printf("\tSummary: Send %d TCP packets, Received %d TCP packets (fragmented parts %d, expected Timout packets %d).\n",tcp_packets_send, tcp_packets_recv-tcp_recv_frag_cnt, tcp_recv_frag_cnt, tcp_packets_expected_timeout);
1397  }
1398  printf("############################################################################\n\n");
1399 
1401  {
1402  //A4L needs >161 steps to acknowledge it.
1403  printf("ERROR: NAL status is reporting the wrong MRT version (%d)!\n", (int) ctrlLink[NUMBER_CONFIG_WORDS + NAL_STATUS_MRT_VERSION]);
1404  nrErr++;
1405  }
1406 
1407  //-------------------------------------------------------
1408  //-- STEP-4 : DRAIN AND WRITE OUTPUT FILE STREAMS
1409  //-------------------------------------------------------
1410  //---- URIF-->ROLE ----
1411  if (!getOutputDataStream(sNRC_Role_Data, "sNRC_Role_Data", "ofsURIF_Role_Data.dat"))
1412  nrErr++;
1413  //---- URIF->UDMX ----
1414  if (!getOutputDataStream(sNRC_UOE_Data, "sNRC_UOE_Data", "ofsURIF_Udmx_Data.dat"))
1415  nrErr++;
1416  if (!getOutputMetaStream(sNRC_UOE_Meta, "sNRC_UOE_Meta", "ofsURIF_Udmx_Meta.dat"))
1417  nrErr++;
1418  if (!getOutputPLenStream(sNRC_UOE_DLen, "sNRC_UOE_DLen", "ofsURIF_Udmx_PLen.dat"))
1419  nrErr++;
1420 
1421  // there should be no left over data
1422  while(!sNRC_Toe_OpnReq.empty())
1423  {
1424  printf("=== Draining leftover TCP request: ");
1425  printSockAddr("Post-Loop", sNRC_Toe_OpnReq.read());
1426  printf("===\n");
1427  nrErr++;
1428  }
1429 
1430 
1431  //------------------------------------------------------
1432  //-- STEP-5 : COMPARE INPUT AND OUTPUT FILE STREAMS
1433  //------------------------------------------------------
1434  int rc1 = system("diff --brief -w -i -y ../../../../test/ofsURIF_Role_Data.dat \
1435  ../../../../test/ifsUDMX_Urif_Data.dat");
1436  if (rc1)
1437  printf("## Error : File \'ofsURIF_Role_Data.dat\' does not match \'ifsUDMX_Urif_Data.dat\'.\n");
1438 
1439  int rc2 = system("diff --brief -w -i -y ../../../../test/ofsURIF_Udmx_Data.dat \
1440  ../../../../test/ifsROLE_Urif_Data.dat");
1441  if (rc2)
1442  printf("## Error : File \'ofsURIF_Udmx_Data.dat\' does not match \'ifsROLE_Urif_Data.dat\'.\n");
1443  nrErr += rc1 + rc2;
1444 
1445  printf("#####################################################\n");
1446  if (nrErr)
1447  printf("## ERROR - TESTBENCH FAILED (RC=%d) !!! ##\n", nrErr);
1448  else
1449  printf("## SUCCESSFULL END OF TESTBENCH (RC=0) ##\n");
1450 
1451  printf("#####################################################\n");
1452 
1453  return(nrErr);
1454 }
bool setInputDataStream(stream< UdpAppData > &sDataStream, const string dataStreamName, const string inpFileName)
Initialize an input data stream from a file.
Definition: tb_nal.cpp:214
stream< UdpAppMeta > sNRC_UOE_Meta("sNRC_UOE_Meta")
stream< NetworkWord > sNRC_Role_Tcp_data("sNRC_Role_Tcp_data")
stream< TcpAppLsnRep > sTOE_Nrc_LsnAck("sTOE_Nrc_LsnAck")
TcpPort hostSrcPort
Definition: tb_nal.cpp:813
stream< TcpAppData > sTOE_Nrc_Data("sTOE_Nrc_Data")
int tcp_packets_recv
Definition: tb_nal.cpp:161
TcpSegLen tcpSegLen
Definition: tb_nal.cpp:833
stream< UdpAppDLen > sUOE_NRC_DLen("sUOE_NRC_DLen")
TcpPort fpgaLsnPort
Definition: tb_nal.cpp:812
stream< TcpAppSndRep > sTOE_Nrc_SndRep("sTOE_NRC_SndRep")
#define DEFAULT_SESSION_ID
Definition: tb_nal.cpp:75
int tcp_timout_packet_drop
Definition: tb_nal.cpp:164
stream< NetworkWord > sFMC_Nrc_Tcp_data("sFMC_Nrc_Tcp_data")
stream< TcpAppRdReq > sNRC_Toe_DReq("sNrc_TOE_DReq")
stream< NetworkWord > sNRC_Role_Data("sNRC_Role_Data")
stream< NetworkMetaStream > sROLE_Nrc_Tcp_meta("sROLE_Nrc_Tcp_meta")
#define MAX_SIM_CYCLES
Definition: tb_nal.cpp:63
int tcp_packets_expected_timeout
Definition: tb_nal.cpp:163
void pROLE(stream< NetworkWord > &siTRIF_Data, stream< NetworkMetaStream > &siTRIF_meta, stream< NetworkWord > &soTRIF_Data, stream< NetworkMetaStream > &soTRIF_meta)
Emulate the behavior of the ROLE.
Definition: tb_nal.cpp:746
stream< NetworkWord > sNRC_FMC_Tcp_data("sNRC_FMC_Tcp_data")
stream< NetworkMetaStream > sNRC_Role_Tcp_meta("sNRC_Role_Tcp_meta")
stream< TcpAppData > sNRC_Toe_Data("sNRC_TOE_Data")
stream< TcpAppLsnReq > sNRC_Toe_LsnReq("sNRC_TOE_LsnReq")
void pTOE(int &nrErr, stream< TcpAppNotif > &soTRIF_Notif, stream< TcpAppRdReq > &siTRIF_DReq, stream< TcpAppData > &soTRIF_Data, stream< TcpAppMeta > &soTRIF_SessId, stream< TcpAppLsnReq > &siTRIF_LsnReq, stream< TcpAppLsnRep > &soTRIF_LsnAck, stream< TcpAppData > &siTRIF_Data, stream< TcpAppSndReq > &siTRIF_SndReq, stream< TcpAppSndRep > &soTRIF_SndRep, stream< TcpAppOpnReq > &siTRIF_OpnReq, stream< TcpAppOpnRep > &soTRIF_OpnRep)
Definition: tb_nal.cpp:840
stream< TcpAppMeta > sTOE_Nrc_SessId("sTOE_Nrc_SessId")
stream< NetworkMetaStream > soUdp_meta("soUdp_meta")
#define DEFAULT_RX_PORT
Definition: nal.hpp:139
void pFMC(stream< NetworkWord > &siTRIF_Data, stream< TcpSessId > &siTRIF_SessId, stream< NetworkWord > &soTRIF_Data, stream< TcpSessId > &soTRIF_SessId)
Emulate the behavior of the FMC.
Definition: tb_nal.cpp:693
stream< UdpAppData > sUOE_NRC_Data("sUOE_NRC_Data")
#define DEFAULT_SESSION_LEN
Definition: tb_nal.cpp:76
stream< UdpAppData > sNRC_UOE_Data("sNRC_UOE_Data")
stream< StsBool > sUOE_NRC_LsnRep("sUOE_NRC_LsnRep")
int tcp_recv_frag_cnt
Definition: tb_nal.cpp:162
#define NAL_STATUS_MRT_VERSION
Definition: nal.hpp:221
stream< TcpSessId > sFMC_Nrc_Tcp_sessId("sFMC_Nrc_Tcp_sessId")
bool getOutputMetaStream(stream< UdpAppMeta > &sMetaStream, const string metaStreamName, const string outFileName)
Fill an output file with metadata from an output stream.
Definition: tb_nal.cpp:607
unsigned int gSimCycCnt
Definition: tb_nal.cpp:150
bool gTraceEvent
Definition: tb_nal.cpp:151
stream< UdpAppMeta > sUOE_NRC_Meta("sUOE_NRC_Meta")
stream< NetworkWord > sROLE_NRC_Data("sROLE_NRC_Data")
ap_uint< 32 > s_tcp_rx_ports
Definition: tb_nal.cpp:139
AppMeta sessionId_reply
Definition: tb_nal.cpp:828
stream< NetworkWord > sROLE_Nrc_Tcp_data("sROLE_Nrc_Tcp_data")
stream< TcpAppOpnRep > sTOE_Nrc_OpnRep("sTOE_NRC_OpenRep")
#define DEFAULT_HOST_IP4_ADDR
Definition: tb_nal.cpp:72
stream< UdpPort > sNRC_UOE_LsnReq("sNRC_UOE_LsnReq")
stream< NetworkMetaStream > siUdp_meta("siUdp_meta")
stream< TcpAppNotif > sTOE_Nrc_Notif("sTOE_Nrc_Notif")
Ip4Addr hostIp4Addr
Emulate the behavior of the TCP Offload Engine (TOE).
Definition: tb_nal.cpp:811
void stepDut()
Run a single iteration of the DUT model.
Definition: tb_nal.cpp:171
bool getOutputPLenStream(stream< UdpPLen > &sPLenStream, const string plenStreamName, const string outFileName)
Fill an output file with payload length from an output stream.
Definition: tb_nal.cpp:648
int tcp_packets_send
Definition: tb_nal.cpp:160
AppMeta sessionId
Definition: tb_nal.cpp:827
stream< TcpSessId > sNRC_FMC_Tcp_sessId("sNRC_FMC_Tcp_sessId")
stream< TcpAppSndReq > sNRC_Toe_SndReq("sNRC_TOE_SndReq")
stream< TcpAppOpnReq > sNRC_Toe_OpnReq("sNRC_Toe_OpnReq")
stream< UdpAppDLen > sNRC_UOE_DLen("sNRC_UOE_DLen")
bool getOutputDataStream(stream< UdpAppData > &sDataStream, const string dataStreamName, const string outFileName)
Fill an output file with data from an output stream.
Definition: tb_nal.cpp:526
void printSockAddr(const char *callerName, SockAddr sockAddr)
Print a socket address.
Definition: nts_utils.cpp:174
NetworkMeta tdata
Definition: network.hpp:109
NodeId src_rank
Definition: network.hpp:97
Here is the call graph for this function:

◆ nal_main()

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 at line 464 of file nal.cpp.

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 }
ap_uint< 1 > layer_7_enabled
Definition: tb_fmc.cpp:68
ap_uint< 1 > layer_4_enabled
Definition: tb_fmc.cpp:66
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
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
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
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
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
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
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
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 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
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
ap_uint< 1 > role_decoupled
Definition: tb_nal.cpp:134
ap_uint< 32 > myIpAddress
Definition: tb_nal.cpp:140
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
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
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ newTriple()

NalTriple newTriple ( Ip4Addr  ipRemoteAddres,
TcpPort  tcpRemotePort,
TcpPort  tcpLocalPort 
)

Definition at line 62 of file nal.cpp.

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 }
ap_uint< 64 > NalTriple
Definition: nal.hpp:273
Here is the caller graph for this function:

◆ pCacheInvalDetection()

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 processes.

Parameters
[in]layer_4_enabled,externalsignal if layer 4 is enabled
[in]layer_7_enabled,externalsignal if layer 7 is enabled
[in]role_decoupled,externalsignal if the role is decoupled
[in]piNTS_ready,externalsignal if NTS is up and running
[in]mrt_version_update,notificationof MRT version change
[in]inval_del_sig,notificationof connection closing
[out]cache_inval_0,signalsthat caches must be invalidated
[out]cache_inval_1,signalsthat caches must be invalidated
[out]cache_inval_2,signalsthat caches must be invalidated
[out]cache_inval_3,signalsthat caches must be invalidated

Definition at line 889 of file hss.cpp.

901 {
902  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
903 #pragma HLS INLINE off
904 #pragma HLS pipeline II=1
905 
906  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
907  static CacheInvalFsmStates cache_fsm = CACHE_WAIT_FOR_VALID;
908  static uint32_t mrt_version_current = 0;
909 
910 #pragma HLS RESET variable=cache_fsm
911 #pragma HLS RESET variable=mrt_version_current
912 
913  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
914  static ap_uint<1> role_state;
915  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
916 
917  //===========================================================
918 
919  switch (cache_fsm)
920  {
921  default:
923  if(*layer_4_enabled == 1 && *piNTS_ready == 1)
924  {
925  role_state = *role_decoupled;
926  cache_fsm = CACHE_VALID;
927  }
928  break;
929  case CACHE_VALID:
930  if(*layer_4_enabled == 0 || *piNTS_ready == 0 || *role_decoupled != role_state || *layer_7_enabled == 0)
931  {
932  if(*role_decoupled == 0 || *layer_4_enabled == 0 || *piNTS_ready == 0)
933  { //not layer_7_enabled == 0, since this would also be valid during PR
934  //role_decoupled == 0, if layer_7_enabled == 0 but no PR, so we invalidate the cache
935  //but wait until a PR is done
936 
937  //i.e. after a PR
938  cache_fsm = CACHE_INV_SEND_0;
939  printf("[pCacheInvalDetection] Detected cache invalidation condition!\n");
940  } else {
941  //not yet invalid
942  role_state = *role_decoupled;
943  }
944  } else if(!mrt_version_update.empty())
945  {
946  uint32_t tmp = mrt_version_update.read();
947  if(tmp != mrt_version_current)
948  {
949  mrt_version_current = tmp;
950  cache_fsm = CACHE_INV_SEND_0;
951  }
952  } else if(!inval_del_sig.empty())
953  {
954  bool sig = inval_del_sig.read();
955  if(sig)
956  {
957  cache_fsm = CACHE_INV_SEND_2;
958  //we only need to invalidate the Cache of the TCP processes
959  //(2 and 3)
960  }
961  }
962  break;
963  case CACHE_INV_SEND_0:
964  //UDP RX
965  if(!cache_inval_0.full())
966  {
967  cache_inval_0.write(true);
968  cache_fsm = CACHE_INV_SEND_1;
969  }
970  break;
971  case CACHE_INV_SEND_1:
972  //UDP TX
973  if(!cache_inval_1.full())
974  {
975  cache_inval_1.write(true);
976  cache_fsm = CACHE_INV_SEND_2;
977  }
978  break;
979  case CACHE_INV_SEND_2:
980  //TCP RDp
981  if(!cache_inval_2.full())
982  {
983  cache_inval_2.write(true);
984  cache_fsm = CACHE_INV_SEND_3;
985  }
986  break;
987  case CACHE_INV_SEND_3:
988  //TCP WRp
989  if(!cache_inval_3.full())
990  {
991  cache_inval_3.write(true);
992  cache_fsm = CACHE_WAIT_FOR_VALID;
993  }
994  break;
995  }
996 }
CacheInvalFsmStates
Definition: nal.hpp:160
Here is the caller graph for this function:

◆ pFMC()

void pFMC ( stream< NetworkWord > &  siTRIF_Data,
stream< TcpSessId > &  siTRIF_SessId,
stream< NetworkWord > &  soTRIF_Data,
stream< TcpSessId > &  soTRIF_SessId 
)

Emulate the behavior of the FMC.

Parameters
[in]siTRIF_Data,Datato TcpRoleInterface (TRIF).
[in]siTRIF_SessId,SessionID to [TRIF].
[out]soROLE_Data,Datastream to [TRIF].
[out]soROLE_SessIdSessionID to [TRFI].

Definition at line 693 of file tb_nal.cpp.

700 {
701  NetworkWord currWord;
702  TcpSessId tcpSessId;
703 
704  const char *myRxName = concat3(THIS_NAME, "/", "FMC-Rx");
705  const char *myTxName = concat3(THIS_NAME, "/", "FMC-Tx");
706 
707  switch (rxFsmState ) {
708  case RX_WAIT_META:
709  if (!siTRIF_SessId.empty() and !soTRIF_SessId.full()) {
710  //tcpSessId = siTRIF_SessId.read().tdata;
711  tcpSessId = siTRIF_SessId.read();
712  soTRIF_SessId.write(tcpSessId);
714  printf("FMC received sessionID: %d\n", tcpSessId.to_uint());
715  }
716  break;
717  case RX_STREAM:
718  if (!siTRIF_Data.empty() && !soTRIF_Data.full()) {
719  siTRIF_Data.read(currWord);
720  //if (DEBUG_LEVEL & TRACE_ROLE) {
721  printAxiWord(myRxName, currWord);
722  //}
723  soTRIF_Data.write(currWord);
724  if (currWord.tlast == 1) {
726  }
727  }
728  break;
729  }
730 
731 }
#define THIS_NAME
Definition: tb_nal.cpp:51
#define concat3(firstCharConst, secondCharConst, thirdCharConst)
Definition: nts_utils.hpp:161
ap_uint< 16 > TcpSessId
Definition: nts_types.hpp:137
void printAxiWord(const char *callerName, AxisRaw chunk)
Prints one chunk of a data stream (used for debugging).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pFmcTcpRxDeq()

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 at line 1012 of file tss.cpp.

1019 {
1020  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
1021 #pragma HLS INLINE off
1022 #pragma HLS pipeline II=1
1023  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
1024  static DeqFsmStates deqFsmState = DEQ_WAIT_META;
1025 #pragma HLS RESET variable=deqFsmState
1026  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
1027  static PacketLen current_bytes_written = 0;
1028  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
1029  NetworkWord cur_word = NetworkWord();
1030  TcpSessId cur_meta = TcpSessId();
1031 
1032  switch(deqFsmState)
1033  {
1034  default:
1035  case DEQ_SEND_NOTIF:
1036  if(!fmc_write_cnt_sig.full())
1037  {
1038  fmc_write_cnt_sig.write(current_bytes_written);
1039  current_bytes_written = 0;
1040  deqFsmState = DEQ_WAIT_META;
1041  }
1042  break;
1043  case DEQ_WAIT_META:
1044  if(!sFmcTcpDataRx_buffer.empty() && !sFmcTcpMetaRx_buffer.empty()
1045  && !soFmc_data.full() && !soFmc_meta.full()
1046  )
1047  {
1048  printf("[pFmcTcpRxDeq] Start processing FMC packet\n");
1049  cur_word = sFmcTcpDataRx_buffer.read();
1050  cur_meta = sFmcTcpMetaRx_buffer.read();
1051  current_bytes_written = extractByteCnt(cur_word);
1052  soFmc_data.write(cur_word);
1053  soFmc_meta.write(cur_meta);
1054  if(cur_word.tlast == 0)
1055  {
1056  deqFsmState = DEQ_STREAM_DATA;
1057  } else {
1058  deqFsmState = DEQ_SEND_NOTIF;
1059  }
1060  }
1061  break;
1062  case DEQ_STREAM_DATA:
1063  if(!sFmcTcpDataRx_buffer.empty()
1064  && !soFmc_data.full()
1065  )
1066  {
1067  cur_word = sFmcTcpDataRx_buffer.read();
1068  soFmc_data.write(cur_word);
1069  current_bytes_written += extractByteCnt(cur_word);
1070  if(cur_word.tlast == 1)
1071  {
1072  deqFsmState = DEQ_SEND_NOTIF;
1073  }
1074  }
1075  break;
1076  }
1077 }
DeqFsmStates
Definition: nal.hpp:164
ap_uint< 16 > PacketLen
Definition: nal.hpp:260
uint8_t extractByteCnt(AxisRaw currWord)
Definition: nal.cpp:94
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pMrtAgency()

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.

Parameters
[in]sMrtUpdate,Notificationof MRT changes
[in]sGetIpReq_UdpTx,Requeststream to get the IPv4 to a NodeId (from UdpTx)
[out]sGetIpRep_UdpTx,Replystream containing the IP address (to UdpTx)
[in]sGetIpReq_TcpTx,Requeststream to get the IPv4 to a NodeId (from TcpTx)
[out]sGetIpRep_TcpTx,Replystream containing the IP address (to TcpTx)
[in]sGetNidReq_UdpRx,Requeststream to get the NodeId to an IPv4 (from UdRx)
[out]sGetNidRep_UdpRx,Replystream containing the NodeId (to UdpRx)
[in]sGetNidReq_TcpRx,Requeststream to get the NodeId to an IPv4 (from TcpRx)
[out]sGetNidRep_TcpRx,Replystream containing the NodeId (to TcpRX)

Definition at line 386 of file hss.cpp.

400 {
401  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
402 #pragma HLS INLINE off
403 #pragma HLS pipeline II=1
404 
405  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
406  //static bool tables_initialized = false;
407 
408  //#pragma HLS reset variable=tables_initialized
409 
410  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
411  //static ap_uint<32> localMRT[MAX_MRT_SIZE];
412 
413  //#define CAM_SIZE 8
414  //#define CAM_NUM 16
415  // static Cam8<NodeId,Ip4Addr> mrt_cam_arr[CAM_NUM];
416  //#ifndef __SYNTHESIS__
417  // if(MAX_MRT_SIZE != 128)
418  // {
419  // printf("\n\t\tERROR: pMrtAgency is currently configured to support only a MRT size up to 128! Abort.\n(Currently, the use of \'mrt_cam_arr\' must be updated accordingly by hand.)\n");
420  // exit(-1);
421  // }
422  //#endif
423 
424  static ap_uint<32> localMRT[MAX_MRT_SIZE];
425  //#pragma HLS ARRAY_PARTITION variable=localMRT cyclic factor=8 dim=1
426 #pragma HLS ARRAY_PARTITION variable=localMRT complete dim=1
427 
428 
429  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
430 
431  // if(!tables_initialized)
432  // {
433  // //for(int i = 0; i < CAM_NUM; i++)
434  // //{
435  // // mrt_cam_arr[i].reset();
436  // //}
437  // tables_initialized = true;
438  // } else
439 
440  if( !sMrtUpdate.empty() )
441  {
442  NalMrtUpdate mu = sMrtUpdate.read();
443  if(mu.nid < MAX_MRT_SIZE)
444  {
445  localMRT[mu.nid] = mu.ip4a;
446  }
447 
448  } else if( !sGetIpReq_UdpTx.empty() && !sGetIpRep_UdpTx.full())
449  {
450  NodeId rank;
451  rank = sGetIpReq_UdpTx.read();
452  //uint8_t cam_select = rank / CAM_SIZE;
453  Ip4Addr rep = 0; //return zero on failure
454  //if(rank < MAX_MRT_SIZE && cam_select < CAM_NUM)
455  if(rank < MAX_MRT_SIZE)
456  {
457  //mrt_cam_arr[cam_select].lookup(rank, rep);
458  rep = localMRT[rank];
459  }
460  sGetIpRep_UdpTx.write(rep);
461  }
462  else if( !sGetIpReq_TcpTx.empty() && !sGetIpRep_TcpTx.full())
463  {
464  NodeId rank;
465  rank = sGetIpReq_TcpTx.read();
466  //uint8_t cam_select = rank / CAM_SIZE;
467  Ip4Addr rep = 0; //return zero on failure
468  //if(rank < MAX_MRT_SIZE && cam_select < CAM_NUM)
469  if(rank < MAX_MRT_SIZE)
470  {
471  //mrt_cam_arr[cam_select].lookup(rank, rep);
472  rep = localMRT[rank];
473  }
474  sGetIpRep_TcpTx.write(rep);
475  }
476  else if( !sGetNidReq_UdpRx.empty() && !sGetNidRep_UdpRx.full())
477  {
478  ap_uint<32> ipAddr = sGetNidReq_UdpRx.read();
479  printf("[HSS-INFO] Searching for Node ID of IP %d.\n", (int) ipAddr);
481  for(uint32_t i = 0; i< MAX_MRT_SIZE; i++)
482  {
483 #pragma HLS unroll factor=8
484  if(localMRT[i] == ipAddr)
485  {
486  rep = (NodeId) i;
487  break;
488  }
489  }
490  printf("[HSS-INFO] found Node Id %d.\n", (int) rep);
491  sGetNidRep_UdpRx.write(rep);
492  }
493  else if( !sGetNidReq_TcpRx.empty() && !sGetNidRep_TcpRx.full())
494  {
495  ap_uint<32> ipAddr = sGetNidReq_TcpRx.read();
496  printf("[HSS-INFO] Searching for Node ID of IP %d.\n", (int) ipAddr);
498  for(uint32_t i = 0; i< MAX_MRT_SIZE; i++)
499  {
500 #pragma HLS unroll factor=8
501  if(localMRT[i] == ipAddr)
502  {
503  rep = (NodeId) i;
504  break;
505  }
506  }
507  printf("[HSS-INFO] found Node Id %d.\n", (int) rep);
508  sGetNidRep_TcpRx.write(rep);
509  }
510  //for(int i = 0; i < CAM_NUM; i++)
511  //{
512  // if(mrt_cam_arr[i].reverse_lookup(ipAddr, rep))
513  // {
514  // break;
515  // }
516  //}
517 }
#define INVALID_MRT_VALUE
Definition: nal.hpp:203
ap_uint< 8 > NodeId
Definition: network.hpp:82
Ip4Addr ip4a
Definition: nal.hpp:299
NodeId nid
Definition: nal.hpp:298
Here is the caller graph for this function:

◆ pPortLogic()

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) to absolute port numbers If the input vector changes, or during a reset of the Role, the necessary open or close requests are send to pUdpLsn, pUdpCls, pTcpLsn, and pTcpCls.

Parameters
[in]layer_4_enabled,externalsignal if layer 4 is enabled
[in]layer_7_enabled,externalsignal if layer 7 is enabled
[in]role_decoupled,externalsignal if the role is decoupled
[in]piNTS_ready,externalsignal if NTS is up and running
[in]piMMIO_FmcLsnPort,themanagement listening port (from MMIO)
[in]pi_udp_rx_ports,one-hotencoded UDP Role listening ports
[in]pi_tcp_rx_ports,one-hotencoded Tcp Role listening ports
[in]sConfigUpdate,notificationof configuration changes
[out]sUdpPortsToOpen,streamcontaining the next UdpPort to open (to pUdpLsn)
[out]sUdpPortsToClose,streamcontaining the next UdpPort to close (to pUdpCls)
[out]sTcpPortsToOpen,streamcontaining the next TcpPort to open (to pUdpLsn)
[in]sUdpPortsOpenFeedback,signalof Udp Port opening results (success/failure)
[in]sTcpPortsOpenFeedback,signalof Tcp Port opening results (success/failure)
[out]sMarkToDel_unpriv,signalto mark unpivileged Tcp session as to be closed (to TCP agency)
[out]sPortUpdate,streamcontaining updates of currently opened ports (to status processing)
[out]sStartTclClssignal to start TCP Connection closing (to pTcpCls)

Definition at line 545 of file hss.cpp.

563 {
564  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
565 #pragma HLS INLINE off
566 #pragma HLS pipeline II=1
567 
568  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
569  static ap_uint<16> processed_FMC_listen_port = 0;
570  static ap_uint<32> tcp_rx_ports_processed = 0;
571  static ap_uint<32> udp_rx_ports_processed = 0;
572  static PortFsmStates port_fsm = PORT_RESET;
573 
574 #ifndef __SYNTHESIS__
575  static ap_uint<16> mmio_stabilize_counter = 1;
576 #else
577  static ap_uint<16> mmio_stabilize_counter = NAL_MMIO_STABILIZE_TIME;
578 #endif
579 
580 
581 #pragma HLS reset variable=mmio_stabilize_counter
582 #pragma HLS reset variable=processed_FMC_listen_port
583 #pragma HLS reset variable=udp_rx_ports_processed
584 #pragma HLS reset variable=tcp_rx_ports_processed
585 #pragma HLS reset variable=port_fsm
586 
587  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
588  static ap_uint<16> new_relative_port_to_req_udp;
589  static ap_uint<16> new_relative_port_to_req_tcp;
590  static ap_uint<16> current_requested_port;
591  static NalPortUpdate current_port_update;
592 
593  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
594 
595  switch(port_fsm)
596  {
597  default:
598  case PORT_RESET:
599  if(mmio_stabilize_counter > 0)
600  {
601  mmio_stabilize_counter--;
602  } else {
603  port_fsm = PORT_IDLE;
604  }
605  break;
606  case PORT_IDLE:
607  if(!sConfigUpdate.empty())
608  {
609  // restore saved states (after NAL got reset)
610  // TODO: apparently, this isn't working in time...for this we have to have a bigger "stabilizing count"
611  // at the other side: to request ports twice is apparently not harmful
612  NalConfigUpdate ca = sConfigUpdate.read();
613  switch(ca.config_addr)
614  {
616  if(processed_FMC_listen_port == 0)
617  {
618  processed_FMC_listen_port = (ap_uint<16>) ca.update_value;
619  }
620  break;
622  if(udp_rx_ports_processed == 0)
623  {
624  udp_rx_ports_processed = ca.update_value;
625  }
626  break;
628  if(tcp_rx_ports_processed == 0)
629  {
630  tcp_rx_ports_processed = ca.update_value;
631  }
632  break;
633  default:
634  printf("[ERROR] invalid config update received!\n");
635  break;
636  }
637 
638  } else if(*layer_4_enabled == 0 || *piNTS_ready == 0)
639  {
640  port_fsm = PORT_L4_RESET;
641  } else if(processed_FMC_listen_port != *piMMIO_FmcLsnPort)
642  { //process FMC port first!
643  port_fsm = PORT_NEW_FMC_REQ;
644  } else if (*layer_7_enabled == 0 || *role_decoupled == 1 )
645  {
646  port_fsm = PORT_L7_RESET;
647  } else {
648  // Role port requests
649  if(udp_rx_ports_processed != *pi_udp_rx_ports)
650  {
651  port_fsm = PORT_NEW_UDP_REQ;
652  }
653  else if(tcp_rx_ports_processed != *pi_tcp_rx_ports)
654  {
655  port_fsm = PORT_NEW_TCP_REQ;
656  }
657  }
658  break;
659  case PORT_L4_RESET:
660  if(!sPortUpdate.full()
661  && (processed_FMC_listen_port != 0 || udp_rx_ports_processed != 0 || tcp_rx_ports_processed !=0 )
662  )
663  {//first, notify
664  if(processed_FMC_listen_port != 0)
665  {
666  sPortUpdate.write(NalPortUpdate(FMC, 0));
667  processed_FMC_listen_port = 0;
668  }
669  else if(udp_rx_ports_processed != 0)
670  {
671  sPortUpdate.write(NalPortUpdate(UDP, 0));
672  udp_rx_ports_processed = 0;
673  }
674  else if(tcp_rx_ports_processed != 0)
675  {
676  sPortUpdate.write(NalPortUpdate(TCP, 0));
677  tcp_rx_ports_processed = 0;
678  }
679  }
680  else if(*layer_4_enabled == 1 && *piNTS_ready == 1)
681  {
682  //if layer 4 is reset, ports will be closed
683  //in all cases
684  processed_FMC_listen_port = 0x0;
685  udp_rx_ports_processed = 0x0;
686  tcp_rx_ports_processed = 0x0;
687  port_fsm = PORT_IDLE;
688  //no need for PORT_RESET (everything should still be "stable")
689  }
690  break;
691  case PORT_L7_RESET:
692  if(*layer_4_enabled == 1 && *piNTS_ready == 1)
693  {
694  if(udp_rx_ports_processed > 0)
695  {
696  port_fsm = PORT_START_UDP_CLS;
697  } else if(tcp_rx_ports_processed > 0)
698  {
699  //port_fsm = PORT_START_TCP_CLS_0;
700  port_fsm = PORT_START_TCP_CLS_1;
701  } else {
702  port_fsm = PORT_IDLE;
703  }
704  } else {
705  port_fsm = PORT_L4_RESET;
706  }
707  break;
708  case PORT_START_UDP_CLS:
709  if(!sUdpPortsToClose.full())
710  {
711 
712  //mark all UDP ports as to be deleted
713  ap_uint<16> newRelativePortToClose = 0;
714  ap_uint<16> newAbsolutePortToClose = 0;
715  if(udp_rx_ports_processed != 0)
716  {
717  newRelativePortToClose = getRightmostBitPos(udp_rx_ports_processed);
718  newAbsolutePortToClose = NAL_RX_MIN_PORT + newRelativePortToClose;
719  sUdpPortsToClose.write(newAbsolutePortToClose);
720  ap_uint<32> one_cold_closed_port = ~(((ap_uint<32>) 1) << (newRelativePortToClose));
721  udp_rx_ports_processed &= one_cold_closed_port;
722  printf("new UDP port ports to close: %#04x\n",(unsigned int) udp_rx_ports_processed);
723  }
724  if(udp_rx_ports_processed == 0)
725  {
726  current_port_update = NalPortUpdate(UDP, 0);
727  port_fsm = PORT_SEND_UPDATE;
728  }
729  }
730  break;
731  //case PORT_START_TCP_CLS_0:
732  //to close the open Role ports (not connections)
733  //TODO, add if TOE supports it
734  // break;
736  if(!sMarkToDel_unpriv.full())
737  {
738  sMarkToDel_unpriv.write(true);
739  if(*role_decoupled == 1)
740  {
741  port_fsm = PORT_WAIT_PR;
742  } else {
743  port_fsm = PORT_START_TCP_CLS_2;
744  }
745  }
746  break;
747  case PORT_WAIT_PR:
748  if(*role_decoupled == 0)
749  {
750  port_fsm = PORT_START_TCP_CLS_2;
751  }
752  break;
754  if(!sStartTclCls.full())
755  {
756  sStartTclCls.write(true);
757  tcp_rx_ports_processed = 0x0;
758  current_port_update = NalPortUpdate(TCP, 0);
759  port_fsm = PORT_SEND_UPDATE;
760  }
761  break;
762  case PORT_NEW_FMC_REQ:
763  //TODO: if processed_FMC_listen_port != 0, we should actually close it?
764  if(!sTcpPortsToOpen.full())
765  {
766  printf("Need FMC port request: %#02x\n",(unsigned int) *piMMIO_FmcLsnPort);
767  sTcpPortsToOpen.write(*piMMIO_FmcLsnPort);
768  current_requested_port = *piMMIO_FmcLsnPort;
769  port_fsm = PORT_NEW_FMC_REP;
770  }
771  break;
772  case PORT_NEW_FMC_REP:
773  if(!sTcpPortsOpenFeedback.empty())
774  {
775  bool fed = sTcpPortsOpenFeedback.read();
776  if(fed)
777  {
778  processed_FMC_listen_port = current_requested_port;
779  printf("FMC Port opened: %#03x\n",(int) processed_FMC_listen_port);
780  } else {
781  printf("[ERROR] FMC TCP port opening failed.\n");
782  //TODO: add block list for ports? otherwise we will try it again and again
783  }
784  current_port_update = NalPortUpdate(FMC, processed_FMC_listen_port);
785  port_fsm = PORT_SEND_UPDATE;
786  }
787  break;
788  case PORT_NEW_UDP_REQ:
789  if(!sUdpPortsToOpen.full())
790  {
791  ap_uint<32> tmp = udp_rx_ports_processed | *pi_udp_rx_ports;
792  ap_uint<32> diff = udp_rx_ports_processed ^ tmp;
793  //printf("rx_ports IN: %#04x\n",(int) *pi_udp_rx_ports);
794  //printf("udp_rx_ports_processed: %#04x\n",(int) udp_rx_ports_processed);
795  printf("UDP port diff: %#04x\n",(unsigned int) diff);
796  if(diff != 0)
797  {//we have to open new ports, one after another
798  new_relative_port_to_req_udp = getRightmostBitPos(diff);
799  UdpPort new_port_to_open = NAL_RX_MIN_PORT + new_relative_port_to_req_udp;
800  sUdpPortsToOpen.write(new_port_to_open);
801  port_fsm = PORT_NEW_UDP_REP;
802  } else {
803  udp_rx_ports_processed = *pi_udp_rx_ports;
804  port_fsm = PORT_IDLE;
805  }
806  }
807  break;
808  case PORT_NEW_UDP_REP:
809  if(!sUdpPortsOpenFeedback.empty())
810  {
811  bool fed = sUdpPortsOpenFeedback.read();
812  if(fed)
813  {
814  udp_rx_ports_processed |= ((ap_uint<32>) 1) << (new_relative_port_to_req_udp);
815  printf("new udp_rx_ports_processed: %#03x\n",(int) udp_rx_ports_processed);
816  } else {
817  printf("[ERROR] UDP port opening failed.\n");
818  //TODO: add block list for ports? otherwise we will try it again and again
819  }
820  //in all cases
821  current_port_update = NalPortUpdate(UDP, udp_rx_ports_processed);
822  port_fsm = PORT_SEND_UPDATE;
823  }
824  break;
825  case PORT_NEW_TCP_REQ:
826  if( !sTcpPortsToOpen.full() )
827  {
828  ap_uint<32> tmp = tcp_rx_ports_processed | *pi_tcp_rx_ports;
829  ap_uint<32> diff = tcp_rx_ports_processed ^ tmp;
830  //printf("rx_ports IN: %#04x\n",(int) *pi_tcp_rx_ports);
831  //printf("tcp_rx_ports_processed: %#04x\n",(int) tcp_rx_ports_processed);
832  printf("TCP port diff: %#04x\n",(unsigned int) diff);
833  if(diff != 0)
834  {//we have to open new ports, one after another
835  new_relative_port_to_req_tcp = getRightmostBitPos(diff);
836  TcpPort new_port = NAL_RX_MIN_PORT + new_relative_port_to_req_tcp;
837  sTcpPortsToOpen.write(new_port);
838  port_fsm = PORT_NEW_TCP_REP;
839  } else {
840  tcp_rx_ports_processed = *pi_tcp_rx_ports;
841  port_fsm = PORT_IDLE;
842  }
843  }
844  break;
845  case PORT_NEW_TCP_REP:
846  if(!sTcpPortsOpenFeedback.empty())
847  {
848  bool fed = sTcpPortsOpenFeedback.read();
849  if(fed)
850  {
851  tcp_rx_ports_processed |= ((ap_uint<32>) 1) << (new_relative_port_to_req_tcp);
852  printf("new tcp_rx_ports_processed: %#03x\n",(int) tcp_rx_ports_processed);
853  } else {
854  printf("[ERROR] TCP port opening failed.\n");
855  //TODO: add block list for ports? otherwise we will try it again and again
856  }
857  //in all cases
858  current_port_update = NalPortUpdate(TCP, tcp_rx_ports_processed);
859  port_fsm = PORT_SEND_UPDATE;
860  }
861  break;
862  case PORT_SEND_UPDATE:
863  if(!sPortUpdate.full())
864  {
865  sPortUpdate.write(current_port_update);
866  port_fsm = PORT_IDLE;
867  }
868  break;
869  }
870 }
#define NAL_CONFIG_SAVED_FMC_PORTS
Definition: nal.hpp:219
#define NAL_CONFIG_SAVED_TCP_PORTS
Definition: nal.hpp:218
#define NAL_MMIO_STABILIZE_TIME
Definition: nal.hpp:199
#define NAL_CONFIG_SAVED_UDP_PORTS
Definition: nal.hpp:217
PortFsmStates
Definition: nal.hpp:175
ap_uint< 32 > getRightmostBitPos(ap_uint< 32 > num)
Definition: nal.cpp:43
ap_uint< 16 > UdpPort
Definition: nal.hpp:249
@ PORT_WAIT_PR
Definition: nal.hpp:177
@ PORT_NEW_FMC_REQ
Definition: nal.hpp:176
#define NAL_RX_MIN_PORT
Definition: network.hpp:89
ap_uint< 16 > config_addr
Definition: nal.hpp:291
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pROLE()

void pROLE ( stream< NetworkWord > &  siTRIF_Data,
stream< NetworkMetaStream > &  siTRIF_meta,
stream< NetworkWord > &  soTRIF_Data,
stream< NetworkMetaStream > &  soTRIF_meta 
)

Emulate the behavior of the ROLE.

Parameters
[in]siTRIF_Data,Datato TcpRoleInterface (TRIF).
[in]siTRIF_meta,Networkmeta data.
[out]soROLE_Data,Datastream to [TRIF].
[out]soROLE_meta,Networkmeta data.

Definition at line 746 of file tb_nal.cpp.

753 {
754  NetworkWord currWord;
755  NetworkMetaStream meta_stream_in;
756  NetworkMetaStream meta_stream_out;
757 
758  const char *myRxName = concat3(THIS_NAME, "/", "ROLE-Rx");
759  const char *myTxName = concat3(THIS_NAME, "/", "ROLE-Tx");
760 
761  switch (roleFsmState ) {
762  case ROLE_WAIT_META:
763  if (!siTRIF_meta.empty() && !soTRIF_meta.full()) {
764  siTRIF_meta.read(meta_stream_in);
765  meta_stream_out = NetworkMetaStream();
766  meta_stream_out.tkeep = 0xFFFF;
767  meta_stream_out.tlast = 1;
768  meta_stream_out.tdata.dst_rank = meta_stream_in.tdata.src_rank;
769  meta_stream_out.tdata.dst_port = meta_stream_in.tdata.src_port;
770  meta_stream_out.tdata.src_port = NAL_RX_MIN_PORT;
771  if(meta_stream_in.tdata.dst_port == 2718)
772  {
773  meta_stream_out.tdata.len = meta_stream_in.tdata.len;
774  } else {
775  meta_stream_out.tdata.len = 0; //test streaming mode
776  }
777  printf("ROLE received stream from Node %d:%d (recv. port %d, length %d)\n", (int) meta_stream_in.tdata.src_rank, (int) meta_stream_in.tdata.src_port, (int) meta_stream_in.tdata.dst_port, (int) meta_stream_in.tdata.len);
778  soTRIF_meta.write(meta_stream_out);
780  }
781  break;
782  case ROLE_STREAM:
783  if (!siTRIF_Data.empty() && !soTRIF_Data.full()) {
784  siTRIF_Data.read(currWord);
785  if (DEBUG_LEVEL & TRACE_ROLE) {
786  printAxiWord(myRxName, currWord);
787  }
788  soTRIF_Data.write(currWord);
789  if (currWord.tlast)
791  } else {
792  printf("[%4.4d] \tERROR: pROLE cant write to NRC.\n", simCnt);
793  }
794  break;
795  }
796 
797 }
#define TRACE_ROLE
Definition: tb_nal.cpp:55
#define DEBUG_LEVEL
Definition: tb_nal.cpp:58
ap_uint< 1 > tlast
Definition: network.hpp:111
ap_uint< 8 > tkeep
Definition: network.hpp:110
NetworkDataLength len
Definition: network.hpp:99
NodeId dst_rank
Definition: network.hpp:95
NrcPort src_port
Definition: network.hpp:98
NrcPort dst_port
Definition: network.hpp:96
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pRoleTcpRxDeq()

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 at line 929 of file tss.cpp.

938 {
939  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
940 #pragma HLS INLINE off
941 #pragma HLS pipeline II=1
942  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
943  static DeqFsmStates deqFsmState = DEQ_WAIT_META;
944 #pragma HLS RESET variable=deqFsmState
945  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
946  static PacketLen current_bytes_written = 0;
947  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
948  NetworkWord cur_word = NetworkWord();
950  bool role_disabled = (*layer_7_enabled == 0 && *role_decoupled == 1);
951 
952  switch(deqFsmState)
953  {
954  default:
955  case DEQ_SEND_NOTIF:
956  if(!role_write_cnt_sig.full())
957  {
958  role_write_cnt_sig.write(current_bytes_written);
959  current_bytes_written = 0;
960  deqFsmState = DEQ_WAIT_META;
961  }
962  break;
963  case DEQ_WAIT_META:
964  if(!sRoleTcpDataRx_buffer.empty() && !sRoleTcpMetaRx_buffer.empty()
965  && ( (!soTcp_data.full() && !soTcp_meta.full()) || //user can read
966  (role_disabled) //role is disabled -> drain FIFOs
967  )
968  )
969  {
970  cur_word = sRoleTcpDataRx_buffer.read();
971  cur_meta = sRoleTcpMetaRx_buffer.read();
972  current_bytes_written = extractByteCnt(cur_word);
973  if(!role_disabled)
974  {
975  soTcp_data.write(cur_word);
976  soTcp_meta.write(cur_meta);
977  }
978  if(cur_word.tlast == 0)
979  {
980  deqFsmState = DEQ_STREAM_DATA;
981  } else {
982  deqFsmState = DEQ_SEND_NOTIF;
983  }
984  }
985  break;
986  case DEQ_STREAM_DATA:
987  if(!sRoleTcpDataRx_buffer.empty()
988  && (!soTcp_data.full() || role_disabled)
989  )
990  {
991  cur_word = sRoleTcpDataRx_buffer.read();
992  current_bytes_written += extractByteCnt(cur_word);
993  if(!role_disabled)
994  {
995  soTcp_data.write(cur_word);
996  }
997  if(cur_word.tlast == 1)
998  {
999  deqFsmState = DEQ_SEND_NOTIF;
1000  }
1001  }
1002  break;
1003  }
1004 
1005 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pRoleUdpRxDeq()

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 at line 673 of file uss.cpp.

681 {
682  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
683 #pragma HLS INLINE off
684 #pragma HLS pipeline II=1
685  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
686  static DeqFsmStates deqFsmState = DEQ_WAIT_META;
687 #pragma HLS RESET variable=deqFsmState
688  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
689  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
690  NetworkWord cur_word = NetworkWord();
692  bool role_disabled = (*layer_7_enabled == 0 || *role_decoupled == 1);
693 
694  switch(deqFsmState)
695  {
696  default:
697  case DEQ_WAIT_META:
698  if(!sRoleUdpDataRx_buffer.empty() && !sRoleUdpMetaRx_buffer.empty()
699  && ( (!soUdp_data.full() && !soUdp_meta.full()) || //user can read
700  (role_disabled) //role is disabled -> drain FIFOs
701  )
702  )
703  {
704  cur_word = sRoleUdpDataRx_buffer.read();
705  cur_meta = sRoleUdpMetaRx_buffer.read();
706  if(!role_disabled)
707  {
708  soUdp_data.write(cur_word);
709  soUdp_meta.write(cur_meta);
710  }
711  if(cur_word.tlast == 0)
712  {
713  deqFsmState = DEQ_STREAM_DATA;
714  }
715  }
716  break;
717  case DEQ_STREAM_DATA:
718  if(!sRoleUdpDataRx_buffer.empty()
719  && (!soUdp_data.full() || role_disabled)
720  )
721  {
722  cur_word = sRoleUdpDataRx_buffer.read();
723  if(!role_disabled)
724  {
725  soUdp_data.write(cur_word);
726  }
727  if(cur_word.tlast == 1)
728  {
729  deqFsmState = DEQ_WAIT_META;
730  }
731  }
732  break;
733  }
734 
735 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pStatusMemory()

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 Axi4Lite address space. Forwards status changes to Axi4Lite processing.

Parameters
[in]internal_event_fifo,themerged event fifo
[in]layer_7_enabled,externalsignal if layer 7 is enabled
[in]role_decoupled,externalsignal if the role is decoupled
[in]sConfigUpdate,notificationof configuration changes
[in]mrt_version_update,notificationof MRT version change
[in]sNalPortUpdate,notificationif ports were opened or closed
[out]sStatusUpdate,thestatus update notification for Axi4Lite proc

Definition at line 180 of file nal.cpp.

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 }
#define NAL_STATUS_FMC_PORT_PROCESSED
Definition: nal.hpp:224
#define NAL_UNAUTHORIZED_ACCESS
Definition: nal.hpp:229
#define NAL_STATUS_LAST_TX_NODE_ID
Definition: nal.hpp:238
#define NAL_STATUS_RX_NODEID_ERROR
Definition: nal.hpp:237
#define NAL_STATUS_PACKET_CNT_TX
Definition: nal.hpp:242
#define NAL_STATUS_LAST_RX_NODE_ID
Definition: nal.hpp:236
#define NAL_STATUS_PACKET_CNT_RX
Definition: nal.hpp:241
#define NAL_STATUS_OWN_RANK
Definition: nal.hpp:225
#define NAL_STATUS_GLOBAL_STATE
Definition: nal.hpp:235
#define NAL_CONFIG_OWN_RANK
Definition: nal.hpp:215
#define NAL_STATUS_OPEN_TCP_PORTS
Definition: nal.hpp:223
#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
@ AUTH_ACCESS
Definition: nal.hpp:183
@ LAST_RX_NID
Definition: nal.hpp:182
ap_uint< 16 > NrcPort
Definition: network.hpp:81
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
Here is the caller graph for this function:

◆ pTcpAgency()

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.

Parameters
[in]sGetTripleFromSid_Req,Requeststream to get the Tcp Triple to a SessionId
[out]sGetTripleFromSid_Rep,Replystream containing Tcp Triple
[in]sGetSidFromTriple_Req,Requeststream to get the SessionId to a Tcp Triple
[out]sGetSidFromTriple_Rep,Replystream containing the SessionId
[in]sAddNewTriple_TcpRrh,Streamcontaining new SessionIds with Triples (from TcpRRh)
[out]sAddNewTriple_TcpCon,Streamcontaining new SessionIds with Triples (from TcpCOn)
[in]sDeleteEntryBySid,Notificationto mark a table entry as closed
[out]inval_del_sig,Notificationof connection closing to Cache Invalidation Logic
[in]sMarkAsPriv,Notificationto mark a session as prvileged
[in]sMarkToDel_unpriv,Signalto mark all un-privileged sessions as to-be-deleted
[in]sGetNextDelRow_Req,Requestto get the next sesseion that is marked as to-be-deleted
[out]sGetNextDelRow_Rep,Replycontainin the SessionId of the next to-be-deleted session

Definition at line 1017 of file hss.cpp.

1031 {
1032  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
1033 #pragma HLS INLINE off
1034 #pragma HLS pipeline II=1
1035 
1036  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
1037  //static TableFsmStates agencyFsm = TAB_FSM_READ;
1038  static bool tables_initialized = false;
1039 
1040  //#pragma HLS RESET variable=agencyFsm
1041 #pragma HLS RESET variable=tables_initialized
1042  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
1043  static NalTriple tripleList[MAX_NAL_SESSIONS];
1044  static SessionId sessionIdList[MAX_NAL_SESSIONS];
1045  static ap_uint<1> usedRows[MAX_NAL_SESSIONS];
1046  static ap_uint<1> rowsToDelete[MAX_NAL_SESSIONS];
1047  static ap_uint<1> privilegedRows[MAX_NAL_SESSIONS];
1048 
1049 #pragma HLS ARRAY_PARTITION variable=tripleList complete dim=1
1050 #pragma HLS ARRAY_PARTITION variable=sessionIdList complete dim=1
1051 #pragma HLS ARRAY_PARTITION variable=usedRows complete dim=1
1052 #pragma HLS ARRAY_PARTITION variable=rowsToDelete complete dim=1
1053 #pragma HLS ARRAY_PARTITION variable=privilegedRows complete dim=1
1054 
1055  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
1056 
1057 
1058  if (!tables_initialized)
1059  {
1060  printf("init tables...\n");
1061  for(int i = 0; i<MAX_NAL_SESSIONS; i++)
1062  {
1063  //#pragma HLS unroll
1064  sessionIdList[i] = 0;
1065  tripleList[i] = 0;
1066  usedRows[i] = 0;
1067  rowsToDelete[i] = 0;
1068  privilegedRows[i] = 0;
1069  }
1070  tables_initialized = true;
1071  } else {
1072 
1073  //switch(agencyFsm)
1074  //{
1075  //case TAB_FSM_READ:
1076  if(!sGetTripleFromSid_Req.empty() && !sGetTripleFromSid_Rep.full())
1077  {
1078  SessionId sessionID = sGetTripleFromSid_Req.read();
1079  printf("searching for session: %d\n", (int) sessionID);
1080  uint32_t i = 0;
1082  bool found_smth = false;
1083  for(i = 0; i < MAX_NAL_SESSIONS; i++)
1084  {
1085  //#pragma HLS unroll factor=8
1086  if(sessionIdList[i] == sessionID && usedRows[i] == 1 && rowsToDelete[i] == 0)
1087  {
1088  ret = tripleList[i];
1089  printf("found triple entry: %d | %d | %llu\n",(int) i, (int) sessionID, (unsigned long long) ret);
1090  found_smth = true;
1091  break;
1092  }
1093  }
1094  if(!found_smth)
1095  {
1096  //unkown session TODO
1097  printf("[TcpAgency:INFO] Unknown session requested\n");
1098  }
1099  sGetTripleFromSid_Rep.write(ret);
1100  } else if(!sGetSidFromTriple_Req.empty() && !sGetSidFromTriple_Rep.full())
1101  {
1102  NalTriple triple = sGetSidFromTriple_Req.read();
1103  printf("Searching for triple: %llu\n", (unsigned long long) triple);
1104  uint32_t i = 0;
1106  bool found_smth = false;
1107  for(i = 0; i < MAX_NAL_SESSIONS; i++)
1108  {
1109  //#pragma HLS unroll factor=8
1110  if(tripleList[i] == triple && usedRows[i] == 1 && rowsToDelete[i] == 0)
1111  {
1112  ret = sessionIdList[i];
1113  found_smth = true;
1114  break;
1115  }
1116  }
1117  if(!found_smth)
1118  {
1119  //there is (not yet) a connection TODO
1120  printf("[TcpAgency:INFO] Unknown triple requested\n");
1121  }
1122  sGetSidFromTriple_Rep.write(ret);
1123  } else
1124  // agencyFsm = TAB_FSM_WRITE;
1125  // break;
1126  //case TAB_FSM_WRITE:
1127  if(!sAddNewTriple_TcpRrh.empty() || !sAddNewTriple_TcpCon.empty())
1128  {
1129  NalNewTableEntry ne_struct;
1130  if(!sAddNewTriple_TcpRrh.empty())
1131  {
1132  ne_struct = sAddNewTriple_TcpRrh.read();
1133  } else {
1134  ne_struct = sAddNewTriple_TcpCon.read();
1135  }
1136  SessionId sessionID = ne_struct.sessId;
1137  NalTriple new_entry = ne_struct.new_triple;
1138  printf("new tripple entry: %d | %llu\n",(int) sessionID, (unsigned long long) new_entry);
1139  //first check for duplicates!
1140  //ap_uint<64> test_tripple = getTrippleFromSessionId(sessionID);
1141  uint32_t i = 0;
1143  bool found_smth = false;
1144  for(i = 0; i < MAX_NAL_SESSIONS; i++)
1145  {
1146  //#pragma HLS unroll factor=8
1147  if(sessionIdList[i] == sessionID && usedRows[i] == 1 && rowsToDelete[i] == 0)
1148  {
1149  ret = tripleList[i];
1150  printf("found triple entry: %d | %d | %llu\n",(int) i, (int) sessionID, (unsigned long long) ret);
1151  found_smth = true;
1152  break;
1153  }
1154  }
1155  if(found_smth)
1156  {
1157  printf("session/triple already known, skipping. \n");
1158  //break; no break, because other may want to run too
1159  } else {
1160  bool stored = false;
1161  uint32_t i = 0;
1162  for(i = 0; i < MAX_NAL_SESSIONS; i++)
1163  {
1164  //#pragma HLS unroll factor=8
1165  if(usedRows[i] == 0)
1166  {//next free one, tables stay in sync
1167  sessionIdList[i] = sessionID;
1168  tripleList[i] = new_entry;
1169  usedRows[i] = 1;
1170  privilegedRows[i] = 0;
1171  printf("stored triple entry: %d | %d | %llu\n",(int) i, (int) sessionID, (unsigned long long) new_entry);
1172  stored = true;
1173  break;
1174  }
1175  }
1176  if(!stored)
1177  {
1178  //we run out of sessions... TODO
1179  //actually, should not happen, since we have same table size as TOE
1180  printf("[TcpAgency:ERROR] no free space left in table!\n");
1181  }
1182  }
1183  } else if(!sDeleteEntryBySid.empty() && !inval_del_sig.full())
1184  {
1185  SessionId sessionID = sDeleteEntryBySid.read();
1186  printf("try to delete session: %d\n", (int) sessionID);
1187  for(uint32_t i = 0; i < MAX_NAL_SESSIONS; i++)
1188  {
1189  //#pragma HLS unroll factor=8
1190  if(sessionIdList[i] == sessionID && usedRows[i] == 1)
1191  {
1192  usedRows[i] = 0;
1193  privilegedRows[i] = 0;
1194  printf("found and deleting session: %d\n", (int) sessionID);
1195  //notify cache invalidation
1196  inval_del_sig.write(true);
1197  break;
1198  }
1199  }
1200  //nothing to delete, nothing to do...
1201  } else if(!sMarkAsPriv.empty())
1202  {
1203  SessionId sessionID = sMarkAsPriv.read();
1204  printf("mark session as privileged: %d\n", (int) sessionID);
1205  for(uint32_t i = 0; i < MAX_NAL_SESSIONS; i++)
1206  {
1207  //#pragma HLS unroll factor=8
1208  if(sessionIdList[i] == sessionID && usedRows[i] == 1)
1209  {
1210  privilegedRows[i] = 1;
1211  rowsToDelete[i] = 0;
1212  return;
1213  }
1214  }
1215  //nothing found, nothing to do...
1216  } else if(!sMarkToDel_unpriv.empty())
1217  {
1218  if(sMarkToDel_unpriv.read())
1219  {
1220  for(uint32_t i = 0; i< MAX_NAL_SESSIONS; i++)
1221  {
1222  //#pragma HLS unroll factor=8
1223  if(privilegedRows[i] == 1)
1224  {
1225  continue;
1226  } else {
1227  rowsToDelete[i] = usedRows[i];
1228  }
1229  }
1230  }
1231  } else if(!sGetNextDelRow_Req.empty() && !sGetNextDelRow_Rep.full())
1232  {
1233  if(sGetNextDelRow_Req.read())
1234  {
1236  bool found_smth = false;
1237  for(uint32_t i = 0; i< MAX_NAL_SESSIONS; i++)
1238  {
1239  //#pragma HLS unroll factor=8
1240  if(rowsToDelete[i] == 1)
1241  {
1242  ret = sessionIdList[i];
1243  //sessionIdList[i] = 0x0; //not necessary
1244  //tripleList[i] = 0x0;
1245  usedRows[i] = 0;
1246  rowsToDelete[i] = 0;
1247  //privilegedRows[i] = 0; //not necessary
1248  printf("Closing session %d at table row %d.\n",(int) ret, (int) i);
1249  found_smth = true;
1250  break;
1251  }
1252  }
1253  if(!found_smth)
1254  {
1255  //Tables are empty
1256  printf("TCP tables are empty\n");
1257  }
1258  sGetNextDelRow_Rep.write(ret);
1259  }
1260  }
1261  //agencyFsm = TAB_FSM_READ;
1262  //break;
1263  //} //switch
1264  } // else
1265 }
#define UNUSED_SESSION_ENTRY_VALUE
Definition: nal.hpp:202
#define UNUSED_TABLE_ENTRY_VALUE
Definition: nal.hpp:201
#define MAX_NAL_SESSIONS
Definition: nal.hpp:186
ap_uint< 16 > SessionId
Definition: nts_types.hpp:136
NalTriple new_triple
Definition: nal.hpp:276
SessionId sessId
Definition: nal.hpp:277
Here is the caller graph for this function:

◆ pTcpCls()

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.

Parameters
[out]soTOE_ClsReq,closeconnection request to TOE.
[in]sGetNextDelRow_Req,requeststream to TCP Agency
[in]sGetNextDelRow_Rep,replystream rom TCP Agency
[in]sStartTclCls,startsignal from pPortLogic

Definition at line 1892 of file tss.cpp.

1898 {
1899  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
1900 #pragma HLS INLINE off
1901 #pragma HLS pipeline II=1
1902 
1903 
1904  char *myName = concat3(THIS_NAME, "/", "Tcp_Cls");
1905 
1906 
1907  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
1908  static ClsFsmStates clsFsmState_Tcp = CLS_IDLE;
1909 
1910 #pragma HLS RESET variable=clsFsmState_Tcp
1911  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
1912 
1913 
1914  switch (clsFsmState_Tcp) {
1915  default:
1916  case CLS_IDLE:
1917  //we wait until we are activated;
1918  if(!sStartTclCls.empty())
1919  {
1920  if(sStartTclCls.read())
1921  {
1922  clsFsmState_Tcp = CLS_NEXT;
1923  }
1924  }
1925  break;
1926  case CLS_NEXT:
1927  if(!sGetNextDelRow_Req.full())
1928  {
1929  sGetNextDelRow_Req.write(true);
1930  clsFsmState_Tcp = CLS_WAIT4RESP;
1931  }
1932  break;
1933  case CLS_WAIT4RESP:
1934  if(!soTOE_ClsReq.full() && !sGetNextDelRow_Rep.empty())
1935  {
1936  SessionId nextToDelete = sGetNextDelRow_Rep.read();
1937  if(nextToDelete != (SessionId) UNUSED_SESSION_ENTRY_VALUE)
1938  {
1939  soTOE_ClsReq.write(nextToDelete);
1940  clsFsmState_Tcp = CLS_NEXT;
1941  } else {
1942  clsFsmState_Tcp = CLS_IDLE;
1943  }
1944  }
1945  break;
1946  }
1947 }
ClsFsmStates
Definition: nal.hpp:162
Here is the caller graph for this function:

◆ pTcpCOn()

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).

Parameters
[out]soTOE_OpnReq,openconnection request to TOE.
[in]siTOE_OpnRep,openconnection reply from TOE.
[out]sAddNewTriple_TcpCon,Notificationfor the TCP Agency to add a new Triple/SessionId pair
[in]sNewTcpCon_Req,Requeststream from pTcpWRp to open a new connection
[out]sNewTcpCon_Rep,Replystream to pTcpWRp

Definition at line 1751 of file tss.cpp.

1758 {
1759  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
1760 #pragma HLS INLINE off
1761 #pragma HLS pipeline II=1
1762 
1763 
1764  char *myName = concat3(THIS_NAME, "/", "Tcp_COn");
1765 
1766 
1767  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
1768  static OpnFsmStates opnFsmState = OPN_IDLE;
1769  // Set a startup delay long enough to account for the initialization
1770  // of TOE's listen port table which takes 32,768 cycles after reset.
1771  // [FIXME - StartupDelay must be replaced by a piSHELL_Reday signal]
1772 #ifdef __SYNTHESIS_
1773  static ap_uint<16> startupDelay = 0x8000;
1774 #else
1775  static ap_uint<16> startupDelay = 30;
1776 #endif
1777 
1778 #pragma HLS RESET variable=opnFsmState
1779 #pragma HLS RESET variable=startupDelay
1780  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
1781  static ap_uint<32> watchDogTimer_pcon = 0;
1782  static TcpAppOpnReq HostSockAddr; // Socket Address stored in LITTLE-ENDIAN ORDER
1783  static NalTriple triple_for_new_connection = 0x0;
1784 
1785  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
1786  TcpAppOpnRep newConn;
1787 
1788 
1789  switch (opnFsmState)
1790  {
1791 
1792  case OPN_IDLE:
1793  if (startupDelay > 0)
1794  {
1795  startupDelay--;
1796  //Drain any potential status data
1797  //TODO?
1798  //if (!siTOE_OpnRep.empty())
1799  //{
1800  // siTOE_OpnRep.read(newConn);
1801  // //printInfo(myName, "Requesting to close sessionId=%d.\n", newConn.sessId.to_uint());
1802  // //soTOE_ClsReq.write(newConn.sessId);
1803  //}
1804  } else {
1805  opnFsmState = OPN_REQ;
1806  }
1807  break;
1808 
1809  case OPN_REQ:
1810  if (!sNewTcpCon_Req.empty() && !soTOE_OpnReq.full())
1811  {
1812  triple_for_new_connection = sNewTcpCon_Req.read();
1813  Ip4Addr remoteIp = getRemoteIpAddrFromTriple(triple_for_new_connection);
1814  TcpPort remotePort = getRemotePortFromTriple(triple_for_new_connection);
1815 
1816  SockAddr hostSockAddr(remoteIp, remotePort);
1817  HostSockAddr.addr = hostSockAddr.addr;
1818  HostSockAddr.port = hostSockAddr.port;
1819  soTOE_OpnReq.write(HostSockAddr);
1820  if (DEBUG_LEVEL & TRACE_CON) {
1821  printInfo(myName, "Client is requesting to connect to remote socket:\n");
1822  printSockAddr(myName, HostSockAddr);
1823  }
1824 #ifndef __SYNTHESIS__
1825  watchDogTimer_pcon = 10;
1826 #else
1827  watchDogTimer_pcon = NAL_CONNECTION_TIMEOUT;
1828 #endif
1829  opnFsmState = OPN_REP;
1830  }
1831  break;
1832 
1833  case OPN_REP:
1834  if(!sAddNewTriple_TcpCon.full() && !sNewTcpCon_Rep.full())
1835  {
1836  watchDogTimer_pcon--;
1837  if (!siTOE_OpnRep.empty())
1838  {
1839  // Read the reply stream
1840  siTOE_OpnRep.read(newConn);
1841  if (newConn.tcpState == ESTABLISHED) {
1842  if (DEBUG_LEVEL & TRACE_CON) {
1843  printInfo(myName, "Client successfully connected to remote socket:\n");
1844  printSockAddr(myName, HostSockAddr);
1845  }
1846  NalNewTableEntry ne_struct = NalNewTableEntry(triple_for_new_connection, newConn.sessId);
1847  sAddNewTriple_TcpCon.write(ne_struct);
1848  opnFsmState = OPN_DONE;
1849  NalNewTcpConRep con_rep = NalNewTcpConRep(triple_for_new_connection, newConn.sessId, false);
1850  sNewTcpCon_Rep.write(con_rep);
1851  }
1852  else {
1853  printError(myName, "Client failed to connect to remote socket:\n");
1854  printSockAddr(myName, HostSockAddr);
1855  opnFsmState = OPN_DONE;
1856  NalNewTcpConRep con_rep = NalNewTcpConRep(triple_for_new_connection, UNUSED_SESSION_ENTRY_VALUE, true);
1857  sNewTcpCon_Rep.write(con_rep);
1858  }
1859  }
1860  else {
1861  if (watchDogTimer_pcon == 0) {
1862  if (DEBUG_LEVEL & TRACE_CON) {
1863  printError(myName, "Timeout: Failed to connect to the following remote socket:\n");
1864  printSockAddr(myName, HostSockAddr);
1865  }
1866  //the packet will be dropped, so we are done
1867  opnFsmState = OPN_DONE;
1868  NalNewTcpConRep con_rep = NalNewTcpConRep(triple_for_new_connection, UNUSED_SESSION_ENTRY_VALUE, true);
1869  sNewTcpCon_Rep.write(con_rep);
1870  }
1871 
1872  }
1873  }
1874  break;
1875  case OPN_DONE:
1876  //No need to wait...
1877  opnFsmState = OPN_REQ;
1878  break;
1879  } //switch
1880 }
Ip4Addr addr
Definition: nts_types.hpp:209
Ly4Port port
Definition: nts_types.hpp:210
SessionId sessId
Definition: nts.hpp:167
TcpState tcpState
Definition: nts.hpp:168
#define TRACE_CON
Definition: nal.hpp:120
OpnFsmStates
Definition: nal.hpp:144
Ip4Addr getRemoteIpAddrFromTriple(NalTriple triple)
Definition: nal.cpp:70
TcpPort getRemotePortFromTriple(NalTriple triple)
Definition: nal.cpp:78
#define NAL_CONNECTION_TIMEOUT
Definition: nal.hpp:196
#define printError(callerName, format,...)
A macro to print an error message.
Definition: nts_utils.hpp:195
#define printInfo(callerName, format,...)
A macro to print an information message.
Definition: nts_utils.hpp:169
@ ESTABLISHED
Definition: nts_types.hpp:296
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pTcpLsn()

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 (.i.e open connection for reception mode).

Parameters
[out]soTOE_LsnReq,listenport request to TOE.
[in]siTOE_LsnRep,listenport acknowledge from TOE.
[in]sTcpPortsToOpen,portopen request from pPortLogic
[out]sTcpPortsOpenFeedback,feedbackto pPortLogic
Warning
The Port Table (PRt) supports two port ranges; one for static ports (0 to 32,767) which are used for listening ports, and one for dynamically assigned or ephemeral ports (32,768 to 65,535) which are used for active connections. Therefore, listening port numbers must be in the range 0 to 32,767.

Definition at line 53 of file tss.cpp.

59 {
60  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
61 #pragma HLS INLINE off
62 #pragma HLS pipeline II=1
63 
64  char* myName = concat3(THIS_NAME, "/", "Tcp_LSn");
65 
66  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
67  static LsnFsmStates lsnFsmState = LSN_IDLE;
68 #ifdef __SYNTHESIS_
69  static ap_uint<16> startupDelay = 0x8000;
70 #else
71  static ap_uint<16> startupDelay = 5;
72 #endif
73 
74 #pragma HLS RESET variable=lsnFsmState
75 #pragma HLS RESET variable=startupDelay
76  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
77  static ap_uint<8> watchDogTimer_plisten = 0;
78  ap_uint<16> new_absolute_port = 0;
79 
80 
81  switch (lsnFsmState) {
82 
83  default:
84  case LSN_IDLE:
85  if (startupDelay > 0)
86  {
87  startupDelay--;
88  } else {
89  lsnFsmState = LSN_SEND_REQ;
90  }
91  break;
92 
93  case LSN_SEND_REQ: //we arrive here only if need_tcp_port_req == true
94  if (!soTOE_LsnReq.full() && !sTcpPortsToOpen.empty())
95  {
96  new_absolute_port = sTcpPortsToOpen.read();
97  TcpAppLsnReq tcpListenPort = new_absolute_port;
98  soTOE_LsnReq.write(tcpListenPort);
99  if (DEBUG_LEVEL & TRACE_LSN) {
100  printInfo(myName, "Server is requested to listen on port #%d (0x%4.4X).\n",
101  (int) new_absolute_port, (int) new_absolute_port);
102 #ifndef __SYNTHESIS__
103  watchDogTimer_plisten = 10;
104 #else
105  watchDogTimer_plisten = 100;
106 #endif
107  lsnFsmState = LSN_WAIT_ACK;
108  }
109  }
110  //else {
111  // printWarn(myName, "Cannot send a listen port request to [TOE] because stream is full!\n");
112  //}
113  break;
114 
115  case LSN_WAIT_ACK:
116  if (!siTOE_LsnRep.empty() && !sTcpPortsOpenFeedback.full())
117  {
118  bool listenDone;
119  siTOE_LsnRep.read(listenDone);
120  if (listenDone) {
121  printInfo(myName, "Received listen acknowledgment from [TOE].\n");
122  lsnFsmState = LSN_SEND_REQ;
123  sTcpPortsOpenFeedback.write(true);
124  }
125  else {
126  printWarn(myName, "TOE denied listening on port %d (0x%4.4X).\n",
127  (int) new_absolute_port, (int) new_absolute_port);
128  sTcpPortsOpenFeedback.write(false);
129  lsnFsmState = LSN_SEND_REQ;
130  }
131  } else if (watchDogTimer_plisten == 0 && !sTcpPortsOpenFeedback.full() )
132  {
133  ap_uint<16> new_absolute_port = 0;
134  printError(myName, "Timeout: Server failed to listen on port %d %d (0x%4.4X).\n",
135  (int) new_absolute_port, (int) new_absolute_port);
136  sTcpPortsOpenFeedback.write(false);
137  lsnFsmState = LSN_SEND_REQ;
138  } else {
139  watchDogTimer_plisten--;
140  }
141  break;
142 
143  } //switch
144 }
LsnFsmStates
Definition: nal.hpp:146
#define TRACE_LSN
Definition: nal.hpp:119
TcpPort TcpAppLsnReq
Definition: nts.hpp:190
#define printWarn(callerName, format,...)
A macro to print a warning message.
Definition: nts_utils.hpp:182
Here is the caller graph for this function:

◆ pTcpRDp()

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 it to ROLE or FMC. Invalid packets are dropped.

Parameters
[in]layer_4_enabled,externalsignal if layer 4 is enabled
[in]piNTS_ready,externalsignal if NTS is up and running
[in]sRDp_ReqNotif,NotifiespTcpRDp about a n incoming TCP chunk
[in]siTOE_Data,Datafrom [TOE].
[in]siTOE_SessId,SessionId from [TOE].
[out]soFmc_data,Datafor FMC
[out]soFmc_meta,Metadatafor FMC
[out]soTcp_data,Datato [ROLE].
[out]soTcp_meta,MetaData to [ROLE].
[in]sConfigUpdate,notificationof configuration changes
[out]sGetNidReq_TcpRx,Requeststream for the the MRT Agency
[in]sGetNidRep_TcpRx,Replystream from the MRT Agency
[out]&sGetTripleFromSid_Req,Requeststream for the the TCP Agency
[in]&sGetTripleFromSid_Rep,Replystream from the TCO Agency
[in]piMMIO_CfrmIp4Addr,theIP address of the CFRM (from MMIO)
[in]piMMIO_FmcLsnPort,themanagement listening port (from MMIO)
[in]layer_7_enabled,externalsignal if layer 7 is enabled
[in]role_decoupled,externalsignal if the role is decoupled
[in]cache_inval_sig,Signalfrom the Cache Invalidation Logic
[out]internal_event_fifo,Fifofor event reporting

Definition at line 581 of file tss.cpp.

603 {
604  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
605 #pragma HLS INLINE off
606 #pragma HLS pipeline II=1
607 
608 
609  char* myName = concat3(THIS_NAME, "/", "Tcp_RDp");
610 
611 
612  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
613  static RdpFsmStates rdpFsmState = RDP_RESET;
614  static ap_uint<64> cached_tcp_rx_triple = UNUSED_TABLE_ENTRY_VALUE;
615  //static bool Tcp_RX_metaWritten = false;
616  static SessionId cached_tcp_rx_session_id = UNUSED_SESSION_ENTRY_VALUE;
617  static NodeId own_rank = 0;
618  static NodeId cached_src_id = INVALID_MRT_VALUE;
619  static bool cache_init = false;
620  static uint8_t evs_loop_i = 0;
621 
622 
623 #pragma HLS RESET variable=rdpFsmState
624 #pragma HLS RESET variable=cached_tcp_rx_triple
625  //#pragma HLS RESET variable=Tcp_RX_metaWritten
626 #pragma HLS RESET variable=cached_tcp_rx_session_id
627 #pragma HLS RESET variable=cached_src_id
628 #pragma HLS RESET variable=cache_init
629 #pragma HLS RESET variable=own_rank
630 #pragma HLS RESET variable=evs_loop_i
631 
632  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
633  static SessionId session_toFMC = 0;
634  static NetworkMetaStream in_meta_tcp = NetworkMetaStream();
635  static bool first_word_written = false;
636  static TcpAppData first_word = TcpAppData();
637  static NodeId src_id = INVALID_MRT_VALUE;
638  static ap_uint<64> triple_in = UNUSED_TABLE_ENTRY_VALUE;
639  static Ip4Addr remoteAddr = Ip4Addr();
640  static TcpPort dstPort = 0x0;
641  static TcpPort srcPort = 0x0;
642  static bool found_in_cache = false;
643  static AppMeta sessId = 0x0;
644  static NetworkDataLength current_length = 0;
645  static ap_uint<32> fmc_tcp_bytes_cnt = 0;
646 
647  static stream<NalEventNotif> evsStreams[7];
648 
649  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
650  TcpAppData currWord;
651  NalEventNotif new_ev_not;
652  NetworkMeta tmp_meta;
653 
654 
655  switch (rdpFsmState)
656  {
657 
658  default:
659  case RDP_RESET:
660  if(*layer_4_enabled == 1 && *piNTS_ready == 1)
661  {
662  cache_init = false;
663  fmc_tcp_bytes_cnt = 0;
664  current_length = 0;
665  rdpFsmState = RDP_WAIT_META;
666  } else {
667  if(!sRDp_ReqNotif.empty() )
668  {
669  sRDp_ReqNotif.read();
670  }
671  if(!siTOE_SessId.empty())
672  {
673  siTOE_SessId.read();
674  }
675  if(!siTOE_Data.empty())
676  {
677  siTOE_Data.read();
678  }
679  }
680  break;
681  case RDP_WAIT_META:
682  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
683  {
684  rdpFsmState = RDP_RESET;
685  }
686  else if(!cache_inval_sig.empty())
687  {
688  if(cache_inval_sig.read())
689  {
690  cached_tcp_rx_session_id = UNUSED_SESSION_ENTRY_VALUE;
691  cached_tcp_rx_triple = UNUSED_TABLE_ENTRY_VALUE;
692  cached_src_id = INVALID_MRT_VALUE;
693  cache_init = false;
694  }
695  break;
696  } else if(!sConfigUpdate.empty())
697  {
698  NalConfigUpdate ca = sConfigUpdate.read();
700  {
701  own_rank = (NodeId) ca.update_value;
702  cache_init = false;
703  }
704  break;
705  }
706  else if (!sRDp_ReqNotif.empty()
707  && !sGetTripleFromSid_Req.full()
708  )
709  {
710  TcpAppRdReq new_req = sRDp_ReqNotif.read();
711  sessId = new_req.sessionID;
712  current_length = new_req.length;
713 
714  triple_in = UNUSED_TABLE_ENTRY_VALUE;
715  found_in_cache = false;
716  if(cache_init && sessId == cached_tcp_rx_session_id)
717  {
718  printf("used TCP RX tripple and NID cache.\n");
719  triple_in = cached_tcp_rx_triple;
720  src_id = cached_src_id;
721  found_in_cache = true;
722  rdpFsmState = RDP_FILTER_META;
723  } else {
724  sGetTripleFromSid_Req.write(sessId);
725  rdpFsmState = RDP_W8FORREQS_1;
726  cache_init = false;
727  printf("[Tcp-RDP:INFO] Need to request session and node id.\n");
728  }
729  }
730  break;
731 
732  case RDP_W8FORREQS_1:
733  if(!sGetTripleFromSid_Rep.empty() && !sGetNidReq_TcpRx.full())
734  {
735  triple_in = sGetTripleFromSid_Rep.read();
736  remoteAddr = getRemoteIpAddrFromTriple(triple_in);
737  dstPort = getLocalPortFromTriple(triple_in);
738  if(dstPort != *piMMIO_FmcLsnPort)
739  {
740  sGetNidReq_TcpRx.write(remoteAddr);
741  printf("[TCP-RX:INFO] need to ask for Node ID.\n");
742  rdpFsmState = RDP_W8FORREQS_2;
743  } else {
744  printf("[TCP-RX:INFO] found possible FMC connection, write to cache.\n");
745  cache_init = true;
746  cached_src_id = INVALID_MRT_VALUE;
747  cached_tcp_rx_session_id = sessId;
748  cached_tcp_rx_triple = triple_in;
749  rdpFsmState = RDP_FILTER_META;
750  }
751  }
752  break;
753 
754  case RDP_W8FORREQS_2:
755  if(!sGetNidRep_TcpRx.empty())
756  {
757 
758  src_id = sGetNidRep_TcpRx.read();
759  cache_init = true;
760  cached_src_id = src_id;
761  cached_tcp_rx_session_id = sessId;
762  cached_tcp_rx_triple = triple_in;
763  rdpFsmState = RDP_FILTER_META;
764  }
765  break;
766 
767  case RDP_FILTER_META:
768  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
769  {
770  rdpFsmState = RDP_RESET;
771  }
772  else if(!siTOE_SessId.empty()
773  && !soTcp_meta.full() && !soFMC_SessId.full()
774  )
775  {
776  TcpAppMeta controll_id = siTOE_SessId.read();
777  if(controll_id != sessId)
778  {//actually, should not happen
779  printf("[TCP-RDp:PANIC] We received data that we didn't expect...\n");
780  //SINK packet
781  //new_ev_not = NalEventNotif(NID_MISS_RX, 1);
782  //evsStreams[9].write_nb(new_ev_not);
783  rdpFsmState = RDP_DROP_PACKET;
784  printf("NRC drops the packet...\n");
785  cache_init = false;
786  break;
787  }
788 
789  printf("tripple_in: %llu\n",(unsigned long long) triple_in);
790  //since we requested the session, we should know it -> no error handling
791  dstPort = getLocalPortFromTriple(triple_in);
792  srcPort = getRemotePortFromTriple(triple_in);
793  remoteAddr = getRemoteIpAddrFromTriple(triple_in);
794  printf("remote Addr: %d; dstPort: %d; srcPort %d\n", (int) remoteAddr, (int) dstPort, (int) srcPort);
795 
796  if(dstPort == *piMMIO_FmcLsnPort)
797  {
798  if(remoteAddr == *piMMIO_CfrmIp4Addr)
799  {//valid connection to FMC
800  printf("found valid FMC connection.\n");
801  session_toFMC = sessId;
802  soFMC_SessId.write(session_toFMC);
803  fmc_tcp_bytes_cnt = 0;
804  rdpFsmState = RDP_STREAM_FMC;
805  new_ev_not = NalEventNotif(AUTH_ACCESS, 1);
806  evsStreams[0].write_nb(new_ev_not);
807  //done by RRh
808  //if(!found_in_cache)
809  //{
810  // //markSessionAsPrivileged(sessId);
811  // sMarkAsPriv.write(sessId);
812  //}
813  break;
814  } else {
815  new_ev_not = NalEventNotif(UNAUTH_ACCESS, 1);
816  evsStreams[1].write_nb(new_ev_not);
817  printf("unauthorized access to FMC!\n");
818  rdpFsmState = RDP_DROP_PACKET;
819  printf("NRC drops the packet...\n");
820  cache_init = false;
821  break;
822  }
823  }
824 
825  printf("TO ROLE: src_rank: %d\n", (int) src_id);
826  //Role packet
827  if(src_id == INVALID_MRT_VALUE
828  || *layer_7_enabled == 0 || *role_decoupled == 1)
829  {
830  //SINK packet
831  new_ev_not = NalEventNotif(NID_MISS_RX, 1);
832  evsStreams[2].write_nb(new_ev_not);
833  rdpFsmState = RDP_DROP_PACKET;
834  printf("NRC drops the packet...\n");
835  cache_init = false;
836  break;
837  }
838  new_ev_not = NalEventNotif(LAST_RX_NID, src_id);
839  evsStreams[3].write_nb(new_ev_not);
840  new_ev_not = NalEventNotif(LAST_RX_PORT, dstPort);
841  evsStreams[4].write_nb(new_ev_not);
842  tmp_meta = NetworkMeta(own_rank, dstPort, src_id, srcPort, current_length);
843  in_meta_tcp = NetworkMetaStream(tmp_meta);
844 
845  //write meta
846  soTcp_meta.write(in_meta_tcp);
847  new_ev_not = NalEventNotif(PACKET_RX, 1);
848  evsStreams[5].write_nb(new_ev_not);
849  rdpFsmState = RDP_STREAM_ROLE;
850  }
851  break;
852  case RDP_STREAM_ROLE:
853  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
854  {
855  rdpFsmState = RDP_RESET;
856  }
857  else if (!siTOE_Data.empty() && !soTcp_data.full())
858  {
859  siTOE_Data.read(currWord);
860  NetworkWord tcpWord = NetworkWord(currWord.getLE_TData(), currWord.getLE_TKeep(), currWord.getLE_TLast());
861  soTcp_data.write(tcpWord);
862  if (currWord.getTLast() == 1)
863  {
864  rdpFsmState = RDP_WAIT_META;
865  }
866  }
867  break;
868 
869  case RDP_STREAM_FMC:
870  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
871  {
872  rdpFsmState = RDP_RESET;
873  }
874  else if (!siTOE_Data.empty()
875  && !soFMC_data.full()
876  )
877  {
878  siTOE_Data.read(currWord);
879  NetworkWord tcpWord = NetworkWord(currWord.getLE_TData(), currWord.getLE_TKeep(), currWord.getLE_TLast());
880  soFMC_data.write(tcpWord);
881  fmc_tcp_bytes_cnt += extractByteCnt(currWord);
882  if (currWord.getTLast() == 1)
883  {
884  new_ev_not = NalEventNotif(FMC_TCP_BYTES, fmc_tcp_bytes_cnt);
885  evsStreams[6].write_nb(new_ev_not);
886  rdpFsmState = RDP_WAIT_META;
887  }
888  }
889  break;
890 
891  case RDP_DROP_PACKET:
892  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
893  {
894  rdpFsmState = RDP_RESET;
895  }
896  else if( !siTOE_Data.empty() )
897  {
898  siTOE_Data.read(currWord);
899  if (currWord.getTLast() == 1)
900  {
901  rdpFsmState = RDP_WAIT_META;
902  cache_init = false;
903  }
904  }
905  break;
906  } // switch case
907 
908  //-- ALWAYS -----------------------
909  if(!internal_event_fifo.full())
910  {
911  if(!evsStreams[evs_loop_i].empty())
912  {
913  internal_event_fifo.write(evsStreams[evs_loop_i].read());
914  }
915  evs_loop_i++;
916  if(evs_loop_i >= 7)
917  {
918  evs_loop_i = 0;
919  }
920  }
921 
922 }
LE_tData getLE_TData(int leHi=64 -1, int leLo=0) const
Definition: AxisRaw.hpp:260
LE_tLast getLE_TLast() const
Definition: AxisRaw.hpp:268
TcpDatLen length
Definition: nts.hpp:117
SessionId sessionID
Definition: nts.hpp:116
RdpFsmStates
Definition: nal.hpp:152
TcpPort getLocalPortFromTriple(NalTriple triple)
Definition: nal.cpp:86
AxisRaw TcpAppData
Definition: nts.hpp:68
TcpSessId TcpAppMeta
Definition: nts.hpp:74
ap_uint< 16 > NetworkDataLength
Definition: network.hpp:92
TcpSessId AppMeta
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pTcpRRh()

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 ROLE or FMC.

Parameters
[in]layer_4_enabled,externalsignal if layer 4 is enabled
[in]piNTS_ready,externalsignal if NTS is up and running
[in]piMMIO_CfrmIp4Addr,theIP address of the CFRM (from MMIO)
[in]piMMIO_FmcLsnPort,themanagement listening port (from MMIO)
[in]siTOE_Notif,anew Rx data notification from TOE.
[out]soTOE_DReq,aRx data request to TOE.
[out]sAddNewTriple_TcpRrh,Notificationfor the TCP Agency to add a new Triple/SessionId pair
[out]sMarkAsPriv,Notificationfor the TCP Agency to mark a connection as privileged
[out]sDeleteEntryBySid,Notifiesthe TCP Agency of the closing of a connection
[out]sRDp_ReqNotif,NotifiespTcpRDp about a n incoming TCP chunk
[in]fmc_write_cnt_sig,Signalfrom pFmcTcpRxDeq about how many bytes are written
[in]role_write_cnt_sig,Signalfrom pRoleTcpRxDeq about how many bytes are written

Definition at line 219 of file tss.cpp.

233 {
234  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
235 #pragma HLS INLINE off
236 #pragma HLS pipeline II=1
237 
238  char* myName = concat3(THIS_NAME, "/", "Tcp_RRh");
239 
240  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
241  static RrhFsmStates rrhFsmState = RRH_RESET;
242 
243 #pragma HLS RESET variable=rrhFsmState
244 
245  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
246  static Cam8<SessionId,TcpDatLen> sessionLength = Cam8<SessionId,TcpDatLen>();
247 #ifndef __SYNTHESIS__
248  if(MAX_NAL_SESSIONS != 8)
249  {
250  printf("\n\t\tERROR: pTcpRRh is currently configured to support only 8 parallel sessions! Abort.\n(Currently, the use of \'Cam8\' must be updated accordingly by hand.)\n");
251  exit(-1);
252  }
253 #endif
254 
255  static stream<NalWaitingData> waitingSessions ("sTcpRRh_WaitingSessions");
256  static stream<NalWaitingData> session_reinsert ("sTcpRRh_sessions_to_reinsert");
257 #pragma HLS STREAM variable=waitingSessions depth=8
258 #pragma HLS STREAM variable=session_reinsert depth=8
259 
260  static TcpDatLen waiting_length = 0;
261  static TcpAppNotif notif_pRrh = TcpAppNotif();
262  static bool already_waiting = false;
263  static TcpDatLen requested_length = 0;
264  static TcpDatLen length_update_value = 0;
265  static SessionId found_ID = 0;
266  static bool found_fmc_sess = false;
267  static bool need_cam_update = false;
268  static bool go_back_to_ack_wait_role = false;
269  static bool go_back_to_ack_wait_fmc = false;
270 
271  static PacketLen role_fifo_free_cnt = NAL_MAX_FIFO_DEPTHS_BYTES;
272  static PacketLen fmc_fifo_free_cnt = NAL_MAX_FIFO_DEPTHS_BYTES;
273 
274  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
275 
276  switch(rrhFsmState)
277  {
278  default:
279  case RRH_RESET:
280  sessionLength.reset();
281  go_back_to_ack_wait_fmc = false;
282  go_back_to_ack_wait_role = false;
283  role_fifo_free_cnt = NAL_MAX_FIFO_DEPTHS_BYTES;
284  fmc_fifo_free_cnt = NAL_MAX_FIFO_DEPTHS_BYTES;
285  rrhFsmState = RRH_WAIT_NOTIF;
286  break;
287  case RRH_WAIT_NOTIF:
288  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
289  {
290  rrhFsmState = RRH_DRAIN;
291  }
292  else if(!siTOE_Notif.empty() && !sDeleteEntryBySid.full()
293  )
294  {
295  siTOE_Notif.read(notif_pRrh);
296  if (notif_pRrh.tcpDatLen != 0)
297  {
298  //waiting_length = 0;
299  already_waiting = sessionLength.lookup(notif_pRrh.sessionID, waiting_length);
300  rrhFsmState = RRH_PROCESS_NOTIF;
301 
302  } else if(notif_pRrh.tcpState == FIN_WAIT_1 || notif_pRrh.tcpState == FIN_WAIT_2
303  || notif_pRrh.tcpState == CLOSING || notif_pRrh.tcpState == TIME_WAIT
304  || notif_pRrh.tcpState == LAST_ACK || notif_pRrh.tcpState == CLOSED)
305  {
306  // we were notified about a closing connection
307  sDeleteEntryBySid.write(notif_pRrh.sessionID);
308  if(go_back_to_ack_wait_fmc)
309  {
310  rrhFsmState = RRH_WAIT_FMC;
311  }
312  else if(go_back_to_ack_wait_role)
313  {
314  rrhFsmState = RRH_WAIT_ROLE;
315  }
316  //else, stay here...
317  }
318  }
319  else if(!session_reinsert.empty() && !waitingSessions.full()
320  && !go_back_to_ack_wait_fmc && !go_back_to_ack_wait_role
321  )
322  {
323  waitingSessions.write(session_reinsert.read());
324  rrhFsmState = RRH_START_REQUEST;
325  }
326  else if(!waitingSessions.empty()
327  && !go_back_to_ack_wait_fmc && !go_back_to_ack_wait_role
328  )
329  {
330  rrhFsmState = RRH_START_REQUEST;
331  }
332  break;
333  case RRH_PROCESS_NOTIF:
334  if(!waitingSessions.full() && !sAddNewTriple_TcpRrh.full()
335  && !sMarkAsPriv.full()
336  )
337  {
338  if(already_waiting)
339  {
340  sessionLength.update(notif_pRrh.sessionID, notif_pRrh.tcpDatLen + waiting_length);
341  printf("[TCP-RRH] adding %d to waiting sessions for session %d.\n",(int) notif_pRrh.tcpDatLen, (int) notif_pRrh.sessionID);
342 
343  } else {
344  sessionLength.insert(notif_pRrh.sessionID, notif_pRrh.tcpDatLen);
345  //bool found_slot = sessionLength.insert(notif_pRrh.sessionID, notif_pRrh.tcpDatLen);
346  //if(!found_slot)
347  //{
348  // //we have a problem...
349  // //but shouldn't happen actually since we have the same size as the table in TOE...
350  // printf("[TCP-RRH:PANIC] We don't have space left in the waiting table...\n");
351  // break;
352  //} else {
353  NalNewTableEntry ne_struct = NalNewTableEntry(newTriple(notif_pRrh.ip4SrcAddr, notif_pRrh.tcpSrcPort, notif_pRrh.tcpDstPort),
354  notif_pRrh.sessionID);
355  sAddNewTriple_TcpRrh.write(ne_struct);
356  bool is_fmc = false;
357  if(notif_pRrh.ip4SrcAddr == *piMMIO_CfrmIp4Addr && notif_pRrh.tcpDstPort == *piMMIO_FmcLsnPort)
358  {
359  is_fmc = true;
360  sMarkAsPriv.write(notif_pRrh.sessionID);
361  }
362  NalWaitingData new_sess = NalWaitingData(notif_pRrh.sessionID, is_fmc);
363  waitingSessions.write(new_sess);
364  printf("[TCP-RRH] adding %d with %d bytes as new waiting session.\n", (int) notif_pRrh.sessionID, (int) notif_pRrh.tcpDatLen);
365  //}
366  }
367  if(go_back_to_ack_wait_fmc)
368  {
369  rrhFsmState = RRH_WAIT_FMC;
370  }
371  else if(go_back_to_ack_wait_role)
372  {
373  rrhFsmState = RRH_WAIT_ROLE;
374  } else {
375  rrhFsmState = RRH_START_REQUEST;
376  }
377  }
378  break;
379  case RRH_START_REQUEST:
380  if(!waitingSessions.empty() && !session_reinsert.full()
381  //&& role_fifo_free_cnt > 0
382  //&& fmc_fifo_free_cnt > 0
383  //if we are here, we ensured there is space
384  )
385  {
386  NalWaitingData new_data = waitingSessions.read();
387  found_ID = new_data.sessId;
388  TcpDatLen found_length = 0;
389  found_fmc_sess = new_data.fmc_con;
390 
391  sessionLength.lookup(found_ID, found_length);
392  //bool found_smth = sessionLength.lookup(found_ID, found_length);
393  //if(!found_smth)
394  //{
395  // //we have a problem...
396  // //but shouldn't happen actually since the stream is filled by ourselve
397  // printf("[TCP-RRH:PANIC] We received a sessionID that is not in the CAM...\n");
398  //} else {
399  //requested_length = 0;
400  if(found_fmc_sess)
401  {
402  if(found_length >= fmc_fifo_free_cnt)
403  {
404  need_cam_update = true;
405  requested_length = fmc_fifo_free_cnt;
406  length_update_value = found_length - fmc_fifo_free_cnt;
407  } else {
408  need_cam_update = false;
409  requested_length = found_length;
410  }
411  } else {
412  if(found_length >= role_fifo_free_cnt)
413  {
414  need_cam_update = true;
415  requested_length = role_fifo_free_cnt;
416  length_update_value = found_length - role_fifo_free_cnt;
417  } else {
418  need_cam_update = false;
419  requested_length = found_length;
420  }
421  }
423  rrhFsmState = RRH_PROCESS_REQUEST;
424  //}
425  }
426  //else if(both_fifo_free_cnt == 0)
427  //{
428  // rrhFsmState = RRH_WAIT_WRITE_ACK;
429  //}
430  break;
431  case RRH_PROCESS_REQUEST:
432  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
433  {
434  rrhFsmState = RRH_DRAIN;
435  }
436  else if(!soTOE_DReq.full() && !sRDp_ReqNotif.full()
437  && !session_reinsert.full()
438  )
439  {
440  if(need_cam_update)
441  {
442  sessionLength.update(found_ID, length_update_value);
443  session_reinsert.write(NalWaitingData(found_ID, found_fmc_sess));
444  if(found_fmc_sess)
445  {
446  fmc_fifo_free_cnt = 0;
447  } else {
448  role_fifo_free_cnt = 0;
449  }
450  } else {
451  sessionLength.deleteEntry(found_ID);
452  if(found_fmc_sess)
453  {
454  fmc_fifo_free_cnt -= requested_length;
455  } else {
456  role_fifo_free_cnt -= requested_length;
457  }
458  }
459  printf("[TCP-RRH] requesting data for #%d with length %d (FMC: %d)\n", (int) found_ID, (int) requested_length, (int) found_fmc_sess);
460  TcpAppRdReq new_req = TcpAppRdReq(found_ID, requested_length);
461  soTOE_DReq.write(new_req);
462  sRDp_ReqNotif.write(new_req);
463  go_back_to_ack_wait_fmc = false;
464  go_back_to_ack_wait_role = false;
465  if(found_fmc_sess)
466  {
467  rrhFsmState = RRH_WAIT_FMC;
468  } else {
469  rrhFsmState = RRH_WAIT_ROLE;
470  }
471  }
472  break;
473  case RRH_WAIT_FMC:
474  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
475  {
476  rrhFsmState = RRH_DRAIN;
477  }
478  else if(!fmc_write_cnt_sig.empty())
479  {
480  PacketLen fmc_new_free = fmc_write_cnt_sig.read();
481  fmc_fifo_free_cnt += fmc_new_free;
482  if(fmc_fifo_free_cnt > NAL_MAX_FIFO_DEPTHS_BYTES)
483  {
484  //to be sure
485  fmc_fifo_free_cnt = NAL_MAX_FIFO_DEPTHS_BYTES;
486  }
487  printf("[TCP-RRH] FMC FIFO completed write of %d bytes; In total %d bytes are free in FMC FIFO.\n", (int) fmc_new_free, (int) fmc_fifo_free_cnt);
488  go_back_to_ack_wait_fmc = false;
489  rrhFsmState = RRH_WAIT_NOTIF;
490  }
491  else if(!siTOE_Notif.empty())
492  {
493  rrhFsmState = RRH_WAIT_NOTIF;
494  go_back_to_ack_wait_fmc = true;
495  }
496  break;
497  case RRH_WAIT_ROLE:
498  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
499  {
500  rrhFsmState = RRH_DRAIN;
501  }
502  else if(!role_write_cnt_sig.empty())
503  {
504  PacketLen role_new_free = role_write_cnt_sig.read();
505  role_fifo_free_cnt += role_new_free;
506  if(role_fifo_free_cnt > NAL_MAX_FIFO_DEPTHS_BYTES)
507  {
508  //to be sure
509  role_fifo_free_cnt = NAL_MAX_FIFO_DEPTHS_BYTES;
510  }
511  printf("[TCP-RRH] ROLE FIFO completed write of %d bytes; In total %d bytes are free in ROLE FIFO.\n", (int) role_new_free, (int) role_fifo_free_cnt);
512  go_back_to_ack_wait_role = false;
513  rrhFsmState = RRH_WAIT_NOTIF;
514  }
515  else if(!siTOE_Notif.empty())
516  {
517  rrhFsmState = RRH_WAIT_NOTIF;
518  go_back_to_ack_wait_role = true;
519  }
520  break;
521  case RRH_DRAIN:
522  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
523  {
524  if(!siTOE_Notif.empty())
525  {
526  siTOE_Notif.read();
527  }
528  if(!waitingSessions.empty())
529  {
530  waitingSessions.read();
531  }
532  if(!session_reinsert.empty())
533  {
534  session_reinsert.read();
535  }
536  if(!fmc_write_cnt_sig.empty())
537  {
538  fmc_write_cnt_sig.read();
539  }
540  if(!role_write_cnt_sig.empty())
541  {
542  role_write_cnt_sig.read();
543  }
544  } else {
545  rrhFsmState = RRH_RESET;
546  }
547  break;
548  }
549 
550 }
SessionId sessionID
Definition: nts.hpp:89
Ip4Addr ip4SrcAddr
Definition: nts.hpp:91
TcpPort tcpDstPort
Definition: nts.hpp:93
TcpDatLen tcpDatLen
Definition: nts.hpp:90
TcpPort tcpSrcPort
Definition: nts.hpp:92
TcpState tcpState
Definition: nts.hpp:94
NalTriple newTriple(Ip4Addr ipRemoteAddres, TcpPort tcpRemotePort, TcpPort tcpLocalPort)
Definition: nal.cpp:62
RrhFsmStates
Definition: nal.hpp:148
#define NAL_MAX_FIFO_DEPTHS_BYTES
Definition: nal.hpp:190
ap_uint< 16 > TcpDatLen
Definition: AxisTcp.hpp:123
@ LAST_ACK
Definition: nts_types.hpp:298
@ FIN_WAIT_2
Definition: nts_types.hpp:297
@ FIN_WAIT_1
Definition: nts_types.hpp:297
@ TIME_WAIT
Definition: nts_types.hpp:297
@ CLOSING
Definition: nts_types.hpp:297
@ CLOSED
Definition: nts_types.hpp:296
Definition: cam8.hpp:59
bool update(K key, V value)
Search the CAM array for a key and updates the corresponding value.
Definition: cam8.hpp:243
bool lookup(K key, V &value)
Search the CAM array for a key.
Definition: cam8.hpp:89
bool deleteEntry(K key)
Remove a key-value pair from the CAM array.
Definition: cam8.hpp:297
bool insert(KeyValuePair< K, V > kVP)
Insert a new key-value pair in the CAM array.
Definition: cam8.hpp:187
void reset()
Invalidate all entries of the CAM array.
Definition: cam8.hpp:343
bool fmc_con
Definition: nal.hpp:320
SessionId sessId
Definition: nal.hpp:319
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pTcpRxNotifEnq()

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 at line 152 of file tss.cpp.

158 {
159  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
160 #pragma HLS INLINE off
161 #pragma HLS pipeline II=1
162  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
163  static RrhEnqFsmStates rrhEngFsm = RRH_ENQ_RESET;
164 #pragma HLS RESET variable=rrhEngFsm
165  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
166  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
167 
168  //This FSM is more or less senseless, but without Vivado HLS removes the 'sTcpNotif_buffer'
169 
170  switch(rrhEngFsm)
171  {
172  default:
173  case RRH_ENQ_RESET:
174  if(*layer_4_enabled == 1 && *piNTS_ready == 1)
175  {
176  rrhEngFsm = RRH_ENQ_STREAM;
177  }
178  else if(!siTOE_Notif.empty())
179  {
180  siTOE_Notif.read();
181  }
182  break;
183  case RRH_ENQ_STREAM:
184  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
185  {
186  rrhEngFsm = RRH_ENQ_RESET;
187  }
188  else if(!siTOE_Notif.empty() && !sTcpNotif_buffer.full())
189  {
190  TcpAppNotif new_notif = siTOE_Notif.read();
191  sTcpNotif_buffer.write(new_notif);
192  }
193  break;
194  }
195 
196 }
RrhEnqFsmStates
Definition: nal.hpp:150
Here is the caller graph for this function:

◆ pTcpWBu()

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 space). In case of streaming mode (i.e. ROLE's length was 0), WRp takes care of splitting the data and writing the right len.

Parameters
[in]layer_4_enabled,externalsignal if layer 4 is enabled
[in]piNTS_ready,externalsignal if NTS is up and running
[in]siWrp_Data,Txdata from [Wrp].
[in]siWrp_SessId,thesession Id from [Wrp].
[in]siWrp_len,thelength of the current chunk (is never 0) from [Wrp].
[out]soTOE_Data,Datafor the TOE
[out]soTOE_SndReq,Sendrequest (containing the planned length) for the TOE
[in]siTOE_SndRep,Sendreply from the TOE (containing the allowed length)

Definition at line 1552 of file tss.cpp.

1562 {
1563  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
1564 #pragma HLS INLINE off
1565 #pragma HLS pipeline II=1
1566  char *myName = concat3(THIS_NAME, "/", "Tcp_WBu");
1567 
1568 
1569  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
1570  static WbuFsmStates wbuState = WBU_WAIT_META;
1571  static uint16_t dequeue_cnt = 0; //in BYTES!!
1572  //static TcpDatLen original_requested_length = 0;
1573 
1574 #pragma HLS RESET variable=wbuState
1575 #pragma HLS RESET variable=dequeue_cnt
1576  //#pragma HLS RESET variable=original_requested_length
1577 
1578  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
1579  static TcpAppMeta current_sessId;
1580  static TcpDatLen current_requested_length = 0;
1581  static TcpDatLen current_approved_length = 0;
1582  static bool need_to_request_again = false;
1583 
1584 
1585  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
1586  TcpAppSndReq toe_sendReq;
1587 
1588 
1589  switch(wbuState) {
1590  default:
1591  case WBU_WAIT_META:
1592  //wait for meta
1593  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
1594  {
1595  wbuState = WBU_DRAIN;
1596  }
1597  else if(!siWrp_SessId.empty() && !siWrp_len.empty())
1598  {
1599  TcpDatLen new_len = siWrp_len.read();
1600  current_sessId = siWrp_SessId.read();
1601  //original_requested_length = new_len;
1602 
1603  current_requested_length = new_len;
1604  dequeue_cnt = 0;
1605  wbuState = WBU_SND_REQ;
1606  }
1607  break;
1608  case WBU_SND_REQ:
1609  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
1610  {
1611  wbuState = WBU_DRAIN;
1612  }
1613  else if(!soTOE_SndReq.full())
1614  {
1615  toe_sendReq.sessId = current_sessId;
1616  toe_sendReq.length = current_requested_length;
1617  soTOE_SndReq.write(toe_sendReq);
1618  if (DEBUG_LEVEL & TRACE_WRP)
1619  {
1620  printInfo(myName, "Received a data forward request from [NAL/WRP] for sessId=%d and nrBytes=%d (repeating request %d).\n",
1621  toe_sendReq.sessId.to_uint(), toe_sendReq.length.to_uint(), (int) need_to_request_again);
1622  }
1623  wbuState = WBU_WAIT_REP;
1624  }
1625  break;
1626  case WBU_WAIT_REP:
1627  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
1628  {
1629  wbuState = WBU_DRAIN;
1630  }
1631  else if(!siTOE_SndRep.empty())
1632  {
1633  //-- Read the request-to-send reply and continue accordingly
1634  TcpAppSndRep appSndRep = siTOE_SndRep.read();
1635  switch (appSndRep.error) {
1636  case NO_ERROR:
1637  wbuState = WBU_STREAM;
1638  current_approved_length = current_requested_length; //not spaceLeft(!), because this could be bigger!
1639  need_to_request_again = false;
1640  dequeue_cnt = 0;
1641  break;
1642  case NO_SPACE:
1643  printWarn(myName, "Not enough space for writing %d bytes in the Tx buffer of session #%d. Available space is %d bytes.\n",
1644  appSndRep.length.to_uint(), appSndRep.sessId.to_uint(), appSndRep.spaceLeft.to_uint());
1645 
1646  dequeue_cnt = 0;
1647  current_approved_length = appSndRep.spaceLeft - 7; //with "security margin" (so that the length is correct if tkeep is not 0xff for the last word)
1648  need_to_request_again = true;
1649 
1650  wbuState = WBU_STREAM;
1651  break;
1652  case NO_CONNECTION:
1653  printWarn(myName, "Attempt to write data for a session that is not established.\n");
1654  //since this is after the WRP, this should never happen
1655  wbuState = WBU_DROP;
1656  dequeue_cnt = current_requested_length;
1657  //TODO: write internal event?
1658  //TODO: or ignore it, because WRP ensures this should not happen?
1659  break;
1660  default:
1661  printWarn(myName, "Received unknown TCP request to send reply from [TOE].\n");
1662  wbuState = WBU_DROP;
1663  dequeue_cnt = current_requested_length;
1664  //TODO: write internal event?
1665  //TODO: or ignore it, because WRP ensures this should not happen?
1666  break;
1667  }
1668  }
1669  break;
1670  case WBU_STREAM:
1671  //dequeue data
1672  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
1673  {
1674  wbuState = WBU_DRAIN;
1675  }
1676  else if(!soTOE_Data.full() && !siWrp_Data.empty() )
1677  {
1678  TcpAppData tmp = siWrp_Data.read();
1679  dequeue_cnt += extractByteCnt(tmp);
1680  if(dequeue_cnt >= current_approved_length)
1681  {
1682  tmp.setTLast(1); //to be sure
1683  if(need_to_request_again)
1684  {
1685  current_requested_length -= dequeue_cnt;
1686  wbuState = WBU_SND_REQ;
1687  } else {
1688  //done
1689  wbuState = WBU_WAIT_META;
1690  printInfo(myName, "Done with packet (#%d, %d)\n",
1691  current_sessId.to_uint(), current_requested_length.to_uint());
1692  }
1693  } else {
1694  tmp.setTLast(0); //to be sure
1695  }
1696  soTOE_Data.write(tmp);
1697  }
1698  break;
1699  case WBU_DROP:
1700  //TODO: delete, because WRP ensures this should not happen?
1701  if(!siWrp_Data.empty())
1702  {
1703  TcpAppData tmp = siWrp_Data.read();
1704  if(tmp.getTLast() == 1)
1705  {
1706  //dequeue_cnt = 0;
1707  wbuState = WBU_WAIT_META;
1708  } else {
1709  dequeue_cnt -= extractByteCnt(tmp);
1710  if(dequeue_cnt == 0)
1711  {
1712  wbuState = WBU_WAIT_META;
1713  }
1714  }
1715  }
1716  break;
1717  case WBU_DRAIN:
1718  //drain all streams as long as NTS disabled
1719  if(*layer_4_enabled == 0 || *piNTS_ready == 0)
1720  {
1721  if(!siWrp_Data.empty())
1722  {
1723  siWrp_Data.read();
1724  }
1725  if(!siWrp_SessId.empty())
1726  {
1727  siWrp_SessId.read();
1728  }
1729  if(!siWrp_len.empty())
1730  {
1731  siWrp_len.read();
1732  }
1733  } else {
1734  wbuState = WBU_WAIT_META;
1735  }
1736  break;
1737  } //switch
1738 }
TcpDatLen spaceLeft
Definition: nts.hpp:144
SessionId sessId
Definition: nts.hpp:142
TcpAppSndErr error
Definition: nts.hpp:145
TcpDatLen length
Definition: nts.hpp:143
TcpDatLen length
Definition: nts.hpp:130
SessionId sessId
Definition: nts.hpp:129
WbuFsmStates
Definition: nal.hpp:158
#define TRACE_WRP
Definition: nal.hpp:117
@ NO_ERROR
Definition: nts_types.hpp:304
@ NO_CONNECTION
Definition: nts_types.hpp:304
@ NO_SPACE
Definition: nts_types.hpp:304
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pTcpWRp()

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 forwards it to TOE.

Parameters
[in]layer_4_enabled,externalsignal if layer 4 is enabled
[in]piNTS_ready,externalsignal if NTS is up and running
[in]siFmc_data,Datafrom FMC
[in]siFmc_meta,Metadatafrom FMC
[in]siTcp_data,Datafrom [ROLE].
[in]siTcp_meta,MetaData from [ROLE].
[out]soTOE_Data,Datafor [TOE].
[out]soTOE_SessId,SessionId for [TOE].
[out]soTOE_len,Datalength for [TOE].
[out]sGetIpReq_TcpTx,Requeststream for the the MRT Agency
[in]sGetIpRep_TcpTx,Replystream from the MRT Agency
[out]&sGetSidFromTriple_Req,Requeststream for the the TCP Agency
[in]&sGetSidFromTriple_Rep,Replystream from the TCO Agency
[out]sNewTcpCon_Req,Requeststream for pTcpCOn to open a new connection
[in]sNewTcpCon_Rep,Replystream from pTcpCOn
[in]cache_inval_sig,Signalfrom the Cache Invalidation Logic
[out]internal_event_fifo,Fifofor event reporting

Definition at line 1104 of file tss.cpp.

1123 {
1124  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
1125 #pragma HLS INLINE off
1126 #pragma HLS pipeline II=1
1127 
1128 
1129  char* myName = concat3(THIS_NAME, "/", "Tcp_WRp");
1130 
1131  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
1132  static WrpFsmStates wrpFsmState = WRP_RESET;
1133 
1134  static SessionId cached_tcp_tx_session_id = UNUSED_SESSION_ENTRY_VALUE;
1135  static ap_uint<64> cached_tcp_tx_triple = UNUSED_TABLE_ENTRY_VALUE;
1136  static NodeId cached_dst_rank = INVALID_MRT_VALUE;
1137  static Ip4Addr cached_dst_ip_addr = 0x0;
1138  static bool cache_init = false;
1139 
1140  static uint8_t evs_loop_i = 0;
1141 
1142 #pragma HLS RESET variable=wrpFsmState
1143 #pragma HLS RESET variable=cached_tcp_tx_session_id
1144 #pragma HLS RESET variable=cached_tcp_tx_triple
1145 #pragma HLS RESET variable=cached_dst_rank
1146 #pragma HLS RESET variable=cache_init
1147 #pragma HLS RESET variable=cached_dst_ip_addr
1148 #pragma HLS RESET variable=evs_loop_i
1149 
1150  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
1151  static NetworkMetaStream out_meta_tcp = NetworkMetaStream();
1152  static NetworkDataLength tcpTX_packet_length = 0;
1153  static NetworkDataLength tcpTX_current_packet_length = 0;
1154  static TcpAppMeta tcpSessId = TcpAppMeta();
1155  static NodeId dst_rank = INVALID_MRT_VALUE;
1156  static Ip4Addr dst_ip_addr = 0x0;
1157  static NrcPort src_port = 0x0;
1158  static NrcPort dst_port = 0x0;
1159  static ap_uint<64> new_triple = UNUSED_TABLE_ENTRY_VALUE;
1160  static SessionId sessId = UNUSED_SESSION_ENTRY_VALUE;
1161  static bool streaming_mode = false;
1162 
1163  static stream<NalEventNotif> evsStreams[10];
1164 
1165 
1166  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
1167  //NetworkWord currWordIn;
1168  //TcpAppData currWordOut;
1169  NalEventNotif new_ev_not;
1170 
1171  switch (wrpFsmState)
1172  {
1173  default:
1174  case WRP_RESET:
1175  if(*layer_4_enabled == 1 && *piNTS_ready == 1)
1176  {
1177  cache_init = false;
1178  wrpFsmState = WRP_WAIT_META;
1179  } else {
1180  if(!siFMC_data.empty())
1181  {
1182  siFMC_data.read();
1183  }
1184  if(!siFMC_SessId.empty())
1185  {
1186  siFMC_SessId.read();
1187  }
1188  if(!siTcp_data.empty())
1189  {
1190  siTcp_data.read();
1191  }
1192  if(!siTcp_meta.empty())
1193  {
1194  siTcp_meta.read();
1195  }
1196  }
1197  break;
1198  case WRP_WAIT_META:
1199  if( *layer_4_enabled == 0 || *piNTS_ready == 0)
1200  {
1201  wrpFsmState = WRP_RESET;
1202  }
1203  else if(!cache_inval_sig.empty())
1204  {
1205  if(cache_inval_sig.read())
1206  {
1207  cached_tcp_tx_session_id = UNUSED_SESSION_ENTRY_VALUE;
1208  cached_tcp_tx_triple = UNUSED_TABLE_ENTRY_VALUE;
1209  cached_dst_rank = INVALID_MRT_VALUE;
1210  cached_dst_ip_addr = 0x0;
1211  cache_init = false;
1212  }
1213  break;
1214  }
1215  else if (!siFMC_SessId.empty()
1216  && !soTOE_SessId.full()
1217  )
1218  {
1219  //FMC must come first
1220  tcpSessId = (AppMeta) siFMC_SessId.read();
1221  soTOE_SessId.write(tcpSessId);
1222  streaming_mode = true;
1223  tcpTX_current_packet_length = 0;
1224  //delete the session id, we don't need it any longer
1225  // (this expects an HTTP mode of request-response)
1226  //UPDATE: is done via the TOE_Notif if the client
1227  //closes the connection
1228 
1229  if (DEBUG_LEVEL & TRACE_WRP) {
1230  printInfo(myName, "Received new session ID #%d from [FMC].\n",
1231  tcpSessId.to_uint());
1232  }
1233  wrpFsmState = WRP_STREAM_FMC;
1234  break;
1235  }
1236  else if (!siTcp_meta.empty()
1237  && !sGetIpReq_TcpTx.full()
1238  )
1239  {
1240  //now ask the ROLE
1241  out_meta_tcp = siTcp_meta.read();
1242  tcpTX_packet_length = out_meta_tcp.tdata.len;
1243  tcpTX_current_packet_length = 0;
1244 
1245  dst_rank = out_meta_tcp.tdata.dst_rank;
1246  if(dst_rank > MAX_CF_NODE_ID)
1247  {
1248  new_ev_not = NalEventNotif(NID_MISS_TX, 1);
1249  evsStreams[0].write_nb(new_ev_not);
1250  //SINK packet
1251  wrpFsmState = WRP_DROP_PACKET;
1252  printf("NRC drops the packet...\n");
1253  break;
1254  }
1255 
1256  src_port = out_meta_tcp.tdata.src_port;
1257  if (src_port == 0)
1258  {
1259  src_port = DEFAULT_RX_PORT;
1260  }
1261  dst_port = out_meta_tcp.tdata.dst_port;
1262  if (dst_port == 0)
1263  {
1264  dst_port = DEFAULT_RX_PORT;
1265  new_ev_not = NalEventNotif(PCOR_TX, 1);
1266  evsStreams[2].write_nb(new_ev_not);
1267  }
1268 
1269  if(cache_init && dst_rank == cached_dst_rank)
1270  {
1271  dst_ip_addr = cached_dst_ip_addr;
1272  wrpFsmState = WRP_W8FORREQS_11;
1273  } else {
1274  //need request both...
1275  sGetIpReq_TcpTx.write(dst_rank);
1276  cache_init = false;
1277  wrpFsmState = WRP_W8FORREQS_1;
1278  //break;
1279  }
1280  }
1281  break;
1282 
1283  case WRP_W8FORREQS_1:
1284  if(!sGetIpRep_TcpTx.empty())
1285  {
1286  dst_ip_addr = sGetIpRep_TcpTx.read();
1287  wrpFsmState = WRP_W8FORREQS_11;
1288  }
1289  break;
1290 
1291  case WRP_W8FORREQS_11:
1292  //both cases
1293  if(//cache_init ||
1294  !sGetSidFromTriple_Req.full())
1295  {
1296  //not else, in both cases
1297  wrpFsmState = WRP_W8FORREQS_2;
1298  if(dst_ip_addr == 0)
1299  {
1300  new_ev_not = NalEventNotif(NID_MISS_TX, 1);
1301  evsStreams[1].write_nb(new_ev_not);
1302  //SINK packet
1303  wrpFsmState = WRP_DROP_PACKET;
1304  printf("NRC drops the packet...\n");
1305  break;
1306  }
1307 
1308  //check if session is present
1309  new_triple = newTriple(dst_ip_addr, dst_port, src_port);
1310  printf("From ROLE: remote Addr: %d; dstPort: %d; srcPort %d; (rank: %d)\n", (int) dst_ip_addr, (int) dst_port, (int) src_port, (int) dst_rank);
1311  sessId = UNUSED_SESSION_ENTRY_VALUE;
1312  if(cache_init && new_triple == cached_tcp_tx_triple)
1313  {
1314  printf("used TCP TX tripple chache.\n");
1315  sessId = cached_tcp_tx_session_id;
1316  wrpFsmState = WRP_W8FORREQS_22;
1317  } else {
1318  //need request
1319  sGetSidFromTriple_Req.write(new_triple);
1320  cache_init = false;
1321  wrpFsmState = WRP_W8FORREQS_2;
1322  //break;
1323  }
1324  }
1325  break;
1326 
1327  case WRP_W8FORREQS_2:
1328  if(!sGetSidFromTriple_Rep.empty())
1329  {
1330  sessId = sGetSidFromTriple_Rep.read();
1331  cached_tcp_tx_triple = new_triple;
1332  cached_tcp_tx_session_id = sessId;
1333  cached_dst_ip_addr = dst_ip_addr;
1334  cached_dst_rank = dst_rank;
1335  cache_init = true;
1336  wrpFsmState = WRP_W8FORREQS_22;
1337  }
1338  break;
1339 
1340  case WRP_W8FORREQS_22:
1341  if( *layer_4_enabled == 0 || *piNTS_ready == 0)
1342  {
1343  wrpFsmState = WRP_RESET;
1344  }
1345  else if(!soTOE_SessId.full() && !sNewTcpCon_Req.full() && !soTOE_len.full() )
1346  {
1347  //both cases
1348  //"final" preprocessing
1349  printf("session id found: %d\n", (int) sessId);
1350  if(sessId == (SessionId) UNUSED_SESSION_ENTRY_VALUE)
1351  {//we need to create one first
1352  sNewTcpCon_Req.write(new_triple);
1353  wrpFsmState = WRP_WAIT_CONNECTION;
1354  cache_init = false;
1355  printf("requesting new connection.\n");
1356  break;
1357  }
1358  new_ev_not = NalEventNotif(LAST_TX_NID, dst_rank);
1359  evsStreams[3].write_nb(new_ev_not);
1360  new_ev_not = NalEventNotif(LAST_TX_PORT, dst_port);
1361  evsStreams[4].write_nb(new_ev_not);
1362  new_ev_not = NalEventNotif(PACKET_TX, 1);
1363  evsStreams[5].write_nb(new_ev_not);
1364 
1365  soTOE_SessId.write(sessId);
1366  tcpTX_current_packet_length = 0;
1367  if(tcpTX_packet_length == 0)
1368  {
1369  streaming_mode = true;
1370  } else {
1371  streaming_mode = false;
1372  soTOE_len.write(tcpTX_packet_length);
1373  }
1374  if (DEBUG_LEVEL & TRACE_WRP) {
1375  printInfo(myName, "Received new session ID #%d from [ROLE] with length %d.\n",
1376  sessId.to_uint(), tcpTX_packet_length.to_uint());
1377  }
1378  wrpFsmState = WRP_STREAM_ROLE;
1379  }
1380  break;
1381 
1382  case WRP_WAIT_CONNECTION:
1383  if( *layer_4_enabled == 0 || *piNTS_ready == 0)
1384  {
1385  wrpFsmState = WRP_RESET;
1386  }
1387  else if( !soTOE_SessId.full() && !sNewTcpCon_Rep.empty() && !soTOE_len.full() )
1388  {
1389  NalNewTcpConRep con_rep = sNewTcpCon_Rep.read();
1390  if(con_rep.failure == true)
1391  {
1392  new_ev_not = NalEventNotif(TCP_CON_FAIL, 1);
1393  evsStreams[6].write_nb(new_ev_not);
1394  // we sink the packet, because otherwise the design will hang
1395  // and the user is notified with the flight recorder status
1396  wrpFsmState = WRP_DROP_PACKET;
1397  printf("NRC drops the packet...\n");
1398  break;
1399  }
1400  new_triple = con_rep.new_triple;
1401  sessId = con_rep.newSessionId;
1402 
1403  new_ev_not = NalEventNotif(LAST_TX_NID, dst_rank);
1404  evsStreams[7].write_nb(new_ev_not);
1405  new_ev_not = NalEventNotif(LAST_TX_PORT, dst_port);
1406  evsStreams[8].write_nb(new_ev_not);
1407  new_ev_not = NalEventNotif(PACKET_TX, 1);
1408  evsStreams[9].write_nb(new_ev_not);
1409 
1410  soTOE_SessId.write(sessId);
1411  tcpTX_current_packet_length = 0;
1412  if(tcpTX_packet_length == 0)
1413  {
1414  streaming_mode = true;
1415  } else {
1416  streaming_mode = false;
1417  soTOE_len.write(tcpTX_packet_length);
1418  }
1419  if (DEBUG_LEVEL & TRACE_WRP) {
1420  printInfo(myName, "Received new session ID #%d from [ROLE].\n",
1421  sessId.to_uint());
1422  }
1423  wrpFsmState = WRP_STREAM_ROLE;
1424  cached_tcp_tx_triple = new_triple;
1425  cached_tcp_tx_session_id = sessId;
1426  cached_dst_ip_addr = dst_ip_addr;
1427  cached_dst_rank = dst_rank;
1428  cache_init = true;
1429 
1430  }
1431  break;
1432 
1433  case WRP_STREAM_FMC:
1434  if( *layer_4_enabled == 0 || *piNTS_ready == 0)
1435  {
1436  wrpFsmState = WRP_RESET;
1437  }
1438  else if (!siFMC_data.empty() && !soTOE_Data.full() && !soTOE_len.full() )
1439  {
1440  NetworkWord tmpWord = siFMC_data.read();
1441  TcpAppData tcpWord = TcpAppData(tmpWord.tdata, tmpWord.tkeep, tmpWord.tlast); //LE stays LE
1442  tcpTX_current_packet_length += extractByteCnt(tcpWord);
1443  soTOE_Data.write(tcpWord);
1444  if(tcpWord.getTLast() == 1) {
1445  wrpFsmState = WRP_WAIT_META;
1446  soTOE_len.write(tcpTX_current_packet_length);
1447  } else {
1448  //always streaming
1449  if(tcpTX_current_packet_length >= NAL_STREAMING_SPLIT_TCP)
1450  {
1451  soTOE_len.write(tcpTX_current_packet_length);
1452  tcpTX_current_packet_length = 0;
1453  }
1454  }
1455  }
1456  break;
1457 
1458  case WRP_STREAM_ROLE:
1459  if( *layer_4_enabled == 0 || *piNTS_ready == 0)
1460  {
1461  wrpFsmState = WRP_RESET;
1462  }
1463  else if (!siTcp_data.empty() && !soTOE_Data.full() && !soTOE_len.full() )
1464  {
1465  NetworkWord currWordIn = siTcp_data.read();
1466  tcpTX_current_packet_length += extractByteCnt(currWordIn);
1467  if(!streaming_mode)
1468  {
1469  currWordIn.tlast = 0; // we ignore users tlast if the length is known
1470  }
1471  printf("streaming from ROLE to TOE: tcpTX_packet_length: %d, tcpTX_current_packet_length: %d \n", (int) tcpTX_packet_length, (int) tcpTX_current_packet_length);
1472  if(!streaming_mode && tcpTX_current_packet_length >= tcpTX_packet_length) //&& tcpTX_packet_length > 0
1473  {
1474  currWordIn.tlast = 1;
1475  }
1476  if(currWordIn.tlast == 1) //either by the user, or by us
1477  {
1478  wrpFsmState = WRP_WAIT_META;
1479  if(streaming_mode)
1480  {
1481  soTOE_len.write(tcpTX_current_packet_length);
1482  }
1483  }
1484  else if (streaming_mode)
1485  {
1486  if(tcpTX_current_packet_length >= NAL_STREAMING_SPLIT_TCP)
1487  {
1488  soTOE_len.write(tcpTX_current_packet_length);
1489  tcpTX_current_packet_length = 0;
1490  currWordIn.tlast = 1; //to be sure? (actually, unecessary)
1491  }
1492  }
1493  TcpAppData currWordOutTmp = TcpAppData(currWordIn.tdata, currWordIn.tkeep, currWordIn.tlast);
1494  soTOE_Data.write(currWordOutTmp);
1495  }
1496  break;
1497 
1498  case WRP_DROP_PACKET:
1499  if( *layer_4_enabled == 0 || *piNTS_ready == 0)
1500  {
1501  wrpFsmState = WRP_RESET;
1502  }
1503  else if( !siTcp_data.empty())
1504  {
1505  NetworkWord currWordIn = siTcp_data.read();
1506  tcpTX_current_packet_length += extractByteCnt(currWordIn);
1507  //until Tlast or length
1508  if( (tcpTX_packet_length > 0 && tcpTX_current_packet_length >= tcpTX_packet_length)
1509  || (currWordIn.tlast == 1)
1510  )
1511  {
1512  wrpFsmState = WRP_WAIT_META;
1513  }
1514  }
1515  break;
1516  } // switch case
1517 
1518  //-- ALWAYS -----------------------
1519  if(!internal_event_fifo.full()
1520  )
1521  {
1522  if(!evsStreams[evs_loop_i].empty())
1523  {
1524  internal_event_fifo.write(evsStreams[evs_loop_i].read());
1525  }
1526  evs_loop_i++;
1527  if(evs_loop_i >= 10)
1528  {
1529  evs_loop_i = 0;
1530  }
1531  }
1532 
1533 }
#define NAL_STREAMING_SPLIT_TCP
Definition: nal.hpp:187
WrpFsmStates
Definition: nal.hpp:155
@ WRP_STREAM_ROLE
Definition: nal.hpp:156
#define MAX_CF_NODE_ID
Definition: network.hpp:85
NalTriple new_triple
Definition: nal.hpp:283
SessionId newSessionId
Definition: nal.hpp:284
bool failure
Definition: nal.hpp:285
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pTOE()

void pTOE ( int &  nrErr,
stream< TcpAppNotif > &  soTRIF_Notif,
stream< TcpAppRdReq > &  siTRIF_DReq,
stream< TcpAppData > &  soTRIF_Data,
stream< TcpAppMeta > &  soTRIF_SessId,
stream< TcpAppLsnReq > &  siTRIF_LsnReq,
stream< TcpAppLsnRep > &  soTRIF_LsnAck,
stream< TcpAppData > &  siTRIF_Data,
stream< TcpAppSndReq > &  siTRIF_SndReq,
stream< TcpAppSndRep > &  soTRIF_SndRep,
stream< TcpAppOpnReq > &  siTRIF_OpnReq,
stream< TcpAppOpnRep > &  soTRIF_OpnRep 
)

Definition at line 840 of file tb_nal.cpp.

857 {
858 
859  //------------------------------------------------------
860  //-- FSM #1 - LISTENING
861  //------------------------------------------------------
862  static TcpAppLsnReq appLsnPortReq;
863 
864  switch (lsnState) {
865  case LSN_WAIT_REQ: // CHECK IF A LISTENING REQUEST IS PENDING
866  if (!siTRIF_LsnReq.empty()) {
867  siTRIF_LsnReq.read(appLsnPortReq);
868  printInfo(myLsnName, "Received a listen port request #%d from [TRIF].\n",
869  appLsnPortReq.to_int());
871  }
872  //else {
873  // printWarn(myLsnName, "Waiting for listen port request.\n");
874  //}
875  break;
876  case LSN_SEND_ACK: // SEND ACK BACK TO [TRIF]
877  if (!soTRIF_LsnAck.full()) {
878  soTRIF_LsnAck.write(true);
879  //fpgaLsnPort = appLsnPortReq.to_int();
881  }
882  else {
883  printWarn(myLsnName, "Cannot send listen reply back to [TRIF] because stream is full.\n");
884  }
885  break;
886  } // End-of: switch (lsnState) {
887 
888  //------------------------------------------------------
889  //-- FSM #2 - OPEN CONNECTION
890  //------------------------------------------------------
891  TcpAppOpnReq HostSockAddr(DEFAULT_HOST_IP4_ADDR,
893 
895  if (!opnStartupDelay) {
896  switch(opnState) {
897  case OPN_WAIT_REQ:
898  if (!siTRIF_OpnReq.empty()) {
899  siTRIF_OpnReq.read(HostSockAddr);
900  printInfo(myOpnName, "Received a request to open the following remote socket address:\n");
901  printSockAddr(myOpnName, HostSockAddr);
903  }
904  break;
905  case OPN_SEND_REP:
906  if (!soTRIF_OpnRep.full()) {
907  soTRIF_OpnRep.write(opnReply);
909  }
910  else {
911  printWarn(myOpnName, "Cannot send open connection reply back to [TRIF] because stream is full.\n");
912  }
913  break;
914  default: //Timeout etc.
915  break;
916  } // End-of: switch (opnState) {
917  }
918  else
919  opnStartupDelay--;
920 
921  //------------------------------------------------------
922  //-- FSM #3 - RX DATA PATH
923  //------------------------------------------------------
924  ap_uint< 8> keep;
925  ap_uint< 1> last;
926  if (!rxpStartupDelay) {
927  switch (rxpState) {
928  case RXP_SEND_NOTIF: // SEND A DATA NOTIFICATION TO [TRIF]
929  printf("Send packet from %4.4x to FPGA:%d\n",(int) hostIp4Addr, (int) fpgaLsnPort);
930  if (!soTRIF_Notif.full()) {
931  soTRIF_Notif.write(TcpAppNotif(sessionId, tcpSegLen,
933  printInfo(myRxpName, "Sending notification #%d to [TRIF] (sessId=%d, segLen=%d).\n",
934  segCnt, sessionId.to_int(), tcpSegLen.to_int());
936  }
937  break;
938  case RXP_WAIT_DREQ: // WAIT FOR A DATA REQUEST FROM [TRIF]
939  if (!siTRIF_DReq.empty()) {
940  siTRIF_DReq.read(appRdReq);
941  printInfo(myRxpName, "Received a data read request from [TRIF] (sessId=%d, segLen=%d).\n",
942  appRdReq.sessionID.to_int(), appRdReq.length.to_int());
943  byteCnt = 0;
944  //rxpState = RXP_SEND_DATA;
945  //rxpState = RXP_DONE;
947  }
948  break;
949  case RXP_SEND_META:
950  if (!soTRIF_SessId.full()) {
951  soTRIF_SessId.write(sessionId);
953  //rxpState = RXP_DONE;
954  }
955  break;
956  case RXP_SEND_DATA: // FORWARD DATA AND METADATA TO [TRIF]
957  // Note: We always assume 'tcpSegLen' is multiple of 8B.
958  keep = 0xFF;
959  if (byteCnt == 0) {
960  //if (!soTRIF_SessId.full() && !soTRIF_Data.full()) {
961  if (!soTRIF_Data.full()) {
962  soTRIF_Data.write(TcpAppData(data, keep, last));
963  if (DEBUG_LEVEL & TRACE_TOE)
964  printAxiWord(myRxpName, NetworkWord(data, keep, last));
965  byteCnt += 8;
966  data += 8;
967  }
968  else {
969  printf("[TB-INFO-2] NRC not ready to receive TCP data.\n");
970  break;
971  }
972  }
973  else if (byteCnt < tcpSegLen) {
974  if (!soTRIF_Data.full()) {
975  byteCnt += 8;
976  last = (byteCnt>=(tcpSegLen-1)) ? 1 : 0;
977  soTRIF_Data.write(TcpAppData(data, keep, last));
978  if (DEBUG_LEVEL & TRACE_TOE)
979  printAxiWord(myRxpName, NetworkWord(data, keep, last));
980  data += 8;
981  if(last == 1)
982  {
983  segCnt++;
985  if (segCnt >= nrSegToSend) {
986  rxpState = RXP_DONE;
987  } else {
989  }
990  }
991  }
992  }
993  break;
994  case RXP_DONE: // END OF THE RX PATH SEQUENCE
995  // ALL SEGMENTS HAVE BEEN SENT
996  // Reset for next run
997  byteCnt = 0;
998  segCnt = 0;
999  //wait here
1000  break;
1001  } // End-of: switch())
1002  }
1003  else
1004  rxpStartupDelay--;
1005 
1006  //printInfo(myRxpName, "POST FSM state %d\n", (int) rxpState);
1007 
1008  //------------------------------------------------------
1009  //-- FSM #4 - TX DATA PATH
1010  //-- (Always drain the data coming from [TRIF])
1011  //------------------------------------------------------
1012  static TcpSessId curr_sessId;
1013  if (!txpStartupDelay) {
1014  switch (txpState) {
1015  case TXP_WAIT_REQ:
1016  if (!siTRIF_SndReq.empty() && !soTRIF_SndRep.full()) {
1017  TcpAppSndReq app_req;
1018  siTRIF_SndReq.read(app_req);
1019  curr_sessId = app_req.sessId;
1020  TcpDatLen len = app_req.length;
1021  if (DEBUG_LEVEL & TRACE_TOE) {
1022  printInfo(myTxpName, "Receiving TX Request for session #%d with length %d; \t Approve up to length %d\n",
1023  curr_sessId.to_int(), len.to_int(), DEFAULT_TCP_LEN_REP);
1024  }
1025  TcpAppSndErr err_rep = NO_ERROR;
1026  if(len > DEFAULT_TCP_LEN_REP)
1027  {
1028  err_rep = NO_SPACE;
1030  }
1031  TcpAppSndRep app_rep = TcpAppSndRep(curr_sessId, len, DEFAULT_TCP_LEN_REP, err_rep);
1032  soTRIF_SndRep.write(app_rep);
1034  }
1035  break;
1036  case TXP_WAIT_DATA:
1037  //TODO: acturally, there must not come data after a request, there could also be another request
1038  //but the current pTcpWBu is not using this flexibility
1039  if( !siTRIF_Data.empty())
1040  {
1041  TcpAppData appData;
1042  siTRIF_Data.read(appData);
1043  if (DEBUG_LEVEL & TRACE_TOE) {
1044  printInfo(myTxpName, "Receiving data for session #%d\n", curr_sessId.to_int());
1045  printAxiWord(myTxpName, appData);
1046  }
1047  if (!appData.getTLast() == 1)
1048  {
1050  } else {
1052  tcp_packets_recv++;
1053  }
1054 
1055  }
1056  break;
1057  case TXP_RECV_DATA:
1058  if (!siTRIF_Data.empty()) {
1059  TcpAppData appData;
1060  siTRIF_Data.read(appData);
1061  if (DEBUG_LEVEL & TRACE_TOE)
1062  printAxiWord(myTxpName, appData);
1063  if (appData.getTLast() == 1) {
1065  tcp_packets_recv++;
1066  }
1067  }
1068  break;
1069  }
1070  }
1071  else {
1072  txpStartupDelay--;
1073  }
1074 
1075  //printInfo(myTxpName, "POST FSM state %d\n", (int) txpState);
1076 }
const char * myRxpName
Definition: tb_nal.cpp:837
#define DEFAULT_HOST_LSN_PORT
Definition: tb_nal.cpp:73
#define DEFAULT_TCP_LEN_REP
Definition: tb_nal.cpp:79
int nrSegToSend
Definition: tb_nal.cpp:831
const char * myTxpName
Definition: tb_nal.cpp:838
const char * myOpnName
Definition: tb_nal.cpp:836
int rxpStartupDelay
Definition: tb_nal.cpp:823
TcpAppRdReq appRdReq
Definition: tb_nal.cpp:826
int txpStartupDelay
Definition: tb_nal.cpp:824
ap_uint< 64 > data
Definition: tb_nal.cpp:832
const char * myLsnName
Definition: tb_nal.cpp:835
int segCnt
Definition: tb_nal.cpp:830
#define TRACE_TOE
Definition: tb_nal.cpp:54
int byteCnt
Definition: tb_nal.cpp:829
int opnStartupDelay
Definition: tb_nal.cpp:821
TcpAppSndErr
Definition: nts_types.hpp:304
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pUdpCls()

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.

Parameters
[out]soUOE_ClsReq,closeport request for UOE
[in]siUOE_ClsRep,responseof the UOE
[in]sUdpPortsToClose,portclose request from pPortLogic

Definition at line 747 of file uss.cpp.

752 {
753  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
754 #pragma HLS INLINE off
755 #pragma HLS pipeline II=1
756 
757  char *myName = concat3(THIS_NAME, "/", "Udp_Cls");
758 
759  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
760  static ClsFsmStates clsFsmState_Udp = CLS_IDLE;
761 
762 #pragma HLS RESET variable=clsFsmState_Udp
763  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
764  //static ap_uint<16> newRelativePortToClose = 0;
765  static ap_uint<16> newAbsolutePortToClose = 0;
766 
767 
768  switch (clsFsmState_Udp)
769  {
770  default:
771  case CLS_IDLE:
772  clsFsmState_Udp = CLS_NEXT;
773  case CLS_NEXT:
774  if(!sUdpPortsToClose.empty() && !soUOE_ClsReq.full() )
775  {
776  //we have to close opened ports, one after another
777  newAbsolutePortToClose = sUdpPortsToClose.read();
778  soUOE_ClsReq.write(newAbsolutePortToClose);
779  clsFsmState_Udp = CLS_WAIT4RESP;
780  }
781  break;
782  case CLS_WAIT4RESP:
783  if(!siUOE_ClsRep.empty())
784  {
785  StsBool isOpened;
786  siUOE_ClsRep.read(isOpened);
787  if (not isOpened)
788  {
789  printInfo(myName, "Received close acknowledgment from [UOE].\n");
790  }
791  else {
792  printWarn(myName, "UOE denied closing the port %d (0x%4.4X) which is still opened.\n",
793  (int) newAbsolutePortToClose, (int) newAbsolutePortToClose);
794  }
795  //in all cases
796  clsFsmState_Udp = CLS_NEXT;
797  }
798  break;
799  }
800 }
bool StsBool
Definition: nal.hpp:246
Here is the caller graph for this function:

◆ pUdpLsn()

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.

Parameters
[out]soUOE_LsnReq,openport request for UOE
[in]siUOE_LsnRep,responseof the UOE
[in]sUdpPortsToOpen,portopen request from pPortLogic
[out]sUdpPortsOpenFeedback,feedbackto pPortLogic

Definition at line 358 of file uss.cpp.

364 {
365  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
366 #pragma HLS INLINE off
367 #pragma HLS pipeline II=1
368 
369  char* myName = concat3(THIS_NAME, "/", "Udp_LSn");
370 
371  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
372  static LsnFsmStates lsnFsmState = LSN_IDLE;
373 #ifdef __SYNTHESIS_
374  static ap_uint<16> startupDelay = 0x8000;
375 #else
376  static ap_uint<16> startupDelay = 10;
377 #endif
378 
379 #pragma HLS RESET variable=lsnFsmState
380 #pragma HLS RESET variable=startupDelay
381  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
382  static ap_uint<8> watchDogTimer_plisten = 0;
383  static UdpPort new_absolute_port = 0;
384 
385  switch (lsnFsmState) {
386 
387  default:
388  case LSN_IDLE:
389  if (startupDelay > 0)
390  {
391  startupDelay--;
392  } else {
393  lsnFsmState = LSN_SEND_REQ;
394  }
395  break;
396 
397  case LSN_SEND_REQ:
398  if ( !soUOE_LsnReq.full() && !sUdpPortsToOpen.empty())
399  {
400  new_absolute_port = sUdpPortsToOpen.read();
401  soUOE_LsnReq.write(new_absolute_port);
402  if (DEBUG_LEVEL & TRACE_LSN) {
403  printInfo(myName, "Requesting to listen on port #%d (0x%4.4X).\n",
404  (int) new_absolute_port, (int) new_absolute_port);
405 #ifndef __SYNTHESIS__
406  watchDogTimer_plisten = 10;
407 #else
408  watchDogTimer_plisten = 100;
409 #endif
410  lsnFsmState = LSN_WAIT_ACK;
411  }
412  }
413  //else {
414  // printWarn(myName, "Cannot send a listen port request to [UOE] because stream is full!\n");
415  //}
416  break;
417 
418  case LSN_WAIT_ACK:
419  if (!siUOE_LsnRep.empty() && !sUdpPortsOpenFeedback.full())
420  {
421  bool listenDone;
422  siUOE_LsnRep.read(listenDone);
423  if (listenDone) {
424  printInfo(myName, "Received listen acknowledgment from [UOE].\n");
425  lsnFsmState = LSN_SEND_REQ;
426  sUdpPortsOpenFeedback.write(true);
427  }
428  else {
429  printWarn(myName, "UOE denied listening on port %d (0x%4.4X).\n",
430  (int) new_absolute_port, (int) new_absolute_port);
431  sUdpPortsOpenFeedback.write(false);
432  lsnFsmState = LSN_SEND_REQ;
433  }
434  } else if (watchDogTimer_plisten == 0 && !sUdpPortsOpenFeedback.full() )
435  {
436  printError(myName, "Timeout: Server failed to listen on port %d %d (0x%4.4X).\n",
437  (int) new_absolute_port, (int) new_absolute_port);
438  sUdpPortsOpenFeedback.write(false);
439  lsnFsmState = LSN_SEND_REQ;
440  } else {
441  watchDogTimer_plisten--;
442  }
443  break;
444 
445  }
446 }
Here is the caller graph for this function:

◆ pUdpRx()

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 ).

Parameters
[in]layer_7_enabled,Externalsignal if layer 7 is enabled
[in]role_decoupled,Externalsignal if the role is decoupled
[out]soUdp_data,UDPData for the Role
[out]soUdp_meta,UDPMetadata for the Role
[in]siUOE_Data,UDPData from the UOE
[in]siUOE_Meta,UDPMetadata from the UOE
[in]siUOE_DLen,UDPPacketlength from the UOE (UDP header)
[in]sConfigUpdate,Updatesfrom axi4liteProcessing (own rank)
[out]sGetNidReq_UdpRx,Requeststream for the the MRT Agency
[in]sGetNidRep_UdpRx,Replystream from the MRT Agency
[in]cache_inval_sig,Signalfrom the Cache Invalidation Logic
[out]internal_event_fifo,Fifofor event reporting

Definition at line 467 of file uss.cpp.

481 {
482  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
483 #pragma HLS INLINE off
484 #pragma HLS pipeline II=1
485 
486  char *myName = concat3(THIS_NAME, "/", "Udp_RX");
487 
488  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
489  static FsmStateUdp fsmStateRX_Udp = FSM_W8FORMETA;
490  static NodeId cached_udp_rx_id = 0;
491  static Ip4Addr cached_udp_rx_ipaddr = 0;
492  static NodeId own_rank = 0;
493  static bool cache_init = false;
494  static uint8_t evs_loop_i = 0;
495 
496 #pragma HLS RESET variable=fsmStateRX_Udp
497 #pragma HLS RESET variable=cached_udp_rx_id
498 #pragma HLS RESET variable=cached_udp_rx_ipaddr
499 #pragma HLS RESET variable=own_rank
500 #pragma HLS RESET variable=cache_init
501 #pragma HLS RESET variable=evs_loop_i
502 
503  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
504  static UdpAppMeta udpRxMeta;
505  static UdpAppDLen udpRxLen;
506  static NodeId src_id = INVALID_MRT_VALUE;
507  static NetworkMeta in_meta;
508 
509  static stream<NalEventNotif> evsStreams[4];
510 
511  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
512  NalEventNotif new_ev_not;
513  NetworkMetaStream in_meta_udp_stream;
514  bool role_disabled = (*layer_7_enabled == 0 || *role_decoupled == 1);
515 
516 
517  switch(fsmStateRX_Udp) {
518 
519  default:
520  //case FSM_RESET:
521  //fsmStateRX_Udp = FSM_W8FORMETA;
522  //NO break;
523  case FSM_W8FORMETA:
524  if( !cache_inval_sig.empty() )
525  {
526  if(cache_inval_sig.read())
527  {
528  cached_udp_rx_id = 0;
529  cached_udp_rx_ipaddr = 0;
530  cache_init = false;
531  }
532  break;
533  } else if(!sConfigUpdate.empty())
534  {
535  NalConfigUpdate ca = sConfigUpdate.read();
537  {
538  own_rank = (NodeId) ca.update_value;
539  cache_init = false;
540  cached_udp_rx_id = 0;
541  cached_udp_rx_ipaddr = 0;
542  }
543  break;
544  } else if ( !siUOE_Meta.empty()
545  && !siUOE_DLen.empty()
546  && !sGetNidReq_UdpRx.full())
547  {
548  //extract src ip address
549  siUOE_Meta.read(udpRxMeta);
550  siUOE_DLen.read(udpRxLen);
551  src_id = (NodeId) INVALID_MRT_VALUE;
552 
553  if(role_disabled)
554  {
555  fsmStateRX_Udp = FSM_DROP_PACKET;
556  //no notifications necessary, UOE counts?
557  cache_init = false;
558  break;
559  }
560 
561  //to create here due to timing...
562  in_meta = NetworkMeta(own_rank, udpRxMeta.udpDstPort, 0, udpRxMeta.udpSrcPort, udpRxLen);
563 
564  //ask cache
565  if(cache_init && cached_udp_rx_ipaddr == udpRxMeta.ip4SrcAddr)
566  {
567  printf("used UDP RX id cache\n");
568  src_id = cached_udp_rx_id;
569  fsmStateRX_Udp = FSM_FIRST_ACC;
570  } else {
571  sGetNidReq_UdpRx.write(udpRxMeta.ip4SrcAddr);
572  fsmStateRX_Udp = FSM_W8FORREQS;
573  //break;
574  }
575  }
576  break;
577 
578  case FSM_W8FORREQS:
579  if(!sGetNidRep_UdpRx.empty())
580  {
581  src_id = sGetNidRep_UdpRx.read();
582  cached_udp_rx_ipaddr = udpRxMeta.ip4SrcAddr;
583  cached_udp_rx_id = src_id;
584  cache_init = true;
585  fsmStateRX_Udp = FSM_FIRST_ACC;
586  }
587  break;
588 
589  case FSM_FIRST_ACC:
590  if( !soUdp_meta.full() )
591  {
592  if(src_id == ((NodeId) INVALID_MRT_VALUE))
593  {
594  //SINK packet
595  new_ev_not = NalEventNotif(NID_MISS_RX, 1);
596  evsStreams[0].write_nb(new_ev_not);
597  printf("[UDP-RX:ERROR]invalid src_id, packet will be dropped.\n");
598  fsmStateRX_Udp = FSM_DROP_PACKET;
599  cache_init = false;
600  break;
601  }
602  //status
603  new_ev_not = NalEventNotif(LAST_RX_NID, src_id);
604  evsStreams[1].write_nb(new_ev_not);
605  new_ev_not = NalEventNotif(LAST_RX_PORT, udpRxMeta.udpDstPort);
606  evsStreams[2].write_nb(new_ev_not);
607  in_meta.src_rank = src_id;
608 
609  //write metadata
610  in_meta_udp_stream = NetworkMetaStream(in_meta);
611  soUdp_meta.write(in_meta_udp_stream);
612  //soUdp_meta.write(in_meta_udp);
613  new_ev_not = NalEventNotif(PACKET_RX, 1);
614  evsStreams[3].write_nb(new_ev_not);
615  // Forward data chunk to ROLE
616  fsmStateRX_Udp = FSM_ACC;
617  }
618  break;
619 
620  case FSM_ACC:
621  // Default stream handling
622  if ( !siUOE_Data.empty() && !soUdp_data.full() )
623  {
624  // Forward data chunk to ROLE
625  //NetworkWord udpWord = siUOE_Data.read();
626  UdpAppData udpWordtmp = siUOE_Data.read();
627  NetworkWord udpWord = NetworkWord(udpWordtmp.getLE_TData(), udpWordtmp.getLE_TKeep(), udpWordtmp.getLE_TLast());
628  soUdp_data.write(udpWord);
629  //TODO: should we verify the length of udpRxLen?
630 
631  // Until LAST bit is set
632  if (udpWord.tlast == 1)
633  {
634  fsmStateRX_Udp = FSM_W8FORMETA;
635  }
636  }
637  break;
638 
639  case FSM_DROP_PACKET:
640  if( !siUOE_Data.empty() )
641  {
642  UdpAppData udpWord = siUOE_Data.read();
643  // Until LAST bit is set
644  if (udpWord.getTLast() == 1)
645  {
646  fsmStateRX_Udp = FSM_W8FORMETA;
647  }
648  }
649  break;
650  } //switch
651 
652  //-- ALWAYS -----------------------
653  if(!internal_event_fifo.full())
654  {
655  if(!evsStreams[evs_loop_i].empty())
656  {
657  internal_event_fifo.write(evsStreams[evs_loop_i].read());
658  }
659  evs_loop_i++;
660  if(evs_loop_i >= 4)
661  {
662  evs_loop_i = 0;
663  }
664  }
665 
666 }
UdpLen UdpAppDLen
Definition: nal.hpp:255
FsmStateUdp
Definition: nal.hpp:141
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pUdpTX()

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).

Parameters
[in]siUdp_data,UDPData from the Role
[in]siUdp_meta,UDPMetadata from the Role
[out]soUOE_Data,UDPData for the UOE
[out]soUOE_Meta,UDPMetadata (i.e. HostSockAddr) for the UOE
[out]soUOE_DLen,UDPPacket length for the UOE
[out]sGetIpReq_UdpTx,Requeststream for the the MRT Agency
[in]sGetIpRep_UdpTx,Replystream from the MRT Agency
[in]ipAddrBE,IPaddress of the FPGA (from MMIO)
[in]cache_inval_sig,Signalfrom the Cache Invalidation Logic
[out]internal_event_fifo,Fifofor event reporting

Definition at line 51 of file uss.cpp.

63 {
64  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
65 #pragma HLS INLINE off
66 #pragma HLS pipeline II=1
67 
68  char *myName = concat3(THIS_NAME, "/", "Udp_TX");
69 
70  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
71  static FsmStateUdp fsmStateTX_Udp = FSM_RESET;
72  static NodeId cached_nodeid_udp_tx = UNUSED_SESSION_ENTRY_VALUE;
73  static Ip4Addr cached_ip4addr_udp_tx = 0;
74  static bool cache_init = false;
75  static uint8_t evs_loop_i = 0;
76 
77 #pragma HLS RESET variable=fsmStateTX_Udp
78 #pragma HLS RESET variable=cached_nodeid_udp_tx
79 #pragma HLS RESET variable=cached_ip4addr_udp_tx
80 #pragma HLS RESET variable=cache_init
81 #pragma HLS RESET variable=evs_loop_i
82 
83  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
84  static UdpAppDLen udpTX_packet_length = 0;
85  static UdpAppDLen udpTX_current_packet_length = 0;
86  static ap_uint<32> dst_ip_addr = 0;
87  static NetworkMetaStream udp_meta_in;
88  static NodeId dst_rank = 0;
89  static UdpAppMeta txMeta;
90  static NrcPort src_port;
91  static NrcPort dst_port;
92 
93  static stream<NalEventNotif> evsStreams[6];
94 
95  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
96  NalEventNotif new_ev_not;
97 
98  switch(fsmStateTX_Udp) {
99 
100  default:
101  case FSM_RESET:
102  fsmStateTX_Udp = FSM_W8FORMETA;
103  udpTX_packet_length = 0;
104  udpTX_current_packet_length = 0;
105  cache_init = false;
106  break;
107 
108  case FSM_W8FORMETA:
109  if( !cache_inval_sig.empty() )
110  {
111  if(cache_inval_sig.read())
112  {
113  cache_init = false;
114  cached_nodeid_udp_tx = UNUSED_SESSION_ENTRY_VALUE;
115  cached_ip4addr_udp_tx = 0;
116  }
117  break;
118  }
119  else if ( !siUdp_meta.empty() &&
120  !sGetIpReq_UdpTx.full() )
121  {
122  udp_meta_in = siUdp_meta.read();
123  udpTX_packet_length = udp_meta_in.tdata.len;
124  udpTX_current_packet_length = 0;
125 
126  // Send out the first data together with the metadata and payload length information
127 
128  dst_rank = udp_meta_in.tdata.dst_rank;
129  if(dst_rank > MAX_CF_NODE_ID)
130  {
131  new_ev_not = NalEventNotif(NID_MISS_TX, 1);
132  evsStreams[0].write_nb(new_ev_not);
133  //SINK packet
134  fsmStateTX_Udp = FSM_DROP_PACKET;
135  break;
136  }
137 
138  src_port = udp_meta_in.tdata.src_port;
139  if (src_port == 0)
140  {
141  src_port = DEFAULT_RX_PORT;
142  }
143  dst_port = udp_meta_in.tdata.dst_port;
144  if (dst_port == 0)
145  {
146  dst_port = DEFAULT_RX_PORT;
147  new_ev_not = NalEventNotif(PCOR_TX, 1);
148  evsStreams[3].write_nb(new_ev_not);
149  }
150 
151  //to create here due to timing...
152  //dst addres as 0 for now
153  txMeta = UdpAppMeta(*ipAddrBE, src_port, 0, dst_port);
154 
155  //request ip if necessary
156  if(cache_init && cached_nodeid_udp_tx == dst_rank)
157  {
158  dst_ip_addr = cached_ip4addr_udp_tx;
159  fsmStateTX_Udp = FSM_FIRST_ACC;
160  printf("used UDP TX id cache\n");
161  } else {
162 
163  sGetIpReq_UdpTx.write(dst_rank);
164  fsmStateTX_Udp = FSM_W8FORREQS;
165  //break;
166  }
167  }
168  break;
169 
170  case FSM_W8FORREQS:
171  if(!sGetIpRep_UdpTx.empty())
172  {
173  dst_ip_addr = sGetIpRep_UdpTx.read();
174  //TODO: need new FSM states
175  cached_nodeid_udp_tx = dst_rank;
176  cached_ip4addr_udp_tx = dst_ip_addr;
177  cache_init = true;
178  fsmStateTX_Udp = FSM_FIRST_ACC;
179  }
180  break;
181 
182  case FSM_FIRST_ACC:
183  if ( !soUOE_Meta.full()
184  && !soUOE_DLen.full() )
185  {
186  if(dst_ip_addr == 0)
187  {
188  new_ev_not = NalEventNotif(NID_MISS_TX, 1);
189  evsStreams[1].write_nb(new_ev_not);
190  //SINK packet
191  fsmStateTX_Udp = FSM_DROP_PACKET;
192  break;
193  }
194  new_ev_not = NalEventNotif(LAST_TX_NID, dst_rank);
195  evsStreams[2].write_nb(new_ev_not);
196  new_ev_not = NalEventNotif(LAST_TX_PORT, dst_port);
197  evsStreams[4].write_nb(new_ev_not);
198  //UdpMeta txMeta = {{src_port, ipAddrBE}, {dst_port, dst_ip_addr}};
199  //txMeta = SocketPair(SockAddr(*ipAddrBE, src_port), SockAddr(dst_ip_addr, dst_port));
200  txMeta.ip4DstAddr = dst_ip_addr;
201 
202  // Forward data chunk, metadata and payload length
203  soUOE_Meta.write(txMeta);
204 
205  //we can forward the length, even if 0
206  //the UOE handles this as streaming mode
207  soUOE_DLen.write(udpTX_packet_length);
208  new_ev_not = NalEventNotif(PACKET_TX, 1);
209  evsStreams[5].write_nb(new_ev_not);
210 
211  fsmStateTX_Udp = FSM_ACC;
212  }
213  break;
214 
215  case FSM_ACC:
216  // Default stream handling
217  if ( !siUdp_data.empty() && !soUOE_Data.full() )
218  {
219  // Forward data chunk
220  //UdpAppData aWord = siUdp_data.read();
221  NetworkWord tmpWord = siUdp_data.read();
222  UdpAppData aWord = UdpAppData(tmpWord.tdata, tmpWord.tkeep, tmpWord.tlast);
223  udpTX_current_packet_length += extractByteCnt(aWord);
224  if(udpTX_packet_length > 0 && udpTX_current_packet_length >= udpTX_packet_length)
225  {//we need to set tlast manually
226  aWord.setTLast(1);
227  }
228 
229  soUOE_Data.write(aWord);
230  // Until LAST bit is set
231  if (aWord.getTLast() == 1)
232  {
233  fsmStateTX_Udp = FSM_W8FORMETA;
234  }
235  }
236  break;
237 
238  case FSM_DROP_PACKET:
239  if ( !siUdp_data.empty() )
240  {
241  //UdpAppData aWord = siUdp_data.read();
242  NetworkWord tmpWord = siUdp_data.read();
243  UdpAppData aWord = UdpAppData(tmpWord.tdata, tmpWord.tkeep, tmpWord.tlast);
244  udpTX_current_packet_length += extractByteCnt(aWord);
245 
246  if( (udpTX_packet_length > 0 && udpTX_current_packet_length >= udpTX_packet_length)
247  || aWord.getTLast() == 1 )
248  {
249  fsmStateTX_Udp = FSM_W8FORMETA;
250  }
251  }
252  break;
253  } //switch
254 
255  //-- ALWAYS -----------------------
256  if(!internal_event_fifo.full())
257  {
258  if(!evsStreams[evs_loop_i].empty())
259  {
260  internal_event_fifo.write(evsStreams[evs_loop_i].read());
261  }
262  evs_loop_i++;
263  if(evs_loop_i >= 6)
264  {
265  evs_loop_i = 0;
266  }
267  }
268 
269 }
void setTLast(tLast last)
Definition: AxisRaw.hpp:246
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pUoeUdpTxDeq()

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 at line 277 of file uss.cpp.

287 {
288  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
289 #pragma HLS INLINE off
290 #pragma HLS pipeline II=1
291  //-- STATIC CONTROL VARIABLES (with RESET) --------------------------------
292  static DeqFsmStates deqFsmState = DEQ_WAIT_META;
293 #pragma HLS RESET variable=deqFsmState
294  //-- STATIC DATAFLOW VARIABLES --------------------------------------------
295  //-- LOCAL DATAFLOW VARIABLES ---------------------------------------------
296  UdpAppData cur_word;
297  UdpAppMeta cur_meta;
298  UdpAppDLen cur_dlen;
299  bool uoe_disabled = (*layer_4_enabled == 0 || *piNTS_ready == 0);
300 
301  switch(deqFsmState)
302  {
303  default:
304  case DEQ_WAIT_META:
305  if(!sUoeTxBuffer_Data.empty() && !sUoeTxBuffer_Meta.empty() && !sUoeTxBuffer_DLen.empty()
306  && ( (!soUOE_Data.full() && !soUOE_Meta.full() && !soUOE_DLen.full() ) || //UOE can read
307  (uoe_disabled) //UOE is disabled -> drain FIFOs
308  )
309  )
310  {
311  cur_word = sUoeTxBuffer_Data.read();
312  cur_meta = sUoeTxBuffer_Meta.read();
313  cur_dlen = sUoeTxBuffer_DLen.read();
314  if(!uoe_disabled)
315  {
316  soUOE_Data.write(cur_word);
317  soUOE_Meta.write(cur_meta);
318  soUOE_DLen.write(cur_dlen);
319  }
320  if(cur_word.getTLast() == 0)
321  {
322  deqFsmState = DEQ_STREAM_DATA;
323  }
324  }
325  break;
326  case DEQ_STREAM_DATA:
327  if(!sUoeTxBuffer_Data.empty()
328  && (!soUOE_Data.full() || uoe_disabled)
329  )
330  {
331  cur_word = sUoeTxBuffer_Data.read();
332  if(!uoe_disabled)
333  {
334  soUOE_Data.write(cur_word);
335  }
336  if(cur_word.getTLast() == 1)
337  {
338  deqFsmState = DEQ_WAIT_META;
339  }
340  }
341  break;
342  }
343 
344 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readDataStream()

bool readDataStream ( stream< UdpAppData > &  sDataStream,
UdpAppData udpWord 
)

Read data from a stream.

Parameters
[in]sDataStream,theoutput data stream to read.
[in]dataStreamName,thename of the data stream.
[out]udpWord,apointer to the storage location of the data to read.
Returns
VALID if a data was read, otherwise UNVALID.

Definition at line 395 of file tb_nal.cpp.

395  {
396  // Get the DUT/Data results
397  sDataStream.read(*udpWord);
398  return(VALID);
399 }
Here is the caller graph for this function:

◆ readMetaStream()

bool readMetaStream ( stream< UdpAppMeta > &  sMetaStream,
const string  metaStreamName,
UdpAppMeta udpMeta 
)

Read an output metadata stream from the DUT.

Parameters
[in]sMetaStream,theoutput metadata stream to read.
[in]metaStreamName,thename of the meta stream.
[out]udpMeta,apointer to the storage location of the metadata to read.
Returns
VALID if a data was read, otherwise UNVALID.

Definition at line 410 of file tb_nal.cpp.

411  {
412  // Get the DUT/Metadata results
413  sMetaStream.read(*udpMeta);
414  // Print DUT/Metadata to console
415  printf("[%4.4d] TB is draining output stream [%s] - Metadata = {{SP=0x%4.4X,SA=0x%8.8X} {DP=0x%4.4X,DA=0x%8.8X}} \n",
416  simCnt, metaStreamName.c_str(),
417  udpMeta->udpSrcPort.to_int(), udpMeta->ip4SrcAddr.to_int(), udpMeta->udpDstPort.to_int(), udpMeta->ip4DstAddr.to_int());
418  return(VALID);
419 }
Here is the caller graph for this function:

◆ readPLenStream()

bool readPLenStream ( stream< UdpPLen > &  sPLenStream,
const string  plenStreamName,
UdpPLen udpPLen 
)

Read an output payload length stream from the DUT.

Parameters
[in]sPLenStream,theoutput payload length stream to read.
[in]plenStreamName,thename of the payload length stream.
[out]udpPLen,apointer to the storage location of the payload length to read.
Returns
VALID if a data was read, otherwise UNVALID.

Definition at line 431 of file tb_nal.cpp.

432  {
433  // Get the DUT/PayloadLength results
434  sPLenStream.read(*udpPLen);
435  // Print DUT/PayloadLength to console
436  printf("[%4.4d] TB is draining output stream [%s] - Payload length = %d from DUT.\n",
437  simCnt, plenStreamName.c_str(), udpPLen->to_int());
438  return(VALID);
439 }
Here is the caller graph for this function:

◆ selectConfigUpdatePropagation()

uint8_t selectConfigUpdatePropagation ( uint16_t  config_addr)

This is the process that has to know which config value means what And to where it should be send:

Returns: 0 : no propagation 1 : to TCP tables 2 : to Port logic 3 : to own rank receivers

Definition at line 45 of file hss.cpp.

46 {
47 #pragma HLS INLINE
48  switch(config_addr) {
49  default:
50  return 0;
52  return 3;
56  return 2;
57  }
58 }
Here is the caller graph for this function:

◆ setInputDataStream() [1/2]

bool setInputDataStream ( stream< NetworkWord > &  sDataStream,
const string  dataStreamName,
const string  inpFileName 
)

Definition at line 269 of file tb_nal.cpp.

269  {
270  string strLine;
271  ifstream inpFileStream;
272  string datFile = "../../../../test/" + inpFileName;
273 
274  //-- STEP-1 : OPEN FILE
275  inpFileStream.open(datFile.c_str());
276  if ( !inpFileStream ) {
277  cout << "### ERROR : Could not open the input data file " << datFile << endl;
278  return(KO);
279  }
280 
281  //-- STEP-2 : SET DATA STREAM
282  while (inpFileStream) {
283 
284  if (!inpFileStream.eof()) {
285 
286  getline(inpFileStream, strLine);
287  if (strLine.empty())
288  {
289  continue;
290  }
291  uint64_t newd = 0x0;
292  uint32_t newk = 0; //sscanf expects 32bit
293  uint32_t newl = 0; //sscanf expects 32bit
294  //printf(strLine.c_str()); printf("\n");
295  //sscanf(strLine.c_str(), "%u" PRIx64 " %x %d", &newd, &newk, &newl);
296  sscanf(strLine.c_str(), "%llx %x %d", &newd, &newk, &newl);
297  UdpAppData udpWordTmp;
298  udpWordTmp.setTData(newd); //BE version
299  udpWordTmp.setTKeep(newk); //BE version
300  udpWordTmp.setTLast(newl); //BE version
301  NetworkWord udpWord = NetworkWord(udpWordTmp.getLE_TData(), udpWordTmp.getLE_TKeep(), udpWordTmp.getLE_TLast());
302  //printf("scanff reads %llx, %x %d\n", newd, newk, newl);
303 
304  // Write to sDataStream
305  if (sDataStream.full()) {
306  printf("### ERROR : Stream is full. Cannot write stream with data from file \"%s\".\n", inpFileName.c_str());
307  return(KO);
308  } else {
309  sDataStream.write(udpWord);
310  // Print Data to console
311  printf("[%4.4d] TB is filling input stream [%s] - Data write = {D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
312  simCnt, dataStreamName.c_str(),
313  udpWord.tdata.to_uint64(), udpWord.tkeep.to_int(), udpWord.tlast.to_int());
314  }
315  }
316  }
317 
318  //-- STEP-3: CLOSE FILE
319  inpFileStream.close();
320 
321  return(OK);
322 }
void setTKeep(tKeep keep)
Definition: AxisRaw.hpp:239
void setTData(tData data)
Definition: AxisRaw.hpp:228
Here is the call graph for this function:

◆ setInputDataStream() [2/2]

bool setInputDataStream ( stream< UdpAppData > &  sDataStream,
const string  dataStreamName,
const string  inpFileName 
)

Initialize an input data stream from a file.

Parameters
[in]sDataStream,theinput data stream to set.
[in]dataStreamName,thename of the data stream.
[in]inpFileName,thename of the input file to read from.
Returns
OK if successful, otherwise KO.

Definition at line 214 of file tb_nal.cpp.

214  {
215  string strLine;
216  ifstream inpFileStream;
217  string datFile = "../../../../test/" + inpFileName;
218 
219  //-- STEP-1 : OPEN FILE
220  inpFileStream.open(datFile.c_str());
221  if ( !inpFileStream ) {
222  cout << "### ERROR : Could not open the input data file " << datFile << endl;
223  return(KO);
224  }
225 
226  //-- STEP-2 : SET DATA STREAM
227  while (inpFileStream) {
228 
229  if (!inpFileStream.eof()) {
230 
231  getline(inpFileStream, strLine);
232  if (strLine.empty())
233  {
234  continue;
235  }
236  uint64_t newd = 0x0;
237  uint32_t newk = 0; //sscanf expects 32bit
238  uint32_t newl = 0; //sscanf expects 32bit
239  //printf(strLine.c_str()); printf("\n");
240  //sscanf(strLine.c_str(), "%u" PRIx64 " %x %d", &newd, &newk, &newl);
241  sscanf(strLine.c_str(), "%llx %x %d", &newd, &newk, &newl);
242  UdpAppData udpWord;
243  udpWord.setTData(newd); //BE version
244  udpWord.setTKeep(newk); //BE version
245  udpWord.setTLast(newl); //BE version
246  //printf("scanff reads %llx, %x %d\n", newd, newk, newl);
247  //UdpAppData udpWord(newd, newk, newl);
248 
249  // Write to sDataStream
250  if (sDataStream.full()) {
251  printf("### ERROR : Stream is full. Cannot write stream with data from file \"%s\".\n", inpFileName.c_str());
252  return(KO);
253  } else {
254  sDataStream.write(udpWord);
255  // Print Data to console
256  printf("[%4.4d] TB is filling input stream [%s] - Data write = {D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
257  simCnt, dataStreamName.c_str(),
258  udpWord.getTData().to_uint64(), udpWord.getTKeep().to_int(), udpWord.getTLast().to_int());
259  }
260  }
261  }
262 
263  //-- STEP-3: CLOSE FILE
264  inpFileStream.close();
265 
266  return(OK);
267 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInputMetaStream()

bool setInputMetaStream ( stream< UdpAppMeta > &  sMetaStream,
const string  dataStreamName,
const string  inpFileName 
)

Initialize an input meta stream from a file.

Parameters
[in]sMetaStream,theinput meta stream to set.
[in]dataStreamName,thename of the data stream.
[in]inpFileName,thename of the input file to read from.
Returns
OK if successful, otherwise KO.

Definition at line 333 of file tb_nal.cpp.

333  {
334  string strLine;
335  ifstream inpFileStream;
336  string datFile = "../../../../test/" + inpFileName;
337  UdpWord udpWord;
338  UdpAppMeta udpMeta;
339 
340  //-- STEP-1 : OPEN FILE
341  inpFileStream.open(datFile.c_str());
342  if ( !inpFileStream ) {
343  cout << "### ERROR : Could not open the input data file " << datFile << endl;
344  return(KO);
345  }
346 
347  //-- STEP-2 : SET DATA STREAM
348  while (inpFileStream) {
349 
350  if (!inpFileStream.eof()) {
351 
352  getline(inpFileStream, strLine);
353  if (strLine.empty()) continue;
354  sscanf(strLine.c_str(), "%llx %x %d", &udpWord.tdata, &udpWord.tkeep, &udpWord.tlast);
355 
356  // Check if the LAST bit is set
357  if (udpWord.tlast) {
358 
359  // Create an connection association {{SrcPort, SrcAdd}, {DstPort, DstAdd}}
360  //socketPair = (UdpMeta) {{DEFAULT_RX_PORT, 0x0A0B0C01}, {DEFAULT_RX_PORT, 0x0A0B0C0E}};
361  udpMeta = UdpAppMeta(DEFAULT_RX_PORT, 0x0A0B0C01, DEFAULT_RX_PORT, 0x0A0B0C0E);
362 
363  // Write to sMetaStream
364  if (sMetaStream.full()) {
365  printf("### ERROR : Stream is full. Cannot write stream with data from file \"%s\".\n", inpFileName.c_str());
366  return(KO);
367  }
368  else {
369  sMetaStream.write(udpMeta);
370  // Print Metadata to console
371  printf("[%4.4d] TB is filling input stream [%s] - Metadata = {{SP=0x%4.4X,SA=0x%8.8X} {DP=0x%4.4X,DA=0x%8.8X}} \n",
372  simCnt, dataStreamName.c_str(),
373  udpMeta.udpSrcPort.to_int(), udpMeta.ip4SrcAddr.to_int(), udpMeta.udpDstPort.to_int(), udpMeta.ip4DstAddr.to_int());
374  }
375  }
376  }
377  }
378 
379  //-- STEP-3: CLOSE FILE
380  inpFileStream.close();
381 
382  return(OK);
383 }
ap_uint< 64 > tdata
ap_uint< 1 > tlast
ap_uint< 8 > tkeep

◆ sFMC_Nrc_Tcp_data()

stream<NetworkWord> sFMC_Nrc_Tcp_data ( "sFMC_Nrc_Tcp_data"  )
Here is the caller graph for this function:

◆ sFMC_Nrc_Tcp_sessId()

stream<TcpSessId> sFMC_Nrc_Tcp_sessId ( "sFMC_Nrc_Tcp_sessId"  )
Here is the caller graph for this function:

◆ siUdp_meta()

stream< NetworkMetaStream > siUdp_meta ( "siUdp_meta"  )
Here is the caller graph for this function:

◆ sNRC_FMC_Tcp_data()

stream<NetworkWord> sNRC_FMC_Tcp_data ( "sNRC_FMC_Tcp_data"  )
Here is the caller graph for this function:

◆ sNRC_FMC_Tcp_sessId()

stream<TcpSessId> sNRC_FMC_Tcp_sessId ( "sNRC_FMC_Tcp_sessId"  )
Here is the caller graph for this function:

◆ sNRC_Role_Data()

stream<NetworkWord> sNRC_Role_Data ( "sNRC_Role_Data"  )
Here is the caller graph for this function:

◆ sNRC_Role_Tcp_data()

stream<NetworkWord> sNRC_Role_Tcp_data ( "sNRC_Role_Tcp_data"  )
Here is the caller graph for this function:

◆ sNRC_Role_Tcp_meta()

stream<NetworkMetaStream> sNRC_Role_Tcp_meta ( "sNRC_Role_Tcp_meta"  )
Here is the caller graph for this function:

◆ sNRC_Toe_ClsReq()

stream<TcpAppClsReq> sNRC_Toe_ClsReq ( "sNRC_TOE_ClsReq"  )
Here is the caller graph for this function:

◆ sNRC_Toe_Data()

stream<TcpAppData> sNRC_Toe_Data ( "sNRC_TOE_Data"  )
Here is the caller graph for this function:

◆ sNRC_Toe_DReq()

stream<TcpAppRdReq> sNRC_Toe_DReq ( "sNrc_TOE_DReq"  )
Here is the caller graph for this function:

◆ sNRC_Toe_LsnReq()

stream<TcpAppLsnReq> sNRC_Toe_LsnReq ( "sNRC_TOE_LsnReq"  )
Here is the caller graph for this function:

◆ sNRC_Toe_OpnReq()

stream<TcpAppOpnReq> sNRC_Toe_OpnReq ( "sNRC_Toe_OpnReq"  )
Here is the caller graph for this function:

◆ sNRC_Toe_SndReq()

stream<TcpAppSndReq> sNRC_Toe_SndReq ( "sNRC_TOE_SndReq"  )
Here is the caller graph for this function:

◆ sNRC_UOE_ClsReq()

stream<UdpPort> sNRC_UOE_ClsReq ( "sNRC_UOE_ClsReq"  )
Here is the caller graph for this function:

◆ sNRC_UOE_Data()

stream<UdpAppData> sNRC_UOE_Data ( "sNRC_UOE_Data"  )
Here is the caller graph for this function:

◆ sNRC_UOE_DLen()

stream<UdpAppDLen> sNRC_UOE_DLen ( "sNRC_UOE_DLen"  )
Here is the caller graph for this function:

◆ sNRC_UOE_LsnReq()

stream<UdpPort> sNRC_UOE_LsnReq ( "sNRC_UOE_LsnReq"  )
Here is the caller graph for this function:

◆ sNRC_UOE_Meta()

stream<UdpAppMeta> sNRC_UOE_Meta ( "sNRC_UOE_Meta"  )
Here is the caller graph for this function:

◆ soUdp_meta()

stream< NetworkMetaStream > soUdp_meta ( "soUdp_meta"  )
Here is the caller graph for this function:

◆ sROLE_NRC_Data()

stream<NetworkWord> sROLE_NRC_Data ( "sROLE_NRC_Data"  )
Here is the caller graph for this function:

◆ sROLE_Nrc_Tcp_data()

stream<NetworkWord> sROLE_Nrc_Tcp_data ( "sROLE_Nrc_Tcp_data"  )
Here is the caller graph for this function:

◆ sROLE_Nrc_Tcp_meta()

stream<NetworkMetaStream> sROLE_Nrc_Tcp_meta ( "sROLE_Nrc_Tcp_meta"  )
Here is the caller graph for this function:

◆ stepDut()

void stepDut ( )

Run a single iteration of the DUT model.

Returns
Nothing.

Definition at line 171 of file tb_nal.cpp.

171  {
172  nal_main(
173  ctrlLink,
179  &sIpAddress,
187  //&piFMC_Tcp_data_FIFO_prog_full,
189  //&piFMC_Tcp_sessid_FIFO_prog_full,
200  );
201  simCnt++;
202  printf("[%4.4d] STEP DUT \n", simCnt);
203 }
ap_uint< 1 > layer_7_enabled
Definition: tb_nal.cpp:133
ap_uint< 1 > sNTS_Nrc_ready
Definition: tb_nal.cpp:135
ap_uint< 32 > sMMIO_CfrmIp4Addr
Definition: tb_nal.cpp:143
stream< TcpAppClsReq > sNRC_Toe_ClsReq("sNRC_TOE_ClsReq")
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
ap_uint< 1 > layer_4_enabled
Definition: tb_nal.cpp:132
stream< StsBool > sUOE_NRC_ClsRep("sUOE_NRC_ClsRep")
stream< UdpPort > sNRC_UOE_ClsReq("sNRC_UOE_ClsReq")
ap_uint< 16 > sMMIO_FmcLsnPort
Definition: tb_nal.cpp:141
ap_uint< 32 > sIpAddress
Definition: tb_nal.cpp:136
ap_uint< 32 > s_udp_rx_ports
Definition: tb_nal.cpp:138
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sTOE_Nrc_Data()

stream<TcpAppData> sTOE_Nrc_Data ( "sTOE_Nrc_Data"  )
Here is the caller graph for this function:

◆ sTOE_Nrc_LsnAck()

stream<TcpAppLsnRep> sTOE_Nrc_LsnAck ( "sTOE_Nrc_LsnAck"  )
Here is the caller graph for this function:

◆ sTOE_Nrc_Notif()

stream<TcpAppNotif> sTOE_Nrc_Notif ( "sTOE_Nrc_Notif"  )
Here is the caller graph for this function:

◆ sTOE_Nrc_OpnRep()

stream<TcpAppOpnRep> sTOE_Nrc_OpnRep ( "sTOE_NRC_OpenRep"  )
Here is the caller graph for this function:

◆ sTOE_Nrc_SessId()

stream<TcpAppMeta> sTOE_Nrc_SessId ( "sTOE_Nrc_SessId"  )
Here is the caller graph for this function:

◆ sTOE_Nrc_SndRep()

stream<TcpAppSndRep> sTOE_Nrc_SndRep ( "sTOE_NRC_SndRep"  )
Here is the caller graph for this function:

◆ sUOE_NRC_ClsRep()

stream<StsBool> sUOE_NRC_ClsRep ( "sUOE_NRC_ClsRep"  )
Here is the caller graph for this function:

◆ sUOE_NRC_Data()

stream<UdpAppData> sUOE_NRC_Data ( "sUOE_NRC_Data"  )
Here is the caller graph for this function:

◆ sUOE_NRC_DLen()

stream<UdpAppDLen> sUOE_NRC_DLen ( "sUOE_NRC_DLen"  )
Here is the caller graph for this function:

◆ sUOE_NRC_LsnRep()

stream<StsBool> sUOE_NRC_LsnRep ( "sUOE_NRC_LsnRep"  )
Here is the caller graph for this function:

◆ sUOE_NRC_Meta()

stream<UdpAppMeta> sUOE_NRC_Meta ( "sUOE_NRC_Meta"  )
Here is the caller graph for this function:

Variable Documentation

◆ appRdReq

TcpAppRdReq appRdReq

Definition at line 826 of file tb_nal.cpp.

◆ byteCnt

int byteCnt = 0

Definition at line 829 of file tb_nal.cpp.

◆ ctrlLink

ap_uint<32> ctrlLink[64+ 16+ 16]

Definition at line 137 of file tb_nal.cpp.

◆ data

ap_uint<64> data =0

Definition at line 832 of file tb_nal.cpp.

◆ fpgaLsnPort

TcpPort fpgaLsnPort = -1

Definition at line 812 of file tb_nal.cpp.

◆ gFatalError

bool gFatalError = false

Definition at line 152 of file tb_nal.cpp.

◆ gSimCycCnt

unsigned int gSimCycCnt = 0

GLOBAL VARIABLES USED BY THE SIMULATION ENVIRONMENT

Definition at line 150 of file tb_nal.cpp.

◆ gTraceEvent [1/2]

bool gTraceEvent
extern

HELPERS FOR THE DEBUGGING TRACES .e.g: DEBUG_LEVEL = (MDL_TRACE | IPS_TRACE)

Definition at line 151 of file tb_nal.cpp.

◆ gTraceEvent [2/2]

bool gTraceEvent = false

HELPERS FOR THE DEBUGGING TRACES .e.g: DEBUG_LEVEL = (MDL_TRACE | IPS_TRACE)

Definition at line 151 of file tb_nal.cpp.

◆ hostIp4Addr

Ip4Addr hostIp4Addr = 0

Emulate the behavior of the TCP Offload Engine (TOE).

Parameters
[in]nrErr,Aref to the error counter of main.
[out]soTRIF_Notif,Notificationto TcpRoleInterface (TRIF).
[in]siTRIF_DReq,Dataread request from [TRIF}.
[out]soTRIF_Data,Datato [TRIF].
[out]soTRIF_SessId,SessionId to [TRIF].
[in]siTRIF_LsnReq,Listenport request from [TRIF].
[out]soTRIF_LsnAck,Listenport acknowledge to [TRIF].

Definition at line 811 of file tb_nal.cpp.

◆ hostSrcPort

TcpPort hostSrcPort = 80

Definition at line 813 of file tb_nal.cpp.

◆ layer_4_enabled

ap_uint<1> layer_4_enabled = 0b1

Definition at line 132 of file tb_nal.cpp.

◆ layer_7_enabled

ap_uint<1> layer_7_enabled = 0b1

Definition at line 133 of file tb_nal.cpp.

◆ loop

int loop = 1

Definition at line 814 of file tb_nal.cpp.

◆ lsnState

enum LsnStates lsnState = LSN_WAIT_REQ

◆ myIpAddress

ap_uint<32> myIpAddress

Definition at line 140 of file tb_nal.cpp.

◆ myLsnName

const char* myLsnName = "NAL" "/" "TOE/Listen"

Definition at line 835 of file tb_nal.cpp.

◆ myOpnName

const char* myOpnName = "NAL" "/" "TOE/OpnCon"

Definition at line 836 of file tb_nal.cpp.

◆ myRxpName

const char* myRxpName = "NAL" "/" "TOE/RxPath"

Definition at line 837 of file tb_nal.cpp.

◆ myTxpName

const char* myTxpName = "NAL" "/" "TOE/TxPath"

Definition at line 838 of file tb_nal.cpp.

◆ nrSegToSend

int nrSegToSend = 3

Definition at line 831 of file tb_nal.cpp.

◆ opnStartupDelay

int opnStartupDelay = 0

Definition at line 821 of file tb_nal.cpp.

◆ opnState

enum OpnStates opnState = OPN_WAIT_REQ

◆ role_decoupled

ap_uint<1> role_decoupled = 0b0

Definition at line 134 of file tb_nal.cpp.

◆ roleFsmState

enum RoleFsmStates roleFsmState = ROLE_WAIT_META

◆ rxFsmState

enum RxFsmStates rxFsmState = RX_WAIT_META

◆ rxpStartupDelay

int rxpStartupDelay = 100

Definition at line 823 of file tb_nal.cpp.

◆ rxpState

enum RxpStates rxpState = RXP_SEND_NOTIF

◆ s_tcp_rx_ports

ap_uint<32> s_tcp_rx_ports = 0x1

Definition at line 139 of file tb_nal.cpp.

◆ s_udp_rx_ports

ap_uint<32> s_udp_rx_ports = 0x1

Definition at line 138 of file tb_nal.cpp.

◆ segCnt

int segCnt = 0

Definition at line 830 of file tb_nal.cpp.

◆ sessionId

AppMeta sessionId = 42

Definition at line 827 of file tb_nal.cpp.

◆ sessionId_reply

AppMeta sessionId_reply = 42

Definition at line 828 of file tb_nal.cpp.

◆ simCnt

unsigned int simCnt

Definition at line 158 of file tb_nal.cpp.

◆ sIpAddress

ap_uint<32> sIpAddress = 0x0a0b0c0d

Definition at line 136 of file tb_nal.cpp.

◆ sMMIO_CfrmIp4Addr

ap_uint<32> sMMIO_CfrmIp4Addr = 0x0A0CC832

Definition at line 143 of file tb_nal.cpp.

◆ sMMIO_FmcLsnPort

ap_uint<16> sMMIO_FmcLsnPort = 8803

Definition at line 141 of file tb_nal.cpp.

◆ sNTS_Nrc_ready

ap_uint<1> sNTS_Nrc_ready = 0b1

Definition at line 135 of file tb_nal.cpp.

◆ tcp_packets_expected_timeout

int tcp_packets_expected_timeout = 0

Definition at line 163 of file tb_nal.cpp.

◆ tcp_packets_recv

int tcp_packets_recv = 0

Definition at line 161 of file tb_nal.cpp.

◆ tcp_packets_send

int tcp_packets_send = 0

Definition at line 160 of file tb_nal.cpp.

◆ tcp_recv_frag_cnt

int tcp_recv_frag_cnt = 0

Definition at line 162 of file tb_nal.cpp.

◆ tcp_timout_packet_drop

int tcp_timout_packet_drop = 0

Definition at line 164 of file tb_nal.cpp.

◆ tcpSegLen

TcpSegLen tcpSegLen = 32

Definition at line 833 of file tb_nal.cpp.

◆ txpStartupDelay

int txpStartupDelay = 0

Definition at line 824 of file tb_nal.cpp.

◆ txpState

enum TxpStates txpState = TXP_WAIT_REQ