38 #include "../include/uppercase.hpp"
39 #include "../../../../../HOST/custom/uppercase/languages/cplusplus/include/config.h"
41 #ifdef USE_HLSLIB_DATAFLOW
42 #include "../../../../../hlslib/include/hlslib/xilinx/Stream.h"
43 #include "../../../../../hlslib/include/hlslib/xilinx/Simulation.h"
46 #ifdef USE_HLSLIB_STREAM
51 #define Data_t_in ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0>
52 #define Data_t_out ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0>
74 stream<NodeId> &sDstNode_sig,
75 ap_uint<32> *po_rx_ports
82 #pragma HLS reset variable=port_fsm
90 if(!sDstNode_sig.full())
92 NodeId dst_rank = (*pi_rank + 1) % *pi_size;
93 printf(
"rank: %d; size: %d; \n", (
int) *pi_rank, (
int) *pi_size);
94 sDstNode_sig.write(dst_rank);
118 stream<NetworkWord> &siSHL_This_Data,
119 stream<NetworkMetaStream> &siNrc_meta,
120 stream<NetworkMetaStream> &sRxtoTx_Meta,
121 stream<NetworkWord> &sRxpToTxp_Data,
123 unsigned int *processed_word_rx,
124 unsigned int *processed_bytes_rx
137 #pragma HLS INLINE off
145 printf(
"DEBUG in pRXPath: enqueueFSM - WAIT_FOR_META, *processed_word_rx=%u, *processed_bytes_rx=%u\n",
146 *processed_word_rx, *processed_bytes_rx);
147 if ( !siNrc_meta.empty() && !sRxtoTx_Meta.full() )
149 meta_tmp = siNrc_meta.read();
151 sRxtoTx_Meta.write(meta_tmp);
157 printf(
"DEBUG in pRXPath: enqueueFSM - PROCESSING_PACKET, *processed_word_rx=%u, *processed_bytes_rx=%u\n",
158 *processed_word_rx, *processed_bytes_rx);
159 if ( !siSHL_This_Data.empty() && !sRxpToTxp_Data.full() )
162 netWord = siSHL_This_Data.read();
167 ap_uint<64> tmp_64_bytes;
168 tmp_text.range(63,0) = netWord.
tdata;
169 tmp_text.range(511,64) = 0;
172 tmp_64_bytes = tmp_text.range(63,0);
173 memcpy(&text, &tmp_64_bytes, 64/8);
179 memcpy((
char*) text, &netWord.
tdata, 64/8);
183 uppercase_conversion:
184 for (
unsigned int i = 0; i <
sizeof(text); i++ ) {
188 if (text[i] >=
'a' && text[i] <=
'z')
189 text[i] = text[i] - (
'a' -
'A');
191 memcpy(&netWord.
tdata, (
char*) text, 64/8);
193 sRxpToTxp_Data.write(netWord);
194 if(netWord.
tlast == 1)
221 stream<NetworkWord> &soTHIS_Shl_Data,
222 stream<NetworkMetaStream> &soNrc_meta,
223 stream<NetworkWord> &sRxpToTxp_Data,
224 stream<NetworkMetaStream> &sRxtoTx_Meta,
225 stream<NodeId> &sDstNode_sig,
226 unsigned int *processed_word_tx,
241 if(!sDstNode_sig.empty())
243 dst_rank = sDstNode_sig.read();
249 printf(
"DEBUG in pTXPath: dequeueFSM=%d - WAIT_FOR_STREAM_PAIR, *processed_word_tx=%u\n",
252 *processed_word_tx = 0;
261 if (( !sRxpToTxp_Data.empty() && !sRxtoTx_Meta.empty()
262 && !soTHIS_Shl_Data.full() && !soNrc_meta.full() ))
264 netWordTx = sRxpToTxp_Data.read();
271 soTHIS_Shl_Data.write(netWordTx);
273 meta_in = sRxtoTx_Meta.read().tdata;
275 meta_out_stream.
tlast = 1;
276 meta_out_stream.
tkeep = 0xFF;
288 soNrc_meta.write(meta_out_stream);
290 (*processed_word_tx)++;
292 if(netWordTx.
tlast != 1)
300 printf(
"DEBUG in pTXPath: dequeueFSM=%d - PROCESSING_PACKET, *processed_word_tx=%u\n",
302 if( !sRxpToTxp_Data.empty() && !soTHIS_Shl_Data.full())
304 netWordTx = sRxpToTxp_Data.read();
307 if(netWordTx.
tlast == 1)
315 (*processed_word_tx)++;
316 if (((*processed_word_tx)*8) %
PACK_SIZE == 0)
322 soTHIS_Shl_Data.write(netWordTx);
337 ap_uint<32> *pi_rank,
338 ap_uint<32> *pi_size,
342 stream<NetworkWord> &siSHL_This_Data,
343 stream<NetworkWord> &soTHIS_Shl_Data,
344 stream<NetworkMetaStream> &siNrc_meta,
345 stream<NetworkMetaStream> &soNrc_meta,
346 ap_uint<32> *po_rx_ports
363 #pragma HLS INTERFACE axis register both port=siSHL_This_Data
364 #pragma HLS INTERFACE axis register both port=soTHIS_Shl_Data
366 #pragma HLS INTERFACE axis register both port=siNrc_meta
367 #pragma HLS INTERFACE axis register both port=soNrc_meta
369 #pragma HLS INTERFACE ap_ovld register port=po_rx_ports name=poROL_NRC_Rx_ports
370 #pragma HLS INTERFACE ap_stable register port=pi_rank name=piFMC_ROL_rank
371 #pragma HLS INTERFACE ap_stable register port=pi_size name=piFMC_ROL_size
377 const unsigned int num_outstanding_transactions = 256;
378 const unsigned int MAX_BURST_LENGTH_512=64;
381 #pragma HLS INTERFACE m_axi depth=ddr_mem_depth port=lcl_mem0 bundle=moMEM_Mp1\
382 max_read_burst_length=MAX_BURST_LENGTH_512 max_write_burst_length=MAX_BURST_LENGTH_512 offset=direct \
383 num_read_outstanding=num_outstanding_transactions num_write_outstanding=num_outstanding_transactions
387 #pragma HLS INTERFACE m_axi depth=ddr_mem_depth port=lcl_mem1 bundle=moMEM_Mp1 \
388 max_read_burst_length=MAX_BURST_LENGTH_512 max_write_burst_length=MAX_BURST_LENGTH_512 offset=direct \
389 num_read_outstanding=num_outstanding_transactions num_write_outstanding=num_outstanding_transactions
395 static stream<NetworkWord> sRxpToTxp_Data(
"sRxpToTxP_Data");
397 static stream<NetworkMetaStream> sRxtoTx_Meta(
"sRxtoTx_Meta");
398 static unsigned int processed_word_rx;
399 static unsigned int processed_bytes_rx;
400 static unsigned int processed_word_tx;
402 static stream<NodeId> sDstNode_sig (
"sDstNode_sig");
408 #pragma HLS reset variable=enqueueFSM
409 #pragma HLS reset variable=dequeueFSM
410 #pragma HLS reset variable=UppercaseFSM
411 #pragma HLS reset variable=processed_word_rx
412 #pragma HLS reset variable=processed_word_tx
416 #ifdef USE_HLSLIB_DATAFLOW
433 HLSLIB_DATAFLOW_INIT();
435 HLSLIB_DATAFLOW_FUNCTION(
pRXPath,
442 &processed_bytes_rx);
444 HLSLIB_DATAFLOW_FUNCTION(
pTXPath,
453 HLSLIB_DATAFLOW_FINALIZE();
#define FSM_WRITE_NEW_DATA
#define PROCESSING_PACKET
#define WAIT_FOR_STREAM_PAIR
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 > &sRxtoTx_Meta, stream< NetworkWord > &sRxpToTxp_Data, NetworkMetaStream meta_tmp, unsigned int *processed_word_rx, unsigned int *processed_bytes_rx)
Receive Path - From SHELL to THIS.
void pTXPath(stream< NetworkWord > &soTHIS_Shl_Data, stream< NetworkMetaStream > &soNrc_meta, stream< NetworkWord > &sRxpToTxp_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.
void uppercase(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)
Main process of the Uppercase Application directives.