612 #pragma HLS RESOURCE variable=xmem core=RAM_1P_BRAM
613 #pragma HLS INTERFACE m_axi depth=512 port=HWICAP bundle=boHWICAP
614 #pragma HLS INTERFACE ap_ovld register port=MMIO_out name=poMMIO
615 #pragma HLS INTERFACE ap_vld register port=MMIO_in name=piMMIO
616 #pragma HLS INTERFACE ap_vld register port=layer_4_enabled name=piLayer4enabled
617 #pragma HLS INTERFACE ap_vld register port=layer_6_enabled name=piLayer6enabled
618 #pragma HLS INTERFACE ap_vld register port=layer_7_enabled name=piLayer7enabled
619 #pragma HLS INTERFACE ap_vld register port=nts_ready name=piNTS_ready
620 #pragma HLS INTERFACE ap_vld register port=in_time_seconds name=piTime_seconds
621 #pragma HLS INTERFACE ap_vld register port=in_time_minutes name=piTime_minutes
622 #pragma HLS INTERFACE ap_vld register port=in_time_hours name=piTime_hours
623 #pragma HLS INTERFACE ap_vld register port=role_mmio_in name=piRole_mmio
624 #pragma HLS INTERFACE ap_vld register port=uoe_drop_cnt_in name=piUOE_drop_cnt
625 #pragma HLS INTERFACE ap_vld register port=toe_notif_drop_cnt_in name=piTOE_notif_drop_cnt
626 #pragma HLS INTERFACE ap_vld register port=toe_meta_drop_cnt_in name=piTOE_meta_drop_cnt
627 #pragma HLS INTERFACE ap_vld register port=toe_data_drop_cnt_in name=piTOE_data_drop_cnt
628 #pragma HLS INTERFACE ap_vld register port=toe_crc_drop_cnt_in name=piTOE_crc_drop_cnt
629 #pragma HLS INTERFACE ap_vld register port=toe_sess_drop_cnt_in name=piTOE_sess_drop_cnt
630 #pragma HLS INTERFACE ap_vld register port=toe_ooo_drop_cnt_in name=piTOE_ooo_drop_cnt
631 #pragma HLS INTERFACE ap_stable register port=decoupStatus name=piDECOUP_status
632 #pragma HLS INTERFACE ap_ovld register port=setDecoup name=poDECOUP_activate
633 #pragma HLS INTERFACE ap_ovld register port=role_rank name=poROLE_rank
634 #pragma HLS INTERFACE ap_ovld register port=cluster_size name=poROLE_size
635 #pragma HLS INTERFACE m_axi depth=16383 port=nalCtrl bundle=boNAL_ctrlLink
637 #pragma HLS INTERFACE ap_stable register port=disable_ctrl_link name=piDisableCtrlLink
638 #pragma HLS INTERFACE ap_ovld register port=setSoftReset name=poSoftReset
640 #ifdef INCLUDE_PYROLINK
641 #pragma HLS INTERFACE ap_fifo register both port=soPYROLINK
642 #pragma HLS INTERFACE ap_fifo register both port=siPYROLINK
643 #pragma HLS INTERFACE ap_stable register port=disable_pyro_link name=piDisablePyroLink
646 #pragma HLS INTERFACE ap_fifo port=siNAL_Tcp_data
647 #pragma HLS INTERFACE ap_fifo port=soNAL_Tcp_data
648 #pragma HLS INTERFACE ap_fifo port=siNAL_Tcp_SessId
649 #pragma HLS INTERFACE ap_fifo port=soNAL_Tcp_SessId
653 #pragma HLS STREAM variable=internal_icap_fifo depth=4096
654 #pragma HLS STREAM variable=icap_hangover_fifo depth=3
656 #pragma HLS reset variable=nal_status_request_cnt
657 #pragma HLS reset variable=httpState
658 #pragma HLS reset variable=bufferInPtrWrite
659 #pragma HLS reset variable=bufferInPtrMaxWrite
660 #pragma HLS reset variable=lastSeenBufferInPtrMaxWrite
661 #pragma HLS reset variable=bufferInPtrNextRead
662 #pragma HLS reset variable=tcp_write_only_fifo
663 #pragma HLS reset variable=bufferOutPtrWrite
664 #pragma HLS reset variable=bufferOutContentLength
665 #pragma HLS reset variable=bufferOutPtrNextRead
666 #pragma HLS reset variable=lastSeenBufferOutPtrNextRead
667 #pragma HLS reset variable=writeErrCnt
668 #pragma HLS reset variable=fifoEmptyCnt
669 #pragma HLS reset variable=fifoFullCnt
670 #pragma HLS reset variable=wordsWrittenToIcapCnt
671 #pragma HLS reset variable=fsmHwicap
672 #pragma HLS reset variable=fifo_operation_in_progress
673 #pragma HLS reset variable=tcp_words_received
674 #pragma HLS reset variable=fifo_overflow_buffer_length
675 #pragma HLS reset variable=process_fifo_overflow_buffer
676 #pragma HLS reset variable=globalOperationDone_persistent
677 #pragma HLS reset variable=transferError_persistent
678 #pragma HLS reset variable=invalidPayload_persistent
679 #pragma HLS reset variable=flag_check_xmem_pattern
680 #pragma HLS reset variable=flag_silent_skip
681 #pragma HLS reset variable=toDecoup_persistent
682 #pragma HLS reset variable=lastResponsePageCnt
683 #pragma HLS reset variable=responePageCnt
684 #pragma HLS reset variable=xmem_page_trans_cnt
685 #pragma HLS reset variable=last_xmem_page_received_persistent
686 #pragma HLS reset variable=flag_continuous_tcp_rx
687 #pragma HLS reset variable=axi_wasnot_ready_persistent
688 #pragma HLS reset variable=global_state_wait_counter_persistent
689 #pragma HLS reset variable=currentTcpSessId
690 #pragma HLS reset variable=TcpSessId_updated_persistent
691 #pragma HLS reset variable=tcpModeEnabled
692 #pragma HLS reset variable=tcp_iteration_count
693 #pragma HLS reset variable=fsmTcpSessId_TX
694 #pragma HLS reset variable=fsmTcpSessId_RX
695 #pragma HLS reset variable=fsmTcpData_TX
696 #pragma HLS reset variable=fsmTcpData_RX
697 #pragma HLS reset variable=run_nested_loop_helper
698 #pragma HLS reset variable=goto_done_if_idle_tcp_rx
699 #pragma HLS reset variable=received_TCP_SessIds_cnt
701 #pragma HLS reset variable=current_nrc_mrt_version
702 #pragma HLS reset variable=current_MRT
703 #pragma HLS reset variable=current_nrc_config
704 #pragma HLS reset variable=nodeRank
705 #pragma HLS reset variable=clusterSize
706 #pragma HLS reset variable=tables_initialized
707 #pragma HLS reset variable=nal_status_disabled
708 #pragma HLS reset variable=need_to_update_nrc_mrt
709 #pragma HLS reset variable=need_to_update_nrc_config
710 #pragma HLS reset variable=ctrl_link_next_check_seconds
711 #pragma HLS reset variable=mrt_copy_index
713 #pragma HLS reset variable=linkCtrlFSM
714 #pragma HLS reset variable=max_discovered_node_id
715 #pragma HLS reset variable=detected_http_nl_cnt
716 #pragma HLS reset variable=target_http_nl_cnt
717 #pragma HLS reset variable=hwicap_hangover_present
718 #pragma HLS reset variable=hwicap_hangover_size
719 #pragma HLS reset variable=flag_enable_fake_hwicap
726 ap_uint<32> SR = 0, HWICAP_Done = 0, EOS = 0, CR = 0, CR_value = 0, ASR = 0;
727 ap_uint<8> ASW1 = 0, ASW2 = 0, ASW3 = 0, ASW4= 0;
729 ap_uint<32> ISR = 0, WFV = 0;
730 ap_uint<32> WFV_value = 0, WEMPTY = 0;
732 ap_uint<4> expCnt = 0;
733 ap_uint<4> copyRet = 0;
736 ap_uint<1> pyroSendRequestBit = 0;
737 char msg_buf[4] = {0x49,0x44,0x4C,
'\n'};
738 char *
msg = &msg_buf[0];
741 uint8_t currentProgramLength = 0;
762 for(
int i = 0; i < 2; i++)
767 for(
int i = 0; i < 3; i++)
784 ASW2 = (ASR & 0xFF00) >> 8;
785 ASW3 = (ASR & 0xFF0000) >> 16;
786 ASW4 = (ASR & 0xFF000000) >> 24;
788 HWICAP_Done = SR & 0x1;
789 EOS = (SR & 0x4) >> 2;
790 CR_value = CR & 0x1F;
796 WEMPTY = (ISR & 0x4) >> 2;
797 WFV_value = WFV & 0x7FF;
800 ap_uint<1> wasAbort = (CR_value &
CR_ABORT) >> 4;
809 ap_uint<32> MMIO_in_LE = 0x0;
810 MMIO_in_LE = (ap_uint<32>) ((*
MMIO_in >> 24) & 0xFF);
811 MMIO_in_LE |= (ap_uint<32>) ((*
MMIO_in >> 8) & 0xFF00);
812 MMIO_in_LE |= (ap_uint<32>) ((*
MMIO_in << 8) & 0xFF0000);
813 MMIO_in_LE |= (ap_uint<32>) ((*
MMIO_in << 24) & 0xFF000000);
819 ap_uint<1> notToSwap = (MMIO_in_LE >>
SWAP_N_SHIFT) & 0b1;
822 ap_uint<1> startXmemTrans = (MMIO_in_LE >>
START_SHIFT) & 0b1;
835 ap_uint<1> CR_isWriting = CR_value &
CR_WRITE;
837 ap_uint<1> reset_from_psoc = (MMIO_in_LE >>
RST_SHIFT) & 0b1;
841 #ifdef INCLUDE_PYROLINK
844 pyroSendRequestBit = siPYROLINK.empty()? 0 : 1;
847 pyroSendRequestBit = 0;
879 bool iterate_again =
true;
882 iterate_again =
false;
896 if(reset_from_psoc == 1)
898 printf(
"[FMC] reset from PSOC!\n");
905 iterate_again =
false;
910 currentProgramLength = 0;
912 if(tcpModeStart == 1 && parseHTTP == 1)
924 iterate_again =
true;
935 currentProgramLength = 3;
937 else if(tcpModeStart == 1)
941 }
else if(parseHTTP == 1 && startXmemTrans == 1)
953 currentProgramLength = 2;
954 iterate_again =
true;
955 }
else if(checkPattern == 1 && startXmemTrans == 1)
963 currentProgramLength = 1;
964 iterate_again =
true;
965 }
else if(startXmemTrans == 1)
973 currentProgramLength = 1;
974 iterate_again =
true;
975 #ifdef INCLUDE_PYROLINK
983 currentProgramLength = 1;
984 iterate_again =
true;
992 currentProgramLength = 1;
993 iterate_again =
true;
995 }
else if(manuallyToDecoup == 1)
998 iterate_again =
true;
1008 if(reset_from_psoc == 1)
1012 currentProgramLength = 0;
1014 iterate_again =
true;
1019 if(startXmemTrans == 0)
1025 currentProgramLength = 0;
1032 currentProgramLength=0;
1038 currentProgramLength++;
1041 currentProgramLength++;
1044 for(uint8_t i = 0; i<15; i++)
1048 currentProgramLength++;
1053 opcodeProgram[currentProgramLength] =
OP_DONE;
1055 currentProgramLength++;
1060 if(reset_from_psoc == 1)
1064 currentProgramLength = 0;
1066 iterate_again =
true;
1071 if(startXmemTrans == 0)
1076 currentProgramLength=0;
1084 currentProgramLength=0;
1091 currentProgramLength=0;
1097 currentProgramLength++;
1100 currentProgramLength++;
1103 currentProgramLength++;
1106 currentProgramLength++;
1108 opcodeProgram[currentProgramLength] =
OP_EXIT;
1110 currentProgramLength++;
1113 programMask[currentProgramLength] =
OPRV_DONE;
1114 currentProgramLength++;
1116 programMask[currentProgramLength] =
OPRV_DONE;
1117 currentProgramLength++;
1118 opcodeProgram[currentProgramLength] =
OP_EXIT;
1119 programMask[currentProgramLength] =
OPRV_DONE;
1120 currentProgramLength++;
1123 currentProgramLength++;
1125 programMask[currentProgramLength] =
OPRV_FAIL;
1126 currentProgramLength++;
1127 opcodeProgram[currentProgramLength] =
OP_FAIL;
1128 programMask[currentProgramLength] =
OPRV_OK;
1129 currentProgramLength++;
1130 opcodeProgram[currentProgramLength] =
OP_EXIT;
1131 programMask[currentProgramLength] =
OPRV_FAIL;
1132 currentProgramLength++;
1137 if(reset_from_psoc == 1)
1141 currentProgramLength = 0;
1143 iterate_again =
true;
1148 if(startXmemTrans == 0)
1153 currentProgramLength = 0;
1161 currentProgramLength=0;
1168 currentProgramLength=0;
1176 currentProgramLength++;
1179 currentProgramLength++;
1180 opcodeProgram[currentProgramLength] =
OP_EXIT;
1182 currentProgramLength++;
1185 currentProgramLength++;
1186 opcodeProgram[currentProgramLength] =
OP_EXIT;
1188 currentProgramLength++;
1191 currentProgramLength++;
1194 currentProgramLength++;
1196 programMask[currentProgramLength] =
OPRV_OK;
1197 currentProgramLength++;
1199 programMask[currentProgramLength] =
OPRV_DONE;
1200 currentProgramLength++;
1207 currentProgramLength++;
1210 currentProgramLength++;
1211 opcodeProgram[currentProgramLength] =
OP_EXIT;
1213 currentProgramLength++;
1216 currentProgramLength++;
1218 opcodeProgram[currentProgramLength] =
OP_EXIT;
1220 currentProgramLength++;
1223 currentProgramLength++;
1226 programMask[currentProgramLength] =
OPRV_FAIL;
1227 currentProgramLength++;
1229 programMask[currentProgramLength] =
OPRV_OK;
1230 currentProgramLength++;
1232 programMask[currentProgramLength] =
OPRV_OK;
1233 currentProgramLength++;
1235 programMask[currentProgramLength] =
OPRV_DONE;
1236 currentProgramLength++;
1238 opcodeProgram[currentProgramLength] =
OP_FAIL;
1239 programMask[currentProgramLength] =
OPRV_OK;
1240 currentProgramLength++;
1241 opcodeProgram[currentProgramLength] =
OP_EXIT;
1242 programMask[currentProgramLength] =
OPRV_FAIL;
1243 currentProgramLength++;
1247 currentProgramLength++;
1249 programMask[currentProgramLength] =
OPRV_OK;
1250 currentProgramLength++;
1251 opcodeProgram[currentProgramLength] =
OP_DONE;
1252 programMask[currentProgramLength] =
OPRV_OK;
1253 currentProgramLength++;
1255 programMask[currentProgramLength] =
OPRV_DONE;
1256 currentProgramLength++;
1258 programMask[currentProgramLength] =
OPRV_OK;
1259 currentProgramLength++;
1261 programMask[currentProgramLength] =
OPRV_DONE;
1262 currentProgramLength++;
1269 currentProgramLength++;
1272 currentProgramLength++;
1273 opcodeProgram[currentProgramLength] =
OP_EXIT;
1275 currentProgramLength++;
1278 currentProgramLength++;
1280 programMask[currentProgramLength] =
OPRV_USER;
1281 currentProgramLength++;
1283 programMask[currentProgramLength] =
OPRV_DONE;
1284 currentProgramLength++;
1285 opcodeProgram[currentProgramLength] =
OP_EXIT;
1286 programMask[currentProgramLength] =
OPRV_DONE;
1287 currentProgramLength++;
1290 currentProgramLength++;
1293 currentProgramLength++;
1297 currentProgramLength++;
1298 opcodeProgram[currentProgramLength] =
OP_EXIT;
1300 currentProgramLength++;
1303 currentProgramLength++;
1307 currentProgramLength++;
1311 currentProgramLength++;
1313 programMask[currentProgramLength] =
OPRV_OK;
1314 currentProgramLength++;
1316 programMask[currentProgramLength] =
OPRV_DONE;
1317 currentProgramLength++;
1318 opcodeProgram[currentProgramLength] =
OP_EXIT;
1319 programMask[currentProgramLength] =
OPRV_DONE;
1320 currentProgramLength++;
1324 currentProgramLength++;
1326 opcodeProgram[currentProgramLength] =
OP_OK;
1328 currentProgramLength++;
1329 opcodeProgram[currentProgramLength] =
OP_EXIT;
1330 programMask[currentProgramLength] =
OPRV_OK;
1331 currentProgramLength++;
1335 currentProgramLength++;
1338 programMask[currentProgramLength] =
OPRV_OK;
1339 currentProgramLength++;
1342 currentProgramLength++;
1344 opcodeProgram[currentProgramLength] =
OP_EXIT;
1346 currentProgramLength++;
1349 programMask[currentProgramLength] =
OPRV_DONE;
1350 currentProgramLength++;
1352 programMask[currentProgramLength] =
OPRV_DONE;
1353 currentProgramLength++;
1355 programMask[currentProgramLength] =
OPRV_DONE;
1356 currentProgramLength++;
1358 programMask[currentProgramLength] =
OPRV_OK;
1359 currentProgramLength++;
1361 programMask[currentProgramLength] =
OPRV_DONE;
1362 currentProgramLength++;
1363 opcodeProgram[currentProgramLength] =
OP_EXIT;
1364 programMask[currentProgramLength] =
OPRV_DONE;
1365 currentProgramLength++;
1368 currentProgramLength++;
1371 programMask[currentProgramLength] =
OPRV_FAIL;
1372 currentProgramLength++;
1374 programMask[currentProgramLength] =
OPRV_OK;
1375 currentProgramLength++;
1377 programMask[currentProgramLength] =
OPRV_OK;
1378 currentProgramLength++;
1380 programMask[currentProgramLength] =
OPRV_DONE;
1381 currentProgramLength++;
1383 opcodeProgram[currentProgramLength] =
OP_FAIL;
1384 programMask[currentProgramLength] =
OPRV_DONE;
1385 currentProgramLength++;
1386 opcodeProgram[currentProgramLength] =
OP_EXIT;
1387 programMask[currentProgramLength] =
OPRV_FAIL;
1388 currentProgramLength++;
1389 opcodeProgram[currentProgramLength] =
OP_OK;
1391 currentProgramLength++;
1396 if(reset_from_psoc == 1)
1400 currentProgramLength = 0;
1403 iterate_again =
true;
1418 iterate_again =
true;
1421 currentProgramLength=0;
1423 printf(
"\t\t\tWaiting for TCP FSMs to finish...\n");
1427 currentProgramLength=0;
1430 currentProgramLength++;
1433 currentProgramLength++;
1441 currentProgramLength=0;
1449 currentProgramLength=0;
1452 printf(
"GLOBAL_TCP_HTTP: make a plan with REQUEST_TYPE: %d\n", (
int)
reqType);
1458 currentProgramLength++;
1459 opcodeProgram[currentProgramLength] =
OP_EXIT;
1461 currentProgramLength++;
1469 currentProgramLength++;
1472 currentProgramLength++;
1473 opcodeProgram[currentProgramLength] =
OP_EXIT;
1475 currentProgramLength++;
1478 currentProgramLength++;
1479 opcodeProgram[currentProgramLength] =
OP_EXIT;
1481 currentProgramLength++;
1484 currentProgramLength++;
1487 currentProgramLength++;
1489 programMask[currentProgramLength] =
OPRV_OK;
1490 currentProgramLength++;
1492 programMask[currentProgramLength] =
OPRV_DONE;
1493 currentProgramLength++;
1495 programMask[currentProgramLength] =
OPRV_DONE;
1496 currentProgramLength++;
1498 programMask[currentProgramLength] =
OPRV_DONE;
1499 currentProgramLength++;
1507 currentProgramLength++;
1510 currentProgramLength++;
1511 opcodeProgram[currentProgramLength] =
OP_EXIT;
1513 currentProgramLength++;
1516 currentProgramLength++;
1519 programMask[currentProgramLength] =
OPRV_FAIL;
1520 currentProgramLength++;
1522 programMask[currentProgramLength] =
OPRV_OK;
1523 currentProgramLength++;
1525 programMask[currentProgramLength] =
OPRV_OK;
1526 currentProgramLength++;
1528 programMask[currentProgramLength] =
OPRV_DONE;
1529 currentProgramLength++;
1531 programMask[currentProgramLength] =
OPRV_DONE;
1532 currentProgramLength++;
1534 opcodeProgram[currentProgramLength] =
OP_FAIL;
1535 programMask[currentProgramLength] =
OPRV_OK;
1536 currentProgramLength++;
1537 opcodeProgram[currentProgramLength] =
OP_EXIT;
1538 programMask[currentProgramLength] =
OPRV_FAIL;
1539 currentProgramLength++;
1543 currentProgramLength++;
1545 programMask[currentProgramLength] =
OPRV_OK;
1546 currentProgramLength++;
1547 opcodeProgram[currentProgramLength] =
OP_DONE;
1548 programMask[currentProgramLength] =
OPRV_OK;
1549 currentProgramLength++;
1551 programMask[currentProgramLength] =
OPRV_DONE;
1552 currentProgramLength++;
1554 programMask[currentProgramLength] =
OPRV_OK;
1555 currentProgramLength++;
1557 programMask[currentProgramLength] =
OPRV_DONE;
1558 currentProgramLength++;
1560 programMask[currentProgramLength] =
OPRV_DONE;
1561 currentProgramLength++;
1563 programMask[currentProgramLength] =
OPRV_DONE;
1564 currentProgramLength++;
1565 opcodeProgram[currentProgramLength] =
OP_EXIT;
1566 programMask[currentProgramLength] =
OPRV_DONE;
1567 currentProgramLength++;
1574 currentProgramLength++;
1577 currentProgramLength++;
1578 opcodeProgram[currentProgramLength] =
OP_EXIT;
1580 currentProgramLength++;
1583 currentProgramLength++;
1585 programMask[currentProgramLength] =
OPRV_USER;
1586 currentProgramLength++;
1588 programMask[currentProgramLength] =
OPRV_DONE;
1589 currentProgramLength++;
1591 programMask[currentProgramLength] =
OPRV_DONE;
1592 currentProgramLength++;
1593 opcodeProgram[currentProgramLength] =
OP_EXIT;
1594 programMask[currentProgramLength] =
OPRV_DONE;
1595 currentProgramLength++;
1598 currentProgramLength++;
1601 currentProgramLength++;
1605 currentProgramLength++;
1606 opcodeProgram[currentProgramLength] =
OP_EXIT;
1608 currentProgramLength++;
1611 currentProgramLength++;
1615 currentProgramLength++;
1619 currentProgramLength++;
1621 programMask[currentProgramLength] =
OPRV_OK;
1622 currentProgramLength++;
1624 programMask[currentProgramLength] =
OPRV_DONE;
1625 currentProgramLength++;
1627 programMask[currentProgramLength] =
OPRV_DONE;
1628 currentProgramLength++;
1629 opcodeProgram[currentProgramLength] =
OP_EXIT;
1630 programMask[currentProgramLength] =
OPRV_DONE;
1631 currentProgramLength++;
1636 currentProgramLength++;
1639 currentProgramLength++;
1642 currentProgramLength++;
1644 opcodeProgram[currentProgramLength] =
OP_OK;
1646 currentProgramLength++;
1647 opcodeProgram[currentProgramLength] =
OP_EXIT;
1648 programMask[currentProgramLength] =
OPRV_OK;
1649 currentProgramLength++;
1653 currentProgramLength++;
1656 programMask[currentProgramLength] =
OPRV_OK;
1657 currentProgramLength++;
1660 currentProgramLength++;
1661 opcodeProgram[currentProgramLength] =
OP_EXIT;
1663 currentProgramLength++;
1666 programMask[currentProgramLength] =
OPRV_DONE;
1667 currentProgramLength++;
1669 programMask[currentProgramLength] =
OPRV_DONE;
1670 currentProgramLength++;
1672 programMask[currentProgramLength] =
OPRV_DONE;
1673 currentProgramLength++;
1675 programMask[currentProgramLength] =
OPRV_OK;
1676 currentProgramLength++;
1678 programMask[currentProgramLength] =
OPRV_DONE;
1679 currentProgramLength++;
1681 programMask[currentProgramLength] =
OPRV_DONE;
1682 currentProgramLength++;
1684 programMask[currentProgramLength] =
OPRV_DONE;
1685 currentProgramLength++;
1687 programMask[currentProgramLength] =
OPRV_DONE;
1688 currentProgramLength++;
1689 opcodeProgram[currentProgramLength] =
OP_EXIT;
1690 programMask[currentProgramLength] =
OPRV_DONE;
1691 currentProgramLength++;
1694 currentProgramLength++;
1697 programMask[currentProgramLength] =
OPRV_FAIL;
1698 currentProgramLength++;
1700 programMask[currentProgramLength] =
OPRV_OK;
1701 currentProgramLength++;
1703 programMask[currentProgramLength] =
OPRV_OK;
1704 currentProgramLength++;
1706 programMask[currentProgramLength] =
OPRV_DONE;
1707 currentProgramLength++;
1709 programMask[currentProgramLength] =
OPRV_DONE;
1710 currentProgramLength++;
1712 programMask[currentProgramLength] =
OPRV_DONE;
1713 currentProgramLength++;
1715 opcodeProgram[currentProgramLength] =
OP_FAIL;
1716 programMask[currentProgramLength] =
OPRV_DONE;
1717 currentProgramLength++;
1718 opcodeProgram[currentProgramLength] =
OP_EXIT;
1719 programMask[currentProgramLength] =
OPRV_FAIL;
1720 currentProgramLength++;
1722 opcodeProgram[currentProgramLength] =
OP_OK;
1724 currentProgramLength++;
1728 if(reset_from_psoc == 1)
1732 currentProgramLength = 0;
1734 iterate_again =
true;
1739 if(pyroRecvMode == 0)
1744 currentProgramLength=0;
1752 currentProgramLength=0;
1760 currentProgramLength++;
1763 currentProgramLength++;
1765 opcodeProgram[currentProgramLength] =
OP_EXIT;
1767 currentProgramLength++;
1772 currentProgramLength++;
1777 if(reset_from_psoc == 1)
1781 currentProgramLength = 0;
1783 iterate_again =
true;
1788 if(pyroReadReq == 0)
1793 currentProgramLength=0;
1794 pyroSendRequestBit = 0;
1805 currentProgramLength=0;
1816 currentProgramLength = 0;
1823 currentProgramLength++;
1826 currentProgramLength++;
1829 currentProgramLength++;
1830 opcodeProgram[currentProgramLength] =
OP_EXIT;
1832 currentProgramLength++;
1843 currentProgramLength = 1;
1845 if(manuallyToDecoup == 0)
1850 currentProgramLength = 1;
1877 if(!siNAL_Tcp_SessId.empty())
1881 if(siNAL_Tcp_SessId.read_nb(
tmp))
1908 if(!soNAL_Tcp_SessId.full())
1944 printf(
"try to empty overflow buffer\n");
1945 int new_write_index = 0;
1946 bool once_blocked =
false;
1951 once_blocked =
true;
1952 if(i != new_write_index)
1964 printf(
"TCP RX still blocked by hwicap fifo\n");
1975 if(!siNAL_Tcp_data.read_nb(big))
1981 for(
int i = 0; i < 8; i++)
1983 #pragma HLS unroll factor=8
1984 if((big.
tkeep >> i) == 0)
1988 ap_uint<8> current_byte = (ap_uint<8>) (big.
tdata >> i*8);
2019 uint8_t chars_to_compare[4];
2020 uint32_t position = 0;
2021 for(
int j = 3; j>=0; j--)
2023 #pragma HLS unroll factor=4
2026 if(relative_buffer_in_write < 0)
2028 assert(((3-j) >= 0) && ((j-3) < 3));
2033 assert(relative_buffer_in_write >= 0 && relative_buffer_in_write <
IN_BUFFER_SIZE);
2034 assert(((3-j) >= 0) && ((j-3) < 4));
2036 chars_to_compare[3-j] =
bufferIn[relative_buffer_in_write];
2039 printf(
"chars_to_compare: 0x%02x%02x%02x%02x\n", chars_to_compare[0], chars_to_compare[1], chars_to_compare[2], chars_to_compare[3]);
2040 if(chars_to_compare[0] == 0xd && chars_to_compare[1] == 0xa &&
2041 chars_to_compare[2] == 0xd && chars_to_compare[3] == 0xa)
2045 printf(
"TCP RX: detected %d. HTTP NL at position %d\n",(
int)
detected_http_nl_cnt, (
int) position);
2112 for(
int i = 0; i < 8; i++)
2116 out.tkeep |= (ap_uint<8>) 0x1 << i;
2126 if(soNAL_Tcp_data.write_nb(
out))
2172 CR_isWriting = CR_value &
CR_WRITE;
2179 WFV_value = WFV & 0x7FF;
2180 uint32_t max_words_to_write = WFV_value;
2181 printf(
"HWICAP FSM: max_words_to_write %d\n", (
int) max_words_to_write);
2190 if(max_words_to_write == 0)
2192 #ifndef __SYNTHESIS__
2202 WFV_value = WFV & 0x7FF;
2204 max_words_to_write = WFV_value;
2205 printf(
"UPDATE: max_words_to_write %d\n", (
int) max_words_to_write);
2206 if(max_words_to_write == 0)
2211 uint8_t bytes_read[4];
2212 uint8_t bytes_read_count = 0;
2215 uint8_t read_var = 0x0;
2218 bytes_read[bytes_read_count] = read_var;
2226 uint8_t read_var = 0x0;
2229 bytes_read[bytes_read_count] = read_var;
2235 if(bytes_read_count != 4)
2237 printf(
"FIFO hangover bytes: 0x");
2238 for(
int i = 0; i < bytes_read_count; i++)
2241 printf(
"%02x ", (
int) bytes_read[i]);
2243 printf(
"\nFIFO hangover with size %d\n", (
int) bytes_read_count);
2246 ap_uint<32>
tmp = 0;
2249 tmp |= (ap_uint<32>) bytes_read[0];
2250 tmp |= (((ap_uint<32>) bytes_read[1]) << 8);
2251 tmp |= (((ap_uint<32>) bytes_read[2]) << 16);
2252 tmp |= (((ap_uint<32>) bytes_read[3]) << 24);
2255 tmp |= (ap_uint<32>) bytes_read[3];
2256 tmp |= (((ap_uint<32>) bytes_read[2]) << 8);
2257 tmp |= (((ap_uint<32>) bytes_read[1]) << 16);
2258 tmp |= (((ap_uint<32>) bytes_read[0]) << 24);
2261 if (
tmp == 0x0d0a0d0a ||
tmp == 0x0a0d0a0d )
2263 printf(
"HTTP NL received, treat it as Poison Pill...\n");
2273 printf(
"Poison Pill received...\n");
2279 #ifndef __SYNTHESIS__
2297 max_words_to_write--;
2298 printf(
"writing to HWICAP: %#010x\n",(
int)
tmp);
2304 WFV_value = WFV & 0x7FF;
2345 printf(
"currentProgramLength: %d\n", (
int) currentProgramLength);
2351 for(uint8_t progCnt = 0; progCnt < currentProgramLength; progCnt++)
2353 OprvType currentMask = programMask[progCnt];
2354 OpcodeType currentOpcode = opcodeProgram[progCnt];
2355 printf(
"PC %d, lst RV %d, opcode %d\n", (
int) progCnt, (
int) lastReturnValue, (
int) currentOpcode);
2357 OprvType mask_result = currentMask & lastReturnValue;
2358 if(((uint8_t) mask_result) == 0)
2364 printf(
"[%d] operation skipped (silent: %d)\n", (
int) progCnt, (
int)
flag_silent_skip);
2369 switch(currentOpcode)
2452 for(
int i = 0; i < 3; i++)
2534 printf(
"httpState bevore parseHTTP: %d\n",
httpState);
2535 bool rx_done =
false;
2543 printf(
"reqType after parseHTTP: %d\n",
reqType);
2628 uint32_t maxPayloadWrite = 0;
2640 printf(
"STOP at 2. HTTP NL\n");
2645 printf(
"Writing Buffer to HWICAP from %d to %d (including); notToSwap = %d\n", (
int)
bufferInPtrNextRead, (
int) maxPayloadWrite,(
int) notToSwap);
2651 while(i <= maxPayloadWrite && maxPayloadWrite > 0)
2653 ap_uint<32>
tmp = 0;
2658 for(
int j = 0; j < 4; j++)
2660 #pragma HLS unroll factor=4
2699 if (
tmp == 0x0d0a0d0a ||
tmp == 0x0a0d0a0d )
2701 printf(
"Error: Tried to write 0d0a0d0a.\n");
2705 #ifndef __SYNTHESIS__
2717 printf(
"writing to HWICAP: %#010x\n",(
int)
tmp);
2725 CR_isWriting = CR_value &
CR_WRITE;
2726 if (CR_isWriting != 1)
2739 WFV_value = WFV & 0x7FF;
2760 printf(
"telomere: %d\n", (
int) telomere);
2764 for(
int j = 0; j<telomere; j++)
2772 printf(
"ERROR negativ telomere!\n");
2787 printf(
"telomere: %d\n", (
int) telomere);
2788 assert(telomere >= 0 && telomere < 4);
2790 if(telomere > 0 && telomere < 4)
2792 printf(
"hangover bytes: 0x");
2793 for(
int j = 0; j<telomere; j++)
2801 }
else if(telomere != 0)
2803 printf(
"invalid telomere count!\n");
2830 printf(
"started HWICAP FIFO FSM");
2835 CR_value = CR & 0x1F;
2836 CR_isWriting = CR_value &
CR_WRITE;
2838 WFV_value = WFV & 0x7FF;
2860 #ifdef INCLUDE_PYROLINK
2876 if(!soPYROLINK.full())
2888 soPYROLINK.write(
tmp);
2922 printf(
"nextRead: %d, maxWhile %d, notToSwap %d\n", i, maxWhile, (
int) notToSwap);
2926 char* intStart = (
char*) &
bufferIn[i];
2934 ap_uint<32> rankID = (
unsigned int)
my_atoi(intStart, intLen);
2935 printf(
"intLen: %d, rankdID: %d\n", intLen, (
unsigned int) rankID);
2938 ap_uint<32>
tmp = 0;
2940 if ( notToSwap == 1)
2963 printf(
"invalid routing table detected.\n");
2978 printf(
"writing on address %d to NRC: %#010x\n",(
unsigned int) rankID, (
int)
tmp);
3000 #ifdef INCLUDE_PYROLINK
3004 if(!siPYROLINK.empty())
3012 if(!siPYROLINK.empty())
3267 pyroSendRequestBit = 0;
3429 ap_uint<4> Dsel = 0;
3476 ap_uint<32> MMIO_out_LE = 0x0;
3507 MMIO_out_LE = 0xBEBAFECA;
3512 MMIO_out_BE = (ap_uint<32>) ((MMIO_out_LE >> 24) & 0xFF);
3513 MMIO_out_BE |= (ap_uint<32>) ((MMIO_out_LE >> 8) & 0xFF00);
3514 MMIO_out_BE |= (ap_uint<32>) ((MMIO_out_LE << 8) & 0xFF0000);
3515 MMIO_out_BE |= (ap_uint<32>) ((MMIO_out_LE << 24) & 0xFF000000);
#define LAST_PAGE_WRITE_CNT_SHIFT
#define FPGA_STATE_LAYER_4
uint8_t currentGlobalOperation
#define DETECTED_HTTPNL_SHIFT
#define LAST_PAGE_CNT_SHIFT
uint32_t positions_of_detected_http_nl[4]
ap_uint< 4 > received_TCP_SessIds_cnt
bool run_nested_loop_helper
#define OP_CLEAR_OUT_BUFFER
ap_uint< 1 > layer_7_enabled
#define RX_SESS_STATE_SHIFT
void copyOutBuffer(ap_uint< 4 > numberOfPages, ap_uint< 32 > xmem[(32 *16)])
ap_uint< 1 > disable_pyro_link
ap_uint< 28 > tcp_words_received
ap_uint< 8 > nts_tcp_crc_drop_cnt
#define OP_BUFFER_TO_PYROLINK
#define OP_TCP_RX_STOP_ON_EOP
ap_uint< 1 > last_xmem_page_received_persistent
#define TX_SESS_STATE_SHIFT
#define OP_BUFFER_TO_ROUTING
ap_uint< 4 > copyAndCheckBurst(ap_uint< 32 > xmem[(32 *16)], ap_uint< 4 > ExpCnt, ap_uint< 7 > lastPageCnt_in)
#define HTTP_REQUEST_COMPLETE
#define OP_DISABLE_XMEM_CHECK_PATTERN
ap_uint< 8 > nts_tcp_notif_drop_cnt
#define OP_COPY_REQTYPE_TO_RETURN
#define CHECK_CTRL_LINK_INTERVAL_SECONDS
#define OP_DEACTIVATE_DECOUP
ap_uint< 8 > nts_tcp_meta_drop_cnt
#define OP_SEND_BUFFER_XMEM
ap_uint< 32 > clusterSize
#define OP_ACTIVATE_CONT_TCP
#define OP_BUFFER_TO_HWICAP
#define HTTP_HEADER_PARSED
#define TCP_ITER_COUNT_SHIFT
#define OP_ENABLE_XMEM_CHECK_PATTERN
#define OP_CLEAR_ROUTING_TABLE
#define GLOBAL_XMEM_CHECK_PATTERN
ap_uint< 1 > flag_silent_skip
#define GLOBAL_XMEM_TO_HWICAP
#define FULL_FIFO_CNT_SHIFT
#define OP_WAIT_FOR_TCP_SESS
ap_uint< 32 > max_discovered_node_id
#define ENABLE_TCP_MODE_SHIFT
#define FPGA_STATE_CONFIG_UPDATE
ap_uint< 1 > disable_ctrl_link
ap_uint< 32 > nal_status[16]
ap_uint< 32 > mrt_copy_index
#define OP_DEACTIVATE_CONT_TCP
#define GLOBAL_PYROLINK_RECV
ap_uint< 16 > current_role_mmio
#define FPGA_STATE_MRT_UPDATE
ap_uint< 32 > ctrl_link_next_check_seconds
#define HTTP_SEND_RESPONSE
#define PYRO_READ_REQUEST_SHIFT
#define HWICAP_FIFO_NEARLY_FULL_TRIGGER
ap_uint< 8 > nts_tcp_ooo_drop_cnt
ap_uint< 8 > nts_tcp_data_drop_cnt
bool transferError_persistent
bool TcpSessId_updated_persistent
ap_uint< 1 > flag_enable_fake_hwicap
ap_uint< 32 > MMIO_out_BE
void parseHttpInput(bool transferErr, ap_uint< 1 > wasAbort, bool invalidPayload, bool rx_done)
#define BUFFER_IN_MAX_SHIFT
#define CHECK_PATTERN_SHIFT
ap_uint< 8 > fpga_status[8]
#define LINKFSM_UPDATE_MRT
ap_uint< 8 > fifoEmptyCnt
#define GLOBAL_MANUAL_DECOUPLING
#define GLOBAL_STATE_SHIFT
ap_uint< 1 > flag_continuous_tcp_rx
ap_uint< 8 > nal_status_request_cnt
ap_uint< 32 > fpga_time_hours
#define ICAP_FIFO_POISON_PILL
#define OP_XMEM_COPY_DATA
#define TCP_FSM_PROCESS_DATA
#define OP_FILL_BUFFER_TCP
#define TX_DATA_STATE_SHIFT
#define HWICAP_FIFO_DEPTH
#define OP_ACTIVATE_DECOUP
ap_uint< 32 > current_nrc_config[16]
#define LINKFSM_UPDATE_SAVED_STATE
ap_uint< 1 > layer_4_enabled
#define MAX_PROGRAM_LENGTH
#define HTTP_PARSE_HEADER
#define OP_SET_NOT_TO_SWAP
#define ENABLE_FAKE_HWICAP_SHIFT
#define TCP_FSM_W84_START
#define LINKFSM_UPDATE_CONFIG
ap_uint< 32 > current_nrc_mrt_version
#define OP_TCP_RX_STOP_ON_EOR
ap_uint< 1 > tcpModeEnabled
ap_uint< 32 > global_state_wait_counter_persistent
#define LINKFSM_UPDATE_STATE
uint32_t sequential_hwicap_address
#define OPRV_NOT_COMPLETE
bool need_to_update_nrc_config
#define OP_UPDATE_HTTP_STATE
ap_uint< 1 > layer_6_enabled
#define EMPTY_FIFO_CNT_SHIFT
#define ANSWER_LENGTH_SHIFT
bool axi_wasnot_ready_persistent
#define OP_SEND_BUFFER_TCP
bool invalidPayload_persistent
#define OP_CHECK_HTTP_EOR
ap_uint< 16 > nts_udp_drop_cnt
ap_uint< 32 > current_MRT[64]
#define OPRV_PARTIAL_COMPLETE
#define PYRO_SEND_REQUEST_SHIFT
#define FPGA_STATE_LAYER_7
#define OP_UNSET_NOT_TO_SWAP
ap_uint< 1 > decoupStatus
ap_uint< 28 > wordsWrittenToIcapCnt
#define OP_PYROLINK_TO_OUTBUFFER
ap_uint< 1 > toDecoup_persistent
ap_uint< 32 > fpga_time_seconds
#define ICAP_FIFO_POISON_PILL_REVERSE
bool globalOperationDone_persistent
#define WRITE_ERROR_CNT_SHIFT
bool need_to_update_nrc_mrt
uint8_t bytesToPages(int len, bool update_global_variables)
ap_uint< 32 > HWICAP[512]
ap_uint< 32 > fpga_time_minutes
#define OP_CHECK_HTTP_EOP
#define OP_CLEAR_IN_BUFFER
ap_uint< 2 > detected_http_nl_cnt
#define FPGA_STATE_NTS_READY
bool goto_done_if_idle_tcp_rx
#define OP_ENABLE_SILENT_SKIP
#define HTTP_READ_PAYLOAD
#define GLOBAL_MAX_WAIT_COUNT
uint8_t tcp_iteration_count
#define NUMBER_FPGA_STATE_REGISTERS
#define GLOBAL_PYROLINK_TRANS
#define OP_FIFO_TO_HWICAP
#define OP_DISABLE_SILENT_SKIP
#define FPGA_STATE_LAYER_6
#define NOT_TO_SWAP_SHIFT
ap_uint< 8 > nts_tcp_sess_drop_cnt
ap_uint< 32 > nalCtrl[(0x3ff/4)]
#define MIN_ROUTING_TABLE_LINE
ap_uint< 2 > target_http_nl_cnt
#define HTTP_INVALID_REQUEST
#define RX_DATA_STATE_SHIFT
#define TCP_OPERATION_SHIFT
bool use_sequential_hwicap
ap_uint< 32 > cluster_size
#define NUMBER_CONFIG_WORDS
#define NAL_CTRL_LINK_STATUS_START_ADDR
#define NAL_STATUS_FMC_PORT_PROCESSED
#define NAL_CONFIG_SAVED_FMC_PORTS
#define NAL_CONFIG_SAVED_TCP_PORTS
#define NAL_CTRL_LINK_MRT_START_ADDR
#define NAL_STATUS_MRT_VERSION
#define NAL_CTRL_LINK_CONFIG_START_ADDR
#define NAL_CONFIG_SAVED_UDP_PORTS
#define NAL_NUMBER_STATUS_WORDS
#define NAL_STATUS_OWN_RANK
#define NAL_CONFIG_MRT_VERSION
#define NAL_CONFIG_OWN_RANK
#define NAL_STATUS_OPEN_TCP_PORTS
#define NAL_STATUS_OPEN_UDP_PORTS
#define NETWORK_WORD_BYTE_WIDTH