cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
simu_udp_shell_if_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_USIF_H_
31 #define _SIMU_USIF_H_
32 
33 #include <cstdlib>
34 #include <hls_stream.h>
35 #include <iostream>
36 
37 #include "../src/udp_shell_if.hpp"
38 #include "../../../../cFDK/SRA/LIB/SHELL/LIB/hls/NTS/SimNtsUtils.hpp"
39 
40 //------------------------------------------------------
41 //-- TESTBENCH DEFINITIONS
42 //------------------------------------------------------
43 const int cUoeInitCycles = 100; // FYI - It takes 0xFFFF cycles to initialize UOE.
44 const int cGraceTime = 500; // Give the TB some time to finish
45 
46 //---------------------------------------------------------
47 //-- DEFAULT LOCAL FPGA AND FOREIGN HOST SOCKETS
48 //-- By default, the following sockets will be used by the
49 //-- testbench, unless the user specifies new ones via one
50 //-- of the test vector files.
51 //---------------------------------------------------------
52 #define DEFAULT_FPGA_IP4_ADDR 0x0A0CC801 // FPGA's local IP Address = 10.12.200.01
53 #define DEFAULT_FPGA_LSN_PORT 0x2263 // UDP-ROLE listens on port = 8803
54 #define DEFAULT_FPGA_SND_PORT 0xA263 // UDP-ROLE sends on port = 41571
55 #define DEFAULT_HOST_IP4_ADDR 0x0A0CC832 // HOST's foreign IP Address = 10.12.200.50
56 #define DEFAULT_HOST_LSN_PORT 0x80 // HOST listens on port = 128
57 #define DEFAULT_HOST_SND_PORT 0x8080 // HOST sends on port = 32896
58 
59 #define DEFAULT_DATAGRAM_LEN 32
60 
61 
62 
65 void stepSim();
66 void increaseSimTime(unsigned int cycles);
67 
68 
71 void pUAF(
72  //-- USIF / Rx Data Interface
73  stream<UdpAppData> &siUSIF_Data,
74  stream<UdpAppMeta> &siUSIF_Meta,
75  //-- USIF / Tx Data Interface
76  stream<UdpAppData> &soUSIF_Data,
77  stream<UdpAppMeta> &soUSIF_Meta,
78  stream<UdpAppDLen> &soUSIF_DLen);
79 
80 void pMMIO(
81  //-- SHELL / Ready Signal
82  StsBit *piSHL_Ready,
83  //-- MMIO / Enable Layer-7 (.i.e APP alias ROLE)
84  CmdBit *poUSIF_Enable);
85 
86 void pUOE(
87  int &nrErr,
88  ofstream &dataGoldFile,
89  ofstream &dataFile,
90  ofstream &metaGoldFile,
91  ofstream &metaFile,
92  int echoDgrmLen,
93  SockAddr testSock,
94  int testDgrmLen,
95  //-- MMIO / Ready Signal
96  StsBit *poMMIO_Ready,
97  //-- UOE->USIF / UDP Rx Data Interfaces
98  stream<UdpAppData> &soUSIF_Data,
99  stream<UdpAppMeta> &soUSIF_Meta,
100  stream<UdpAppDLen> &soUSIF_DLen,
101  //-- USIF->UOE / UDP Tx Data Interfaces
102  stream<UdpAppData> &siUSIF_Data,
103  stream<UdpAppMeta> &siUSIF_Meta,
104  stream<UdpAppDLen> &siUSIF_DLen,
105  //-- USIF<->UOE / Listen Interfaces
106  stream<UdpPort> &siUSIF_LsnReq,
107  stream<StsBool> &soUSIF_LsnRep,
108  //-- USIF<->UOE / Close Interfaces
109  stream<UdpPort> &siUSIF_ClsReq);
110 
111 #endif
112 
void stepSim()
Increment the simulation counter.
Definition: test_arp.cpp:54
void increaseSimTime(unsigned int cycles)
Increase the simulation time of the testbench.
ap_uint< 1 > StsBit
Definition: nts_types.hpp:116
ap_uint< 1 > CmdBit
Definition: nts_types.hpp:108
void pMMIO(StsBit *piSHL_Ready, CmdBit *poTSIF_Enable)
Emulate the behavior of the SHELL & MMIO.
void pUAF(stream< UdpAppData > &siUSIF_Data, stream< UdpAppMeta > &siUSIF_Meta, stream< UdpAppData > &soUSIF_Data, stream< UdpAppMeta > &soUSIF_Meta, stream< UdpAppDLen > &soUSIF_DLen)
Emulate the behavior of the ROLE/UdpAppFlash (UAF).
const int cGraceTime
const int cUoeInitCycles
void pUOE(int &nrErr, ofstream &dataGoldFile, ofstream &dataFile, ofstream &metaGoldFile, ofstream &metaFile, int echoDgrmLen, SockAddr testSock, int testDgrmLen, StsBit *poMMIO_Ready, stream< UdpAppData > &soUSIF_Data, stream< UdpAppMeta > &soUSIF_Meta, stream< UdpAppDLen > &soUSIF_DLen, stream< UdpAppData > &siUSIF_Data, stream< UdpAppMeta > &siUSIF_Meta, stream< UdpAppDLen > &siUSIF_DLen, stream< UdpPort > &siUSIF_LsnReq, stream< StsBool > &soUSIF_LsnRep, stream< UdpPort > &siUSIF_ClsReq)
Emulate behavior of the SHELL/NTS/UDP Offload Engine (UOE).