cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
network_utils.hpp
Go to the documentation of this file.
1 
17 // *
18 // * Description:
19 // * This file contains network types and functions that are shared
20 // * across HLS cores.
21 // *
22 // *
23 // *----------------------------------------------------------------------------
24 // *
25 // * @details : Data structures, types and prototypes definitions
26 // * that are shared across HLS cores in the Shell.
27 // *
28 // * @terminology:
29 // * In telecommunications, a protocol data unit (PDU) is a single unit of
30 // * information transmitted among peer entities of a computer network.
31 // * A PDU is therefore composed of a protocol specific control information
32 // * (e.g, a header) and a user data section.
33 // * This source code uses the following terminology:
34 // * - a SEGMENT (or TCP Packet) refers to the TCP protocol data unit.
35 // * - a DATAGRAM )or UDP Packet) refers to the UDP protocol data unit.
36 // * - a PACKET (or IP Packet) refers to the IP protocol data unit.
37 // * - a FRAME (or MAC Frame) refers to the Ethernet data link layer.
38 // *
39 
40 #ifndef _CF_NETWORK_UTILS_
41 #define _CF_NETWORK_UTILS_
42 
43 
44 #include <stdint.h>
45 #include <stdio.h>
46 #include <iostream>
47 #include <fstream>
48 #include <string>
49 #include <math.h>
50 #include <vector>
51 
52 #include "ap_int.h"
53 #include "ap_utils.h"
54 #include <hls_stream.h>
55 
56 //user network interface
57 #include "../../../hls/network.hpp"
58 
59 using namespace hls;
60 
61 
62 // import NTS types (if not yet defined)
63 #include "NTS/nts.hpp"
64 #include "NTS/nts_types.hpp"
65 #include "NTS/nts_config.hpp"
66 #include "NTS/nts_utils.hpp"
67 #include "NTS/AxisRaw.hpp"
68 
69 
70 /* ===== NAL specific ====== */
71 
72 
77 
78 // --- utility functions -----
79 
80 //void convertAxisToNtsWidth(stream<AxisRaw<8> > &small, AxisRa &out);
81 
82 ap_uint<32> bigEndianToInteger(ap_uint<8> *buffer, int lsb);
83 void integerToBigEndian(ap_uint<32> n, ap_uint<8> *bytes);
84 
85 /* MOVED to nts_utils.hpp
86  ap_uint<16> swapWord (ap_uint<16> inpWord); // [FIXME - To be replaced w/ byteSwap16]
87  ap_uint<16> byteSwap16 (ap_uint<16> inputVector);
88  ap_uint<32> swapDWord (ap_uint<32> inpDWord); // [FIXME - To be replaced w/ byteSwap32]
89  ap_uint<32> byteSwap32 (ap_uint<32> inputVector);
90  */
91 
92 ap_uint<8> lenToKeep (ap_uint<4> noValidBytes);
93 //ap_uint<8> returnKeep (ap_uint<4> length);
94 ap_uint<4> keepToLen (ap_uint<8> keepValue);
95 //ap_uint<4> keepMapping(ap_uint<8> keepValue);
96 
97 #endif
98 
99 
: A generic class used by the Network-Transport-Stack (NTS) to to transfer a chunk of data over an AX...
ap_uint< 16 > TcpSessId
Definition: nts_types.hpp:137
ap_uint< 8 > lenToKeep(ap_uint< 4 > noValidBytes)
Returns the 'tkeep' field of an AxiWord as a function of the number of valid bytes in that word.
ap_uint< 4 > keepToLen(ap_uint< 8 > keepValue)
Swap the two bytes of a word (.i.e, 16 bits).
TcpSessId AppMeta
ap_uint< 32 > bigEndianToInteger(ap_uint< 8 > *buffer, int lsb)
void integerToBigEndian(ap_uint< 32 > n, ap_uint< 8 > *bytes)
: Definition of the Network Transport Stack (NTS) component as if it was an HLS IP core.
: Configuration parameters for the Network Transport Stack (NTS) component and sub-components.
: Definition of the types used by the Network Transport Stack (NTS) component of the cloudFPGA shell.
: Utilities and helpers for the Network-Transport-Stack (NTS) components.