cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
simu_tcp_app_flash_env.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2016 -- 2021 IBM Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
30 #ifndef _SIMU_TAF_H_
31 #define _SIMU_TAF_H_
32 
33 #include <stdio.h>
34 #include <fstream>
35 #include <iostream>
36 #include <hls_stream.h>
37 
38 #include "../../../../cFDK/SRA/LIB/SHELL/LIB/hls/NTS/SimNtsUtils.hpp"
39 #include "../../../../cFDK/SRA/LIB/SHELL/LIB/hls/NTS/SimAppData.hpp"
40 
41 //------------------------------------------------------
42 //-- TESTBENCH DEFINES
43 //------------------------------------------------------
44 #define MAX_SIM_CYCLES 500
45 #define TB_GRACE_TIME 1000 // Give the TB some time to finish
46 #define STARTUP_DELAY 25
47 #define VALID true
48 #define UNVALID false
49 #define DONE true
50 #define NOT_YET_DONE false
51 
52 #define ENABLED (ap_uint<1>)1
53 #define DISABLED (ap_uint<1>)0
54 
55 #define DEFAULT_SESS_ID 42
56 #define DEFAULT_DATAGRAM_LEN 32
57 
58 //---------------------------------------------------------
59 //-- DEFAULT LOCAL FPGA AND FOREIGN HOST SOCKETS
60 //-- By default, the following sockets will be used by the
61 //-- testbench, unless the user specifies new ones via one
62 //-- of the test vector files.
63 //---------------------------------------------------------
64 #define DEFAULT_FPGA_IP4_ADDR 0x0A0CC801 // FPGA's local IP Address = 10.12.200.01
65 #define DEFAULT_FPGA_LSN_PORT 0x2263 // TCP-ROLE listens on port = 8803
66 #define DEFAULT_FPGA_SND_PORT 0xA263 // TCP-ROLE sends on port = 41571
67 #define DEFAULT_HOST_IP4_ADDR 0x0A0CC832 // HOST's foreign IP Address = 10.12.200.50
68 #define DEFAULT_HOST_LSN_PORT 0x80 // HOST listens on port = 128
69 #define DEFAULT_HOST_SND_PORT 0x8080 // HOST sends on port = 32896
70 
71 
72 
75 void stepSim();
76 void increaseSimTime(unsigned int cycles);
77 
78 
81 bool pTSIF_Recv(
82  int &nrErr,
83  stream<TcpAppData> &siTAF_Data,
84  stream<TcpSessId> &siTAF_SessId,
85  stream<TcpDatLen> &siTAF_DatLen,
86  ofstream &rawFileStream,
87  ofstream &tcpFileStream,
88  int &nrSegments);
89 
90 bool pTSIF_Send(
91  int &nrError,
92  stream<TcpAppData> &soTAF_Data,
93  stream<TcpSessId> &soTAF_SessId,
94  stream<TcpDatLen> &soTAF_DatLen,
95  ifstream &inpFileStream,
96  ofstream &outGoldStream,
97  int &nrSegments);
98 
99 void pTSIF(
100  int &nrErr,
101  //-- MMIO/ Configuration Interfaces
102  #if defined TAF_USE_NON_FIFO_IO
103  ap_uint<2> poTAF_EchoCtrl,
104  #endif
105  //-- TAF / TCP Data Interfaces
106  stream<TcpAppData> &soTAF_Data,
107  stream<TcpSessId> &soTAF_SessId,
108  stream<TcpDatLen> &soTAF_DatLen,
109  //-- TAF / TCP Data Interface
110  stream<TcpAppData> &siTAF_Data,
111  stream<TcpSessId> &siTAF_SessId,
112  stream<TcpDatLen> &siTAF_DatLen);
113 
114 #endif
115 
void stepSim()
Increment the simulation counter.
Definition: test_arp.cpp:54
void increaseSimTime(unsigned int cycles)
Increase the simulation time of the testbench.
bool pTSIF_Send(int &nrError, stream< TcpAppData > &soTAF_Data, stream< TcpSessId > &soTAF_SessId, stream< TcpDatLen > &soTAF_DatLen, ifstream &inpFileStream, ofstream &outGoldStream, int &nrSegments)
Emulate the sending part of the TSIF process.
bool pTSIF_Recv(int &nrErr, stream< TcpAppData > &siTAF_Data, stream< TcpSessId > &siTAF_SessId, stream< TcpDatLen > &siTAF_DatLen, ofstream &rawFileStream, ofstream &tcpFileStream, int &nrSegments)
Emulate the receiving part of the TSIF process.
void pTSIF(int &nrErr, stream< TcpAppData > &soTAF_Data, stream< TcpSessId > &soTAF_SessId, stream< TcpDatLen > &soTAF_DatLen, stream< TcpAppData > &siTAF_Data, stream< TcpSessId > &siTAF_SessId, stream< TcpDatLen > &siTAF_DatLen)
Emulate the behavior of TSIF.