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>
75 stream<NodeId> &sDstNode_sig,
76 ap_uint<32> *po_rx_ports
80 #pragma HLS INLINE off
83 #pragma HLS reset variable=port_fsm
91 if(!sDstNode_sig.full())
93 NodeId dst_rank = (*pi_rank + 1) % *pi_size;
94 printf(
"rank: %d; size: %d; \n", (
int) *pi_rank, (
int) *pi_size);
95 sDstNode_sig.write(dst_rank);
120 stream<NetworkWord> &siSHL_This_Data,
121 stream<NetworkMetaStream> &siNrc_meta,
122 stream<NetworkMetaStream> &sRxtoTx_Meta,
123 stream<NetworkWord> &sRxpToProcp_Data,
126 unsigned int *processed_word_rx,
127 unsigned int *processed_bytes_rx
137 static bool start_stop_local =
false;
138 #pragma HLS reset variable=start_stop_local
140 *start_stop = start_stop_local;
144 printf(
"DEBUG in pRXPath: enqueueFSM - WAIT_FOR_META, *processed_word_rx=%u, *processed_bytes_rx=%u\n",
145 *processed_word_rx, *processed_bytes_rx);
146 if ( !siNrc_meta.empty() && !sRxtoTx_Meta.full() )
148 meta_tmp = siNrc_meta.read();
150 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);
161 if ( !siSHL_This_Data.empty() && !sRxpToProcp_Data.full() )
164 netWord = siSHL_This_Data.read();
166 switch(netWord.
tdata)
169 start_stop_local=
true;
174 start_stop_local=
false;
180 if (start_stop_local)
187 sRxpToProcp_Data.write(netWord);
188 if(netWord.
tlast == 1)
210 stream<NetworkWord> &sRxpToProcp_Data,
211 stream<NetworkWord> &sProcpToTxp_Data,
216 #pragma HLS INLINE off
224 printf(
"DEBUG proc FSM, I am in the stop state\n");
225 if ( !sRxpToProcp_Data.empty() && !sProcpToTxp_Data.full() )
228 netWord = sRxpToProcp_Data.read();
229 sProcpToTxp_Data.write(netWord);
238 if ( !sRxpToProcp_Data.empty() && !sProcpToTxp_Data.full() )
242 netWord = sRxpToProcp_Data.read();
244 memcpy((
char*) text, &netWord.
tdata, 64/8);
247 uppercase_conversion:
248 for (
unsigned int i = 0; i <
sizeof(text); i++ ) {
250 if (text[i] >=
'a' && text[i] <=
'z')
251 text[i] = text[i] - (
'a' -
'A');
253 memcpy(&netWord.
tdata, (
char*) text, 64/8);
255 sProcpToTxp_Data.write(netWord);
256 if(netWord.
tlast == 1)
284 stream<NetworkWord> &soTHIS_Shl_Data,
285 stream<NetworkMetaStream> &soNrc_meta,
286 stream<NetworkWord> &sProcpToTxp_Data,
287 stream<NetworkMetaStream> &sRxtoTx_Meta,
288 stream<NodeId> &sDstNode_sig,
289 unsigned int *processed_word_tx,
304 if(!sDstNode_sig.empty())
306 dst_rank = sDstNode_sig.read();
312 printf(
"DEBUG in pTXPath: dequeueFSM=%d - WAIT_FOR_STREAM_PAIR, *processed_word_tx=%u\n",
315 *processed_word_tx = 0;
324 if (( !sProcpToTxp_Data.empty() && !sRxtoTx_Meta.empty()
325 && !soTHIS_Shl_Data.full() && !soNrc_meta.full() ))
327 netWordTx = sProcpToTxp_Data.read();
334 soTHIS_Shl_Data.write(netWordTx);
336 meta_in = sRxtoTx_Meta.read().tdata;
338 meta_out_stream.
tlast = 1;
339 meta_out_stream.
tkeep = 0xFF;
351 soNrc_meta.write(meta_out_stream);
353 (*processed_word_tx)++;
355 if(netWordTx.
tlast != 1)
363 printf(
"DEBUG in pTXPath: dequeueFSM=%d - PROCESSING_PACKET, *processed_word_tx=%u\n",
365 if( !sProcpToTxp_Data.empty() && !soTHIS_Shl_Data.full())
367 netWordTx = sProcpToTxp_Data.read();
370 if(netWordTx.
tlast == 1)
378 (*processed_word_tx)++;
379 if (((*processed_word_tx)*8) %
PACK_SIZE == 0)
385 soTHIS_Shl_Data.write(netWordTx);
400 ap_uint<32> *pi_rank,
401 ap_uint<32> *pi_size,
405 stream<NetworkWord> &siSHL_This_Data,
406 stream<NetworkWord> &soTHIS_Shl_Data,
407 stream<NetworkMetaStream> &siNrc_meta,
408 stream<NetworkMetaStream> &soNrc_meta,
409 ap_uint<32> *po_rx_ports
418 #pragma HLS INTERFACE axis register both port=siSHL_This_Data
419 #pragma HLS INTERFACE axis register both port=soTHIS_Shl_Data
421 #pragma HLS INTERFACE axis register both port=siNrc_meta
422 #pragma HLS INTERFACE axis register both port=soNrc_meta
424 #pragma HLS INTERFACE ap_ovld register port=po_rx_ports name=poROL_NRC_Rx_ports
425 #pragma HLS INTERFACE ap_stable register port=pi_rank name=piFMC_ROL_rank
426 #pragma HLS INTERFACE ap_stable register port=pi_size name=piFMC_ROL_size
432 static stream<NetworkMetaStream> sRxtoTx_Meta(
"sRxtoTx_Meta");
433 static stream<NetworkWord> sProcpToTxp_Data(
"sProcpToTxp_Data");
434 static stream<NetworkWord> sRxpToProcp_Data(
"sRxpToProcp_Data");
438 static unsigned int processed_word_rx;
439 static unsigned int processed_bytes_rx;
440 static unsigned int processed_word_tx;
442 static stream<NodeId> sDstNode_sig (
"sDstNode_sig");
451 #pragma HLS reset variable=enqueueFSM
452 #pragma HLS reset variable=dequeueFSM
453 #pragma HLS reset variable=UppercaseFSM
454 #pragma HLS reset variable=processingFSM
455 #pragma HLS reset variable=processed_word_rx
456 #pragma HLS reset variable=processed_word_tx
460 #ifdef USE_HLSLIB_DATAFLOW
477 HLSLIB_DATAFLOW_INIT();
479 HLSLIB_DATAFLOW_FUNCTION(
pRXPath,
486 &processed_bytes_rx);
488 HLSLIB_DATAFLOW_FUNCTION(
pTXPath,
497 HLSLIB_DATAFLOW_FINALIZE();
515 &processed_bytes_rx);
#define ProcessingFsmType
#define FSM_WRITE_NEW_DATA
#define PROCESSING_PACKET
#define WAIT_FOR_STREAM_PAIR
#define FSM_PROCESSING_STOP
#define FSM_PROCESSING_START
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 pTHISProcessingData(stream< NetworkWord > &sRxpToProcp_Data, stream< NetworkWord > &sProcpToTxp_Data, bool *start_stop)
THIS processing the data once recieved a start command.
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.