77 #include "../../../NTS/nts.hpp"
78 #include "../../../NTS/nts_utils.hpp"
79 #include "../../../NTS/SimNtsUtils.hpp"
80 #include "../../../MEM/mem.hpp"
99 #define TOE_SIZEOF_LISTEN_PORT_TABLE 0x8000
100 #define TOE_SIZEOF_ACTIVE_PORT_TABLE 0x8000
101 #define TOE_FIRST_EPHEMERAL_PORT_NUM 0x8000
103 #define TOE_FEATURE_USED_FOR_DEBUGGING 0
110 #ifndef __SYNTHESIS__
116 static const ap_uint<32> TIME_1s = 250;
118 static const ap_uint<32> TIME_1us = (((ap_uint<32>)(TIME_1s/1000000) > 1) ? (ap_uint<32>)(TIME_1s/1000000) : (ap_uint<32>)1);
119 static const ap_uint<32> TIME_64us = (((ap_uint<32>)(TIME_1s/ 15625) > 1) ? (ap_uint<32>)(TIME_1s/ 15625) : (ap_uint<32>)1);
120 static const ap_uint<32> TIME_128us = (((ap_uint<32>)(TIME_1s/ 31250) > 1) ? (ap_uint<32>)(TIME_1s/ 31250) : (ap_uint<32>)1);
121 static const ap_uint<32> TIME_256us = (((ap_uint<32>)(TIME_1s/ 62500) > 1) ? (ap_uint<32>)(TIME_1s/ 62500) : (ap_uint<32>)1);
122 static const ap_uint<32> TIME_512us = (((ap_uint<32>)(TIME_1s/ 125000) > 1) ? (ap_uint<32>)(TIME_1s/ 125000) : (ap_uint<32>)1);
124 static const ap_uint<32> ACKD_1us = ( 1.0/0.0064/TOE_MAX_SESSIONS/10) + 1;
125 static const ap_uint<32> ACKD_2us = ( 2.0/0.0064/TOE_MAX_SESSIONS/10) + 1;
126 static const ap_uint<32> ACKD_4us = ( 4.0/0.0064/TOE_MAX_SESSIONS/10) + 1;
127 static const ap_uint<32> ACKD_8us = ( 8.0/0.0064/TOE_MAX_SESSIONS/10) + 1;
128 static const ap_uint<32> ACKD_16us = ( 16.0/0.0064/TOE_MAX_SESSIONS/10) + 1;
129 static const ap_uint<32> ACKD_32us = ( 32.0/0.0064/TOE_MAX_SESSIONS/10) + 1;
130 static const ap_uint<32> ACKD_64us = ( 64.0/0.0064/TOE_MAX_SESSIONS/10) + 1;
132 static const ap_uint<32> TIME_1ms = (((ap_uint<32>)(TIME_1s/1000) > 1) ? (ap_uint<32>)(TIME_1s/1000) : (ap_uint<32>)1);
133 static const ap_uint<32> TIME_5ms = (((ap_uint<32>)(TIME_1s/ 200) > 1) ? (ap_uint<32>)(TIME_1s/ 200) : (ap_uint<32>)1);
134 static const ap_uint<32> TIME_25ms = (((ap_uint<32>)(TIME_1s/ 40) > 1) ? (ap_uint<32>)(TIME_1s/ 40) : (ap_uint<32>)1);
135 static const ap_uint<32> TIME_50ms = (((ap_uint<32>)(TIME_1s/ 20) > 1) ? (ap_uint<32>)(TIME_1s/ 20) : (ap_uint<32>)1);
136 static const ap_uint<32> TIME_100ms = (((ap_uint<32>)(TIME_1s/ 10) > 1) ? (ap_uint<32>)(TIME_1s/ 10) : (ap_uint<32>)1);
137 static const ap_uint<32> TIME_250ms = (((ap_uint<32>)(TIME_1s/ 4) > 1) ? (ap_uint<32>)(TIME_1s/ 4) : (ap_uint<32>)1);
139 static const ap_uint<32> TIME_3s = ( 3*TIME_1s);
140 static const ap_uint<32> TIME_5s = ( 5*TIME_1s);
141 static const ap_uint<32> TIME_6s = ( 6*TIME_1s);
142 static const ap_uint<32> TIME_7s = ( 7*TIME_1s);
143 static const ap_uint<32> TIME_10s = ( 10*TIME_1s);
144 static const ap_uint<32> TIME_12s = ( 12*TIME_1s);
145 static const ap_uint<32> TIME_15s = ( 15*TIME_1s);
146 static const ap_uint<32> TIME_20s = ( 20*TIME_1s);
147 static const ap_uint<32> TIME_30s = ( 30*TIME_1s);
148 static const ap_uint<32> TIME_60s = ( 60*TIME_1s);
149 static const ap_uint<32> TIME_120s = (120*TIME_1s);
151 static const ap_uint<32> ACKD_1us = ( 1.0/0.0064/TOE_MAX_SESSIONS) + 1;
152 static const ap_uint<32> ACKD_2us = ( 2.0/0.0064/TOE_MAX_SESSIONS) + 1;
153 static const ap_uint<32> ACKD_4us = ( 4.0/0.0064/TOE_MAX_SESSIONS) + 1;
154 static const ap_uint<32> ACKD_8us = ( 8.0/0.0064/TOE_MAX_SESSIONS) + 1;
155 static const ap_uint<32> ACKD_16us = ( 16.0/0.0064/TOE_MAX_SESSIONS) + 1;
156 static const ap_uint<32> ACKD_32us = ( 32.0/0.0064/TOE_MAX_SESSIONS) + 1;
157 static const ap_uint<32> ACKD_64us = ( 64.0/0.0064/TOE_MAX_SESSIONS) + 1;
158 static const ap_uint<32> TIME_128us = (128.0/0.0064/TOE_MAX_SESSIONS) + 1;
159 static const ap_uint<32> TIME_256us = (256.0/0.0064/TOE_MAX_SESSIONS) + 1;
160 static const ap_uint<32> TIME_512us = (512.0/0.0064/TOE_MAX_SESSIONS) + 1;
162 static const ap_uint<32> TIME_1ms = ( 1.0/0.0000064/TOE_MAX_SESSIONS) + 1;
163 static const ap_uint<32> TIME_5ms = ( 5.0/0.0000064/TOE_MAX_SESSIONS) + 1;
164 static const ap_uint<32> TIME_25ms = ( 25.0/0.0000064/TOE_MAX_SESSIONS) + 1;
165 static const ap_uint<32> TIME_50ms = ( 50.0/0.0000064/TOE_MAX_SESSIONS) + 1;
166 static const ap_uint<32> TIME_100ms = (100.0/0.0000064/TOE_MAX_SESSIONS) + 1;
167 static const ap_uint<32> TIME_250ms = (250.0/0.0000064/TOE_MAX_SESSIONS) + 1;
169 static const ap_uint<32> TIME_1s = ( 1.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
170 static const ap_uint<32> TIME_3s = ( 3.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
171 static const ap_uint<32> TIME_5s = ( 5.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
172 static const ap_uint<32> TIME_6s = ( 6.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
173 static const ap_uint<32> TIME_7s = ( 7.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
174 static const ap_uint<32> TIME_10s = ( 10.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
175 static const ap_uint<32> TIME_12s = ( 12.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
176 static const ap_uint<32> TIME_15s = ( 15.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
177 static const ap_uint<32> TIME_20s = ( 20.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
178 static const ap_uint<32> TIME_30s = ( 30.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
179 static const ap_uint<32> TIME_60s = ( 60.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
180 static const ap_uint<32> TIME_120s = (120.0/0.0000000064/TOE_MAX_SESSIONS) + 1;
187 #define cIP4_ADDR_WIDTH 32
189 #define cTCP_PORT_WIDTH 16
191 #define cSHL_TOE_SESS_ID_WIDTH 16
192 #define cSHL_TOE_LSN_ACK_WIDTH 1
193 #define cSHL_TOE_LSN_REQ_WIDTH cSHL_TOE_SESS_ID_WIDTH
194 #define cSHL_TOE_OPN_REQ_WIDTH (cIP4_ADDR_WIDTH + cTCP_PORT_WIDTH)
195 #define cSHL_TOE_CLS_REQ_WIDTH cSHL_TOE_SESS_ID_WIDTH
198 typedef ap_uint<cSHL_TOE_LSN_ACK_WIDTH>
LsnAck;
199 typedef ap_uint<cSHL_TOE_LSN_REQ_WIDTH>
LsnReq;
200 typedef ap_uint<cSHL_TOE_OPN_REQ_WIDTH>
OpnReq;
201 typedef ap_uint<cSHL_TOE_CLS_REQ_WIDTH>
ClsReq;
538 return not_ackd(TOE_WINDOW_BITS-1, 0);
562 ap_uint<16> min_window;
607 ap_uint<16> min_window;
615 sessionID(id),
ackd(
ackd),
mempt(pt), min_window(min_window) {}
727 #define RXMEMBUF 65536
728 #define TXMEMBUF 65536
743 #if HLS_VERSION == 2017
750 stream<StsBit> &soMMIO_RxMemWrErr,
751 stream<ap_uint<8> > &soMMIO_NotifDropCnt,
752 stream<ap_uint<8> > &soMMIO_MetaDropCnt,
753 stream<ap_uint<8> > &soMMIO_DataDropCnt,
754 stream<ap_uint<8> > &soMMIO_CrcDropCnt,
755 stream<ap_uint<8> > &soMMIO_SessDropCnt,
756 stream<ap_uint<8> > &soMMIO_OooDropCnt,
766 stream<AxisIp4> &siIPRX_Data,
771 stream<AxisIp4> &soIPTX_Data,
776 stream<TcpAppNotif> &soTAIF_Notif,
777 stream<TcpAppRdReq> &siTAIF_DReq,
778 stream<TcpAppData> &soTAIF_Data,
779 stream<TcpAppMeta> &soTAIF_Meta,
784 stream<TcpAppLsnReq> &siTAIF_LsnReq,
785 stream<TcpAppLsnRep> &soTAIF_LsnRep,
790 stream<TcpAppData> &siTAIF_Data,
791 stream<TcpAppSndReq> &siTAIF_SndReq,
792 stream<TcpAppSndRep> &soTAIF_SndRep,
797 stream<TcpAppOpnReq> &siTAIF_OpnReq,
798 stream<TcpAppOpnRep> &soTAIF_OpnRep,
803 stream<TcpAppClsReq> &siTAIF_ClsReq,
810 stream<DmCmd> &soMEM_RxP_RdCmd,
811 stream<AxisApp> &siMEM_RxP_Data,
812 stream<DmSts> &siMEM_RxP_WrSts,
813 stream<DmCmd> &soMEM_RxP_WrCmd,
814 stream<AxisApp> &soMEM_RxP_Data,
820 stream<DmCmd> &soMEM_TxP_RdCmd,
821 stream<AxisApp> &siMEM_TxP_Data,
822 stream<DmSts> &siMEM_TxP_WrSts,
823 stream<DmCmd> &soMEM_TxP_WrCmd,
824 stream<AxisApp> &soMEM_TxP_Data,
829 stream<CamSessionLookupRequest> &soCAM_SssLkpReq,
830 stream<CamSessionLookupReply> &siCAM_SssLkpRep,
831 stream<CamSessionUpdateRequest> &soCAM_SssUpdReq,
832 stream<CamSessionUpdateReply> &siCAM_SssUpdRep,
837 stream<ap_uint<16> > &soDBG_SssRelCnt,
838 stream<ap_uint<16> > &soDBG_SssRegCnt,
839 stream<RxBufPtr> &soDBG_RxFreeSpace,
840 stream<ap_uint<32> > &soDBG_TcpIpRxByteCnt,
841 stream<ap_uint< 8> > &soDBG_OooDebug
844 ap_uint<32> &poSimCycCount
855 stream<StsBit> &soMMIO_RxMemWrErr,
856 stream<ap_uint<8> > &soMMIO_NotifDropCnt,
857 stream<ap_uint<8> > &soMMIO_MetaDropCnt,
858 stream<ap_uint<8> > &soMMIO_DataDropCnt,
859 stream<ap_uint<8> > &soMMIO_CrcDropCnt,
860 stream<ap_uint<8> > &soMMIO_SessDropCnt,
861 stream<ap_uint<8> > &soMMIO_OooDropCnt,
871 stream<AxisRaw> &siIPRX_Data,
876 stream<AxisRaw> &soIPTX_Data,
881 stream<TcpAppNotif> &soTAIF_Notif,
882 stream<TcpAppRdReq> &siTAIF_DReq,
883 stream<TcpAppData> &soTAIF_Data,
884 stream<TcpAppMeta> &soTAIF_Meta,
889 stream<TcpAppLsnReq> &siTAIF_LsnReq,
890 stream<TcpAppLsnRep> &soTAIF_LsnRep,
895 stream<TcpAppData> &siTAIF_Data,
896 stream<TcpAppSndReq> &siTAIF_SndReq,
897 stream<TcpAppSndRep> &soTAIF_SndRep,
902 stream<TcpAppOpnReq> &siTAIF_OpnReq,
903 stream<TcpAppOpnRep> &soTAIF_OpnRep,
908 stream<TcpAppClsReq> &siTAIF_ClsReq,
915 stream<DmCmd> &soMEM_RxP_RdCmd,
916 stream<AxisApp> &siMEM_RxP_Data,
917 stream<DmSts> &siMEM_RxP_WrSts,
918 stream<DmCmd> &soMEM_RxP_WrCmd,
919 stream<AxisApp> &soMEM_RxP_Data,
925 stream<DmCmd> &soMEM_TxP_RdCmd,
926 stream<AxisApp> &siMEM_TxP_Data,
927 stream<DmSts> &siMEM_TxP_WrSts,
928 stream<DmCmd> &soMEM_TxP_WrCmd,
929 stream<AxisApp> &soMEM_TxP_Data,
934 stream<CamSessionLookupRequest> &soCAM_SssLkpReq,
935 stream<CamSessionLookupReply> &siCAM_SssLkpRep,
936 stream<CamSessionUpdateRequest> &soCAM_SssUpdReq,
937 stream<CamSessionUpdateReply> &siCAM_SssUpdRep,
942 stream<ap_uint<16> > &soDBG_SssRelCnt,
943 stream<ap_uint<16> > &soDBG_SssRegCnt,
944 stream<RxBufPtr> &soDBG_RxFreeSpace,
945 stream<ap_uint<32> > &soDBG_TcpIpRxByteCnt,
946 stream<ap_uint< 8> > &soDBG_OooDebug
950 ap_uint<32> &poSimCycCount
Event(EventType type, SessionId id, ap_uint< 3 > rt_count)
Event(EventType type, SessionId id)
Event(EventType type, SessionId id, ap_uint< 16 > addr, ap_uint< 16 > len)
Event(EventType type, SessionId id, ap_uint< 16 > addr, ap_uint< 16 > len, ap_uint< 3 > rt_count)
ExtendedEvent(const Event &ev, LE_SocketPair tuple)
ExtendedEvent(const Event &ev)
RAiRxSarQuery(SessionId id, RxBufPtr appd)
RAiRxSarQuery(SessionId id)
RAiRxSarReply(SessionId id, RxBufPtr appd)
RXeReTransTimerCmd(SessionId id, TimerCmd cmd)
RXeReTransTimerCmd(SessionId id)
RXeRxSarQuery(SessionId id, RxSeqNum rcvd, RdWrBit wrBit)
RXeRxSarQuery(SessionId id, RxSeqNum rcvd, FlagBool ooo, RxSeqNum oooHead, RxSeqNum oooTail, RdWrBit wrBit)
RXeRxSarQuery(SessionId id)
RXeRxSarQuery(SessionId id, RdWrBit wrBit)
RXeRxSarQuery(SessionId id, RxSeqNum rcvd, RdWrBit wrBit, CmdBit iniBit)
RXeTxSarQuery(SessionId id, TxAckNum ackd, RemotWinSize recv_win, LocalWinSize cong_win, ap_uint< 2 > count, CmdBool fastRetransmitted)
CmdBool fastRetransmitted
RXeTxSarQuery(SessionId id, RdWrBit wrBit)
RXeTxSarReply(TxAckNum ackd, TxAckNum unak, TcpWindow cong_win, TcpWindow sstresh, ap_uint< 2 > count, CmdBool fastRetransmitted)
CmdBool fastRetransmitted
TcpWindow slowstart_threshold
RxSarReply(RxBufPtr appd, RxSeqNum rcvd, StsBool ooo, RxSeqNum oooHead, RxSeqNum oooTail)
SessionLookupQuery(LE_SocketPair tuple, bool allowCreation)
SessionLookupReply(SessionId id, HitState hit)
StateQuery(SessionId id, RdWrBit wrBit)
StateQuery(SessionId id, TcpState state, RdWrBit write)
TAiTxSarPush(SessionId id, TxBufPtr app)
TStTxSarPush(SessionId id, ap_uint< 16 > ackd)
TStTxSarPush(SessionId id, ap_uint< 16 > ackd, CmdBit init)
TXeReTransTimerCmd(SessionId id, EventType type)
TXeReTransTimerCmd(SessionId id)
TXeTxSarQuery(SessionId id, RdWrBit wrBit)
TXeTxSarQuery(SessionId id, TxAckNum not_ackd, RdWrBit write, CmdBit init, bool finReady, bool finSent)
TXeTxSarQuery(SessionId id, TxAckNum not_ackd, RdWrBit write, CmdBit init, bool finReady, bool finSent, bool isRt)
TXeTxSarQuery(SessionId id, TxAckNum not_ackd, RdWrBit write, CmdBit init)
TXeTxSarQuery(SessionId id, TxAckNum not_ackd, RdWrBit write)
TXeTxSarReply(ap_uint< 32 > ack, ap_uint< 32 > nack, ap_uint< 16 > min_window, ap_uint< 16 > app, bool finReady, bool finSent)
TXeTxSarRtQuery(const TXeTxSarQuery &q)
TXeTxSarRtQuery(SessionId id, ap_uint< TOE_WINDOW_BITS > ssthresh)
ap_uint< TOE_WINDOW_BITS > getThreshold()
TxAppTableQuery(SessionId id, ap_uint< 16 > pt)
TxAppTableQuery(SessionId id)
TxAppTableReply(SessionId id, ap_uint< 16 > ackd, TxBufPtr pt)
const int cDepth_STtToRXe_Rep
void pStreamMux(stream< T > &si1, stream< T > &si2, stream< T > &so)
A 2-to-1 generic Stream Multiplexer.
const int cDepth_AKdToTXe_Event
const int cDepth_RXeToTSt_Qry
const int cDepth_RAiToRSt_Qry
const int cDepth_TImToEVe_Event
const int cDepth_TXeToEVe_Event
const int cDepth_TStToTXe_Rep
const int cDepth_TAiToTSt_Cmd
ap_uint< TOE_WINDOW_BITS > TcpBufAdr
const int cDepth_TXeToRSt_Req
const int cDepth_RXeToEVe_Event
const int cDepth_RXeToRSt_Qry
const int cDepth_TStToRXe_Rep
const int cDepth_AKdToEVe_Event
const int cDepth_EVeToAKd_Event
#define TOE_FEATURE_USED_FOR_DEBUGGING
void toe_top(Ip4Addr piMMIO_IpAddr, stream< StsBit > &soMMIO_RxMemWrErr, stream< ap_uint< 8 > > &soMMIO_NotifDropCnt, stream< ap_uint< 8 > > &soMMIO_MetaDropCnt, stream< ap_uint< 8 > > &soMMIO_DataDropCnt, stream< ap_uint< 8 > > &soMMIO_CrcDropCnt, stream< ap_uint< 8 > > &soMMIO_SessDropCnt, stream< ap_uint< 8 > > &soMMIO_OooDropCnt, StsBit &poNTS_Ready, stream< AxisRaw > &siIPRX_Data, stream< AxisRaw > &soIPTX_Data, stream< TcpAppNotif > &soTAIF_Notif, stream< TcpAppRdReq > &siTAIF_DReq, stream< TcpAppData > &soTAIF_Data, stream< TcpAppMeta > &soTAIF_Meta, stream< TcpAppLsnReq > &siTAIF_LsnReq, stream< TcpAppLsnRep > &soTAIF_LsnRep, stream< TcpAppData > &siTAIF_Data, stream< TcpAppSndReq > &siTAIF_SndReq, stream< TcpAppSndRep > &soTAIF_SndRep, stream< TcpAppOpnReq > &siTAIF_OpnReq, stream< TcpAppOpnRep > &soTAIF_OpnRep, stream< TcpAppClsReq > &siTAIF_ClsReq, stream< DmCmd > &soMEM_RxP_RdCmd, stream< AxisApp > &siMEM_RxP_Data, stream< DmSts > &siMEM_RxP_WrSts, stream< DmCmd > &soMEM_RxP_WrCmd, stream< AxisApp > &soMEM_RxP_Data, stream< DmCmd > &soMEM_TxP_RdCmd, stream< AxisApp > &siMEM_TxP_Data, stream< DmSts > &siMEM_TxP_WrSts, stream< DmCmd > &soMEM_TxP_WrCmd, stream< AxisApp > &soMEM_TxP_Data, stream< CamSessionLookupRequest > &soCAM_SssLkpReq, stream< CamSessionLookupReply > &siCAM_SssLkpRep, stream< CamSessionUpdateRequest > &soCAM_SssUpdReq, stream< CamSessionUpdateReply > &siCAM_SssUpdRep, stream< ap_uint< 16 > > &soDBG_SssRelCnt, stream< ap_uint< 16 > > &soDBG_SssRegCnt, stream< RxBufPtr > &soDBG_RxFreeSpace, stream< ap_uint< 32 > > &soDBG_TcpIpRxByteCnt, stream< ap_uint< 8 > > &soDBG_OooDebug)
Top of TCP Offload Engine (TOE)
const int cDepth_STtToTAi_Rep
const int cDepth_TAiToEVe_Event
const int cDepth_TStToTAi_Cmd
const int cDepth_TXeToTSt_Qry
rstEvent(SessionId id, RxSeqNum seq, bool hasSessionID)
rstEvent(const Event &ev)
rstEvent(SessionId id, RxSeqNum seq)