cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
memtest.cpp
Go to the documentation of this file.
1 
21 #include "../include/memtest.hpp"
22 #include "../include/memtest_processing.hpp"
23 #include "../include/memtest_pattern_library.hpp"
24 #include "../include/memtest_library.hpp"
25 #include "../../../../../HOST/custom/memtest/languages/cplusplus/include/config.h" //debug level define
26 
27 using hls::stream;
28 
29 #define Data_t_in ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0>
30 #define Data_t_out ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0>
31 
32 
33 
39 void memtest(
40 
41  ap_uint<32> *pi_rank,
42  ap_uint<32> *pi_size,
43  //------------------------------------------------------
44  //-- SHELL / This / Udp/TCP Interfaces
45  //------------------------------------------------------
46  stream<NetworkWord> &siSHL_This_Data,
47  stream<NetworkWord> &soTHIS_Shl_Data,
48  stream<NetworkMetaStream> &siNrc_meta,
49  stream<NetworkMetaStream> &soNrc_meta,
50  ap_uint<32> *po_rx_ports
51  #ifdef ENABLE_DDR
52  ,
53  //------------------------------------------------------
54  //-- SHELL / Role / Mem / Mp1 Interface
55  //------------------------------------------------------
58  #endif
59 
60  )
61 {
62  //-- DIRECTIVES FOR THE BLOCK ---------------------------------------------
63  //#pragma HLS INTERFACE ap_ctrl_none port=return
64 
65  //#pragma HLS INTERFACE ap_stable port=piSHL_This_MmioEchoCtrl
66 
67 #pragma HLS INTERFACE axis register both port=siSHL_This_Data
68 #pragma HLS INTERFACE axis register both port=soTHIS_Shl_Data
69 
70 #pragma HLS INTERFACE axis register both port=siNrc_meta
71 #pragma HLS INTERFACE axis register both port=soNrc_meta
72 
73 #pragma HLS INTERFACE ap_ovld register port=po_rx_ports name=poROL_NRC_Rx_ports
74 #pragma HLS INTERFACE ap_stable register port=pi_rank name=piFMC_ROL_rank
75 #pragma HLS INTERFACE ap_stable register port=pi_size name=piFMC_ROL_size
76 
77 
78 #ifdef ENABLE_DDR
79 
80 const unsigned int ddr_mem_depth = TOTMEMDW_512;//*2;
81 const unsigned int ddr_latency = DDR_LATENCY;
82 const unsigned int num_outstanding_transactions = 256;//16;
83 const unsigned int MAX_BURST_LENGTH_512=64;//Theoretically is 64, 64*512bit = 4096KBytes;
84 
85 // Mapping LCL_MEM0 interface to moMEM_Mp1 channel
86 #pragma HLS INTERFACE m_axi depth=ddr_mem_depth port=lcl_mem0 bundle=moMEM_Mp1\
87  max_read_burst_length=MAX_BURST_LENGTH_512 max_write_burst_length=MAX_BURST_LENGTH_512 offset=direct \
88  num_read_outstanding=num_outstanding_transactions num_write_outstanding=num_outstanding_transactions latency=ddr_latency
89 
90 // Mapping LCL_MEM1 interface to moMEM_Mp1 channel
91 #pragma HLS INTERFACE m_axi depth=ddr_mem_depth port=lcl_mem1 bundle=moMEM_Mp1 \
92  max_read_burst_length=MAX_BURST_LENGTH_512 max_write_burst_length=MAX_BURST_LENGTH_512 offset=direct \
93  num_read_outstanding=num_outstanding_transactions num_write_outstanding=num_outstanding_transactions latency=ddr_latency
94 
95 #endif
96 
97  //-- LOCAL VARIABLES ------------------------------------------------------
99  static stream<NetworkMetaStream> sRxtoProc_Meta("sRxtoProc_Meta");
100  static stream<NetworkMetaStream> sProctoTx_Meta("sProctoTx_Meta");
101  static stream<NetworkWord> sProcpToTxp_Data("sProcpToTxp_Data");
102  #pragma HLS STREAM variable=sProcpToTxp_Data depth=20 dim=1
103  static stream<NetworkWord> sRxpToProcp_Data("sRxpToProcp_Data");
104 
105  static unsigned int processed_word_rx;
106  static unsigned int processed_bytes_rx;
107  static unsigned int processed_word_tx;
108  //*po_rx_ports = 0x1; //currently work only with default ports...
109  static stream<NodeId> sDstNode_sig ("sDstNode_sig");
110  bool start_stop;
111  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
112 #pragma HLS DATAFLOW
113 #pragma HLS reset variable=processed_word_rx
114 #pragma HLS reset variable=processed_word_tx
115 
116 
118 //STEP 0: setup the port and the dst of the cluster
119 // CHANGE THE CLUSTER CONNECTIONS HERE
122  pi_rank,
123  pi_size,
124  sDstNode_sig,
125  po_rx_ports);
126 
128 //STEP 1: received the input data, small parse on
129 // the command and fwd to the following step
130 // CHANGE THE COMMAND PARSING HERE
132  pRXPath(
133  siSHL_This_Data,
134  siNrc_meta,
135  sRxtoProc_Meta,
136  sRxpToProcp_Data,
137  meta_tmp,
138  &start_stop,
139  &processed_word_rx,
140  &processed_bytes_rx);
141 
143 //STEP 2: processing the data.
144 // INSERT THE CUSTOM PROCESSING LOGIC HERE
146  pTHISProcessingData<64>(
147  sRxpToProcp_Data,
148  sProcpToTxp_Data,
149  sRxtoProc_Meta,
150  sProctoTx_Meta,
151  &start_stop
152  #ifdef ENABLE_DDR
153  ,
154  lcl_mem0,
155  lcl_mem1
156  #endif
157  );
158 
160 // STEP 3: transmit back the data
161 // currently steup the tlast once reached max size
162 // WARNING: it needs a new meta if filled up the MTU
164  pTXPath(
165  soTHIS_Shl_Data,
166  soNrc_meta,
167  sProcpToTxp_Data,
168  sProctoTx_Meta,
169  sDstNode_sig,
170  &processed_word_tx,
171  pi_rank);
172 
173 
174 }
void pPortAndDestionation(ap_uint< 32 > *pi_rank, ap_uint< 32 > *pi_size, stream< NodeId > &sDstNode_sig, ap_uint< 32 > *po_rx_ports)
pPortAndDestionation - Setup the port and the destination rank.
void pRXPath(stream< NetworkWord > &siSHL_This_Data, stream< NetworkMetaStream > &siNrc_meta, stream< NetworkMetaStream > &sRxtoProc_Meta, stream< NetworkWord > &sRxpToProcp_Data, NetworkMetaStream meta_tmp, bool *start_stop, unsigned int *processed_word_rx, unsigned int *processed_bytes_rx)
Receive Path - From SHELL to THIS.
void memtest(ap_uint< 32 > *pi_rank, ap_uint< 32 > *pi_size, stream< NetworkWord > &siSHL_This_Data, stream< NetworkWord > &soTHIS_Shl_Data, stream< NetworkMetaStream > &siNrc_meta, stream< NetworkMetaStream > &soNrc_meta, ap_uint< 32 > *po_rx_ports, membus_t *lcl_mem0, membus_t *lcl_mem1)
Main process of the Memtest Application directives.
Definition: memtest.cpp:39
#define DDR_LATENCY
Definition: memtest.hpp:98
void pTXPath(stream< NetworkWord > &soTHIS_Shl_Data, stream< NetworkMetaStream > &soNrc_meta, stream< NetworkWord > &sProcpToTxp_Data, stream< NetworkMetaStream > &sRxtoTx_Meta, stream< NodeId > &sDstNode_sig, unsigned int *processed_word_tx, ap_uint< 32 > *pi_rank)
Transmit Path - From THIS to SHELL.
#define ENABLE_DDR
Definition: memtest.hpp:42
membus_512_t membus_t
Definition: memtest.hpp:92
#define TOTMEMDW_512
Definition: memtest.hpp:93
membus_t lcl_mem0[16384]
membus_t lcl_mem1[16384]