cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
memory_utils.hpp
Go to the documentation of this file.
1 
17 // *
18 // * cloudFPGA
19 // * =============================================
20 // * Created: Aug 2019
21 // * Authors: FAB, WEI, NGL
22 // *
23 // * Description:
24 // * This file contains memory types and functions that are shared accross HLS cores.
25 // *
26 // *
27 
28 #ifndef _CF_MEMORY_UTILS_
29 #define _CF_MEMORY_UTILS_
30 
31 #include <stdio.h>
32 #include <iostream>
33 #include <fstream>
34 #include <string>
35 #include <math.h>
36 #include <hls_stream.h>
37 #include <stdint.h>
38 #include <vector>
39 
40 #include "ap_int.h"
41 
42 using namespace hls;
43 
44 
45 
53 #define RXMEMBUF 65536 // 64KB = 2^16
54 #define TXMEMBUF 65536 // 64KB = 2^16
55 
56 
59 class DmCmd
60 {
61  public:
62  ap_uint<23> bbt; // Bytes To Transfer
63  ap_uint<1> type; // Type of AXI4 access (0=FIXED, 1=INCR)
64  ap_uint<6> dsa; // DRE Stream Alignment
65  ap_uint<1> eof; // End of Frame
66  ap_uint<1> drr; // DRE ReAlignment Request
67  ap_uint<40> saddr; // Start Address
68  ap_uint<4> tag; // Command Tag
69  ap_uint<4> rsvd; // Reserved
70  DmCmd() {}
71  DmCmd(ap_uint<40> addr, ap_uint<16> len) :
72  bbt(len), type(1), dsa(0), eof(1), drr(1), saddr(addr), tag(0), rsvd(0) {}
73 };
74 
75 struct mmCmd
76 {
77  ap_uint<23> bbt;
78  ap_uint<1> type;
79  ap_uint<6> dsa;
80  ap_uint<1> eof;
81  ap_uint<1> drr;
82  ap_uint<40> saddr;
83  ap_uint<4> tag;
84  ap_uint<4> rsvd;
85  mmCmd() {}
86  mmCmd(ap_uint<40> addr, ap_uint<16> len) :
87  bbt(len), type(1), dsa(0), eof(1), drr(1), saddr(addr), tag(0), rsvd(0) {}
88 
89 };
90 
91 
94 class DmSts
95 {
96  public:
97  ap_uint<4> tag;
98  ap_uint<1> interr;
99  ap_uint<1> decerr;
100  ap_uint<1> slverr;
101  ap_uint<1> okay;
102  DmSts() {}
103 };
104 
105 struct mmStatus
106 {
107  ap_uint<4> tag;
108  ap_uint<1> interr;
109  ap_uint<1> decerr;
110  ap_uint<1> slverr;
111  ap_uint<1> okay;
112 };
113 
114 //TODO is this required??
115 struct mm_ibtt_status
116 {
117  ap_uint<4> tag;
118  ap_uint<1> interr;
119  ap_uint<1> decerr;
120  ap_uint<1> slverr;
121  ap_uint<1> okay;
122  ap_uint<22> brc_vd;
123  ap_uint<1> eop;
124 };
125 
126 
127 #endif
128 
DmCmd(ap_uint< 40 > addr, ap_uint< 16 > len)
mmCmd(ap_uint< 40 > addr, ap_uint< 16 > len)