cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
udp.hpp
Go to the documentation of this file.
1 
17 
43 
56 #ifndef _UDP_H
57 #define _UDP_H
58 
59 #include <stdio.h>
60 #include <iostream>
61 #include <fstream>
62 #include <string>
63 #include <math.h>
64 #include <hls_stream.h>
65 #include "ap_int.h"
66 #include <stdint.h>
67 #include <cstdlib>
68 
69 using namespace hls;
70 
71 #define MTU 1500 // Maximum Transmission Unit in bytes
72 
73 extern uint32_t clockCounter;
74 
75 struct sockaddr_in {
76  ap_uint<16> port; /* port in network byte order */
77  ap_uint<32> addr; /* internet address */
79  sockaddr_in(ap_uint<16> port, ap_uint<32> addr)
80  : port(port), addr(addr) {}
81 };
82 
83 struct metadata {
86  metadata() {}
87  metadata(sockaddr_in sourceSocket, sockaddr_in destinationSocket)
88  : sourceSocket(sourceSocket), destinationSocket(destinationSocket) {}
89 };
90 
91 struct ipTuple {
92  ap_uint<32> sourceIP;
93  ap_uint<32> destinationIP;
94  ipTuple() {}
95  ipTuple(ap_uint<32> sourceIP, ap_uint<32> destinationIP)
96  : sourceIP(sourceIP), destinationIP(destinationIP) {}
97 };
98 
99 struct ioWord {
100  ap_uint<64> data;
101  ap_uint<1> eop;
102 };
103 
104 struct axiWord {
105  ap_uint<64> data;
106  ap_uint<8> keep;
107  ap_uint<1> last;
108  axiWord() {}
109  axiWord(ap_uint<64> data, ap_uint<8> keep, ap_uint<1> last)
110  :data(data), keep(keep), last(last) {}
111 };
112 
113 void udp(
114  stream<axiWord> &inputPathInData,
115  stream<axiWord> &inputpathOutData,
116  stream<ap_uint<16> > &openPort,
117  stream<bool> &confirmPortStatus,
118  stream<metadata> &inputPathOutputMetadata,
119  stream<ap_uint<16> > &portRelease, // Input Path Streams
120  stream<axiWord> &outputPathInData,
121  stream<axiWord> &outputPathOutData,
122  stream<metadata> &outputPathInMetadata,
123  stream<ap_uint<16> > &outputpathInLength,
124  stream<axiWord> &inputPathPortUnreachable); // Output Path Streams
125 #endif
ap_uint< 64 > data
Definition: tb_nal.cpp:832
axiWord(ap_uint< 64 > data, ap_uint< 8 > keep, ap_uint< 1 > last)
Definition: udp.hpp:109
axiWord()
Definition: udp.hpp:108
Definition: udp.hpp:99
ap_uint< 1 > eop
Definition: udp.hpp:101
ap_uint< 64 > data
Definition: udp.hpp:100
Definition: udp.hpp:91
ap_uint< 32 > sourceIP
Definition: udp.hpp:92
ipTuple(ap_uint< 32 > sourceIP, ap_uint< 32 > destinationIP)
Definition: udp.hpp:95
ap_uint< 32 > destinationIP
Definition: udp.hpp:93
ipTuple()
Definition: udp.hpp:94
Definition: udp.hpp:83
sockaddr_in destinationSocket
Definition: udp.hpp:85
metadata()
Definition: udp.hpp:86
metadata(sockaddr_in sourceSocket, sockaddr_in destinationSocket)
Definition: udp.hpp:87
sockaddr_in sourceSocket
Definition: udp.hpp:84
ap_uint< 32 > addr
Definition: udp.hpp:77
sockaddr_in(ap_uint< 16 > port, ap_uint< 32 > addr)
Definition: udp.hpp:79
sockaddr_in()
Definition: udp.hpp:78
ap_uint< 16 > port
Definition: udp.hpp:76
uint32_t clockCounter
Definition: test_udp.cpp:48
void udp(stream< axiWord > &inputPathInData, stream< axiWord > &inputpathOutData, stream< ap_uint< 16 > > &openPort, stream< bool > &confirmPortStatus, stream< metadata > &inputPathOutputMetadata, stream< ap_uint< 16 > > &portRelease, stream< axiWord > &outputPathInData, stream< axiWord > &outputPathOutData, stream< metadata > &outputPathInMetadata, stream< ap_uint< 16 > > &outputpathInLength, stream< axiWord > &inputPathPortUnreachable)