35 #include "../../../../../hls/cfdk.hpp"
36 #include "../../../../../hls/network.hpp"
37 #include "../../../../../hls/axi_utils.hpp"
38 #include "../../network_utils.hpp"
47 #define WEMPTY_SHIFT 2
48 #define DECOUP_SHIFT 19
51 #define TCP_OPERATION_SHIFT 18
57 #define NOT_TO_SWAP_SHIFT 24
64 #define ANSWER_LENGTH_SHIFT 0
65 #define HTTP_STATE_SHIFT 4
66 #define WRITE_ERROR_CNT_SHIFT 8
67 #define EMPTY_FIFO_CNT_SHIFT 16
68 #define GLOBAL_STATE_SHIFT 24
73 #define LAST_PAGE_WRITE_CNT_SHIFT 16
74 #define PYRO_SEND_REQUEST_SHIFT 23
77 #define RX_SESS_STATE_SHIFT 0
78 #define RX_DATA_STATE_SHIFT 4
79 #define TX_SESS_STATE_SHIFT 8
80 #define TX_DATA_STATE_SHIFT 12
81 #define TCP_ITER_COUNT_SHIFT 16
82 #define DETECTED_HTTPNL_SHIFT 24
85 #define TCP_RX_CNT_SHIFT 0
88 #define BUFFER_IN_MAX_SHIFT 0
89 #define FULL_FIFO_CNT_SHIFT 16
90 #define ICAP_FSM_SHIFT 24
94 #define SR_OFFSET (0x110/WS)
95 #define ISR_OFFSET (0x20/WS)
96 #define WFV_OFFSET (0x114/WS)
97 #define ASR_OFFSET (0x11C/WS)
98 #define CR_OFFSET (0x10C/WS)
99 #define RFO_OFFSET (0x118/WS)
100 #define WF_OFFSET (0x100/WS)
106 #define DECOUP_CMD_SHIFT 0
108 #define DSEL_SHIFT 28
110 #define START_SHIFT 12
111 #define SWAP_N_SHIFT 16
112 #define CHECK_PATTERN_SHIFT 13
113 #define PARSE_HTTP_SHIFT 14
114 #define SOFT_RST_SHIFT 2
115 #define PYRO_MODE_SHIFT 15
116 #define PYRO_READ_REQUEST_SHIFT 3
117 #define ENABLE_TCP_MODE_SHIFT 4
118 #define ENABLE_FAKE_HWICAP_SHIFT 5
119 #define LAST_PAGE_CNT_SHIFT 17
122 #define LINES_PER_PAGE 32
124 #define XMEM_SIZE (LINES_PER_PAGE * MAX_PAGES)
125 #define BYTES_PER_PAGE (LINES_PER_PAGE*4)
126 #define PAYLOAD_BYTES_PER_PAGE (BYTES_PER_PAGE - 2)
131 #define IN_BUFFER_SIZE 4096
133 #define OUT_BUFFER_SIZE 1024
134 #define XMEM_ANSWER_START (1*LINES_PER_PAGE)
137 #define CR_ABORT 0x10
143 #define HWICAP_FIFO_DEPTH 1023
144 #define MAX_HWICAP_DATA_CHUNK_BYTES ((4*HWICAP_FIFO_DEPTH) - 24)
145 #define HWICAP_FIFO_NEARLY_FULL_TRIGGER 4
147 #include "../../NAL/src/nal.hpp"
151 #define MAX_CLUSTER_SIZE (MAX_MRT_SIZE)
154 #define MIN_ROUTING_TABLE_LINE (1+1+4+1)
159 #define HTTP_PARSE_HEADER 1
160 #define HTTP_HEADER_PARSED 2
161 #define HTTP_READ_PAYLOAD 3
162 #define HTTP_REQUEST_COMPLETE 4
163 #define HTTP_SEND_RESPONSE 5
164 #define HTTP_INVALID_REQUEST 6
166 #define HttpState uint8_t
169 #define GLOBAL_IDLE 0
170 #define GLOBAL_XMEM_CHECK_PATTERN 1
171 #define GLOBAL_XMEM_TO_HWICAP 2
172 #define GLOBAL_XMEM_HTTP 3
173 #define GLOBAL_TCP_HTTP 4
174 #define GLOBAL_PYROLINK_RECV 5
175 #define GLOBAL_PYROLINK_TRANS 6
176 #define GLOBAL_MANUAL_DECOUPLING 7
178 #define GlobalState uint8_t
181 #define OprvType uint8_t
183 #define OPRV_FAIL 0x2
184 #define OPRV_SKIPPED 0x4
185 #define OPRV_NOT_COMPLETE 0x8
186 #define OPRV_PARTIAL_COMPLETE 0x10
187 #define OPRV_DONE 0x20
188 #define OPRV_USER 0x40
189 #define MASK_ALWAYS 0xFF
192 #define TCP_FSM_RESET 0
193 #define TCP_FSM_IDLE 1
194 #define TCP_FSM_W84_START 2
195 #define TCP_FSM_PROCESS_DATA 3
196 #define TCP_FSM_DONE 4
197 #define TCP_FSM_ERROR 5
199 #define TcpFsmState uint8_t
202 #define ICAP_FSM_RESET 0
203 #define ICAP_FSM_IDLE 1
204 #define ICAP_FSM_WRITE 2
205 #define ICAP_FSM_DONE 3
206 #define ICAP_FSM_ERROR 4
207 #define ICAP_FSM_DRAIN 5
208 #define IcapFsmState uint8_t
209 #define ICAP_FIFO_POISON_PILL 0x0a0b1c2d
210 #define ICAP_FIFO_POISON_PILL_REVERSE 0x2d1c0b0a
214 #define NUMBER_FPGA_STATE_REGISTERS 8
215 #define FPGA_STATE_LAYER_4 0
216 #define FPGA_STATE_LAYER_6 1
217 #define FPGA_STATE_LAYER_7 2
218 #define FPGA_STATE_CONFIG_UPDATE 3
219 #define FPGA_STATE_MRT_UPDATE 4
220 #define FPGA_STATE_NTS_READY 5
223 #define CHECK_CTRL_LINK_INTERVAL_SECONDS 2
224 #define CHECK_HWICAP_INTERVAL_SECONDS 2
226 #define LINKFSM_IDLE 0
227 #define LINKFSM_WAIT 1
228 #define LINKFSM_UPDATE_MRT 2
229 #define LINKFSM_UPDATE_CONFIG 3
230 #define LINKFSM_UPDATE_STATE 4
231 #define LINKFSM_UPDATE_SAVED_STATE 5
232 #define LinkFsmStateType uint8_t
237 #define OpcodeType uint8_t
239 #define OP_ENABLE_XMEM_CHECK_PATTERN 1
240 #define OP_XMEM_COPY_DATA 2
241 #define OP_FILL_BUFFER_TCP 3
242 #define OP_HANDLE_HTTP 4
243 #define OP_CHECK_HTTP_EOR 5
244 #define OP_CHECK_HTTP_EOP 6
245 #define OP_BUFFER_TO_HWICAP 7
246 #define OP_BUFFER_TO_PYROLINK 8
247 #define OP_BUFFER_TO_ROUTING 9
248 #define OP_SEND_BUFFER_TCP 10
249 #define OP_SEND_BUFFER_XMEM 11
250 #define OP_CLEAR_IN_BUFFER 12
251 #define OP_CLEAR_OUT_BUFFER 13
253 #define OP_DISABLE_XMEM_CHECK_PATTERN 15
254 #define OP_ACTIVATE_DECOUP 16
255 #define OP_DEACTIVATE_DECOUP 17
256 #define OP_ABORT_HWICAP 18
258 #define OP_UPDATE_HTTP_STATE 20
259 #define OP_COPY_REQTYPE_TO_RETURN 21
261 #define OP_ENABLE_SILENT_SKIP 23
262 #define OP_DISABLE_SILENT_SKIP 24
264 #define OP_PYROLINK_TO_OUTBUFFER 26
265 #define OP_WAIT_FOR_TCP_SESS 27
266 #define OP_SEND_TCP_SESS 28
267 #define OP_SET_NOT_TO_SWAP 29
268 #define OP_UNSET_NOT_TO_SWAP 30
269 #define OP_ACTIVATE_CONT_TCP 31
270 #define OP_DEACTIVATE_CONT_TCP 32
271 #define OP_TCP_RX_STOP_ON_EOR 33
272 #define OP_TCP_RX_STOP_ON_EOP 34
273 #define OP_TCP_CNT_RESET 35
274 #define OP_FIFO_TO_HWICAP 36
275 #define OP_CLEAR_ROUTING_TABLE 37
278 #define MAX_PROGRAM_LENGTH 64
282 #define GLOBAL_MAX_WAIT_COUNT (5 * 1024)
291 #ifndef __SYNTHESIS__
303 void setRank(ap_uint<32> newRank);
304 void setSize(ap_uint<32> newSize);
308 ap_uint<32> *
MMIO_in, ap_uint<32> *MMIO_out,
315 ap_uint<32> *in_time_seconds,
316 ap_uint<32> *in_time_minutes,
317 ap_uint<32> *in_time_hours,
319 ap_uint<16> *role_mmio_in,
321 ap_uint<16> *uoe_drop_cnt_in,
323 ap_uint<8> *toe_notif_drop_cnt_in,
324 ap_uint<8> *toe_meta_drop_cnt_in,
325 ap_uint<8> *toe_data_drop_cnt_in,
326 ap_uint<8> *toe_crc_drop_cnt_in,
327 ap_uint<8> *toe_sess_drop_cnt_in,
328 ap_uint<8> *toe_ooo_drop_cnt_in,
332 ap_uint<1> *setSoftReset,
338 stream<TcpWord> &siNAL_Tcp_data,
339 stream<AppMeta> &siNAL_Tcp_SessId,
340 stream<TcpWord> &soNAL_Tcp_data,
341 stream<AppMeta> &soNAL_Tcp_SessId,
342 #ifdef INCLUDE_PYROLINK
uint16_t bufferOutContentLength
ap_uint< 1 > layer_7_enabled
ap_uint< 1 > disable_pyro_link
uint32_t bufferInPtrWrite
ap_uint< 1 > disable_ctrl_link
void setRank(ap_uint< 32 > newRank)
ap_uint< 32 > xmem[(32 *16)]
ap_uint< 1 > layer_4_enabled
void fmc(ap_uint< 32 > *MMIO_in, ap_uint< 32 > *MMIO_out, ap_uint< 1 > *layer_4_enabled, ap_uint< 1 > *layer_6_enabled, ap_uint< 1 > *layer_7_enabled, ap_uint< 1 > *nts_ready, ap_uint< 32 > *in_time_seconds, ap_uint< 32 > *in_time_minutes, ap_uint< 32 > *in_time_hours, ap_uint< 16 > *role_mmio_in, ap_uint< 16 > *uoe_drop_cnt_in, ap_uint< 8 > *toe_notif_drop_cnt_in, ap_uint< 8 > *toe_meta_drop_cnt_in, ap_uint< 8 > *toe_data_drop_cnt_in, ap_uint< 8 > *toe_crc_drop_cnt_in, ap_uint< 8 > *toe_sess_drop_cnt_in, ap_uint< 8 > *toe_ooo_drop_cnt_in, ap_uint< 32 > *HWICAP, ap_uint< 1 > decoupStatus, ap_uint< 1 > *setDecoup, ap_uint< 1 > *setSoftReset, ap_uint< 32 > xmem[(32 *16)], ap_uint< 32 > nalCtrl[(0x3ff/4)], ap_uint< 1 > *disable_ctrl_link, stream< TcpWord > &siNAL_Tcp_data, stream< AppMeta > &siNAL_Tcp_SessId, stream< TcpWord > &soNAL_Tcp_data, stream< AppMeta > &soNAL_Tcp_SessId, ap_uint< 32 > *role_rank, ap_uint< 32 > *cluster_size)
uint32_t sequential_hwicap_address
ap_uint< 1 > layer_6_enabled
uint16_t bufferOutPtrWrite
ap_uint< 1 > decoupStatus
uint32_t writeDisplaysToOutBuffer()
uint32_t bufferInPtrNextRead
ap_uint< 32 > HWICAP[512]
void setSize(ap_uint< 32 > newSize)
ap_uint< 32 > nalCtrl[(0x3ff/4)]
bool use_sequential_hwicap
ap_uint< 32 > cluster_size
#define NAL_CTRL_LINK_SIZE
: The HTTP parsing functions for the FMC.