cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
test_toecam.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 _TEST_TOECAM_H_
31 #define _TEST_TOECAM_H_
32 
33 #include <hls_stream.h>
34 #include <map>
35 #include <stdio.h>
36 #include <string>
37 
38 #include "../src/toecam.hpp"
39 #include "../../../NTS/nts_types.hpp"
40 #include "../../../NTS/nts_utils.hpp"
41 #include "../../../NTS/SimNtsUtils.hpp"
42 #include "../../../NTS/SimArpPacket.hpp"
43 #include "../../../NTS/SimEthFrame.hpp"
44 #include "../../../NTS/SimIp4Packet.hpp"
45 
46 //---------------------------------------------------------
47 //-- TESTBENCH GLOBAL DEFINES
48 // 'TB_STARTUP_DELAY' is used to delay the start of the [TB] functions.
49 // 'TB_GRACE_TIME' adds some cycles to drain the DUT at the end before.
50 //---------------------------------------------------------
51 #define TB_MAX_SIM_CYCLES 250
52 #define TB_STARTUP_DELAY 0
53 #define TB_GRACE_TIME 500
54 
55 #define CAM_LOOKUP_LATENCY 2
56 #define CAM_UPDATE_LATENCY 10
57 
58 const Ip4Addr RESERVED_SENDER_PROTOCOL_ADDRESS = 0xCAFEFADE; // Do not use in DAT files
59 
60 //---------------------------------------------------------
61 //-- TESTBENCH GLOBAL VARIABLES
62 //-- These variables might be updated/overwritten by the
63 //-- content of a test-vector file.
64 //---------------------------------------------------------
67 unsigned int gSimCycCnt;
68 unsigned int gMaxSimCycles;
69 
70 //---------------------------------------------------------
71 //-- DEFAULT LOCAL FPGA AND FOREIGN HOST SOCKETS
72 //-- By default, the following sockets will be used by the
73 //-- testbench, unless the user specifies new ones via one
74 //-- of the test vector files.
75 //---------------------------------------------------------
76 #define DEFAULT_FPGA_IP4_ADDR 0x0A0CC813 // TOE's local IP Address = 10.12.200.19
77 #define DEFAULT_FPGA_TCP_PORT 0x2263 // TOE listens on port = 8803 (static ports must be 0..32767)
78 #define DEFAULT_HOST_IP4_ADDR 0x0A0CC832 // TB's foreign IP Address = 10.12.200.50
79 #define DEFAULT_HOST_TCP_PORT 0xa263 // TB listens on port = 41,571 (dynamic ports must be 32768..65535)
80 
81 #define DEFAULT_SESSION_ID 42 // This TB open only one session.
82 
83 #define CAM_SIZE 2 // Number of CAM entries.
84 
85 #endif
86 
const Ip4Addr RESERVED_SENDER_PROTOCOL_ADDRESS
Definition: test_toecam.hpp:58
unsigned int gMaxSimCycles
Definition: test_toecam.hpp:68
unsigned int gSimCycCnt
Definition: test_toecam.hpp:67
bool gTraceEvent
Definition: test_toecam.hpp:65
bool gFatalError
Definition: test_toecam.hpp:66
ap_uint< 32 > Ip4Addr
Definition: AxisIp4.hpp:169