34 #ifndef _ROLE_WARPTRANSFORM_PROCESSING_HPP_
35 #define _ROLE_WARPTRANSFORM_PROCESSING_HPP_
38 #define FSM_PROCESSING_WAIT_FOR_META 0
39 #define FSM_PROCESSING_PCKT_PROC 1
40 #define FSM_PROCESSING_STOP 2
41 #define FSM_PROCESSING_START 3
42 #define FSM_PROCESSING_BURST_READING 4
43 #define FSM_PROCESSING_DATAFLOW_WRITE 5
44 #define FSM_PROCESSING_DATAFLOW_READ 6
45 #define FSM_PROCESSING_OUTPUT 7
46 #define FSM_PROCESSING_OUTPUT_2 8
47 #define FSM_PROCESSING_OUTPUT_3 9
48 #define FSM_PROCESSING_OUTPUT_4 10
49 #define FSM_PROCESSING_OUTPUT_5 11
50 #define FSM_PROCESSING_CONTINUOUS_RUN 12
51 #define FSM_PROCESSING_WAIT_FOR_DDR_CONTROLLER_EMPTYNESS 13
52 #define ProcessingFsmType uint8_t
67 template <
typename TimgIn=ap_u
int<INPUT_PTR_WIDTH>,
typename TimgOut=ap_u
int<OUTPUT_PTR_WIDTH>>
70 stream<NetworkWord> &sRxpToTxp_Data,
76 stream<TimgIn> &img_in_axi_stream,
77 stream<TimgOut> &img_out_axi_stream,
79 stream<bool> &sImageLoaded,
84 hls::stream<float> &sTxMatrix
88 #pragma HLS INLINE off
89 #pragma HLS pipeline II=1
93 uint16_t Thresh = 442;
95 uint16_t k = K * (1 << 16);
96 static bool accel_called;
97 static unsigned int processed_word_proc;
98 static unsigned int timeoutCntAbs;
99 static unsigned int cnt_i;
105 static unsigned int ddr_addr_out;
106 #pragma HLS reset variable=ddr_addr_out
109 #pragma HLS reset variable=WarpTransformFSM
111 #pragma HLS reset variable=accel_called
112 #pragma HLS reset variable=processed_word_proc
113 #pragma HLS reset variable=timeoutCntAbs
114 #pragma HLS reset variable=cnt_i
115 #pragma HLS reset variable=tmp
116 #pragma HLS reset variable=temp
121 #pragma HLS reset variable=lcl_img_rows
122 #pragma HLS reset variable=lcl_img_cols
123 #pragma HLS reset variable=lcl_img_chan
126 switch(WarpTransformFSM)
129 printf(
"DEBUG in pProcPath: WAIT_FOR_META\n");
130 if (!sImageLoaded.empty())
132 if (sImageLoaded.read() ==
true) {
134 accel_called =
false;
135 processed_word_proc = 0;
141 lcl_img_rows = *img_rows;
142 lcl_img_cols = *img_cols;
143 lcl_img_chan = *img_chan;
149 printf(
"DEBUG in pProcPath: PROCESSING_PACKET\n");
151 if ( !img_in_axi_stream.empty() && !img_out_axi_stream.full() )
154 if (accel_called ==
false) {
158 #ifdef FAKE_WarpTransform
174 printf(
"DEBUG in pProcPath: WARPTRANSFORM_RETURN_RESULTS, ddr_addr_out=%u\n", ddr_addr_out);
175 if (accel_called ==
true) {
177 printf(
"DEBUG in pProcPath: Accumulated %u net words (%u B) to complete a single DDR word\n",
187 printf(
"DEBUG in pProcPath: WARPTRANSFORM_RETURN_RESULTS_ABSORB_DDR_LAT [%u out of %u]\n", timeoutCntAbs,
DDR_LATENCY);
194 printf(
"DEBUG in pProcPath: WARPTRANSFORM_RETURN_RESULTS_FWD\n");
209 newWord =
NetworkWord(temp.data, temp.keep, temp.last);
210 sRxpToTxp_Data.write(newWord);
221 printf(
"DEBUG in pProcPath: WARPTRANSFORM_RETURN_RESULTS\n");
222 if ( !img_out_axi_stream.empty() && !sRxpToTxp_Data.full() )
225 temp.data = img_out_axi_stream.read();
226 if ( img_out_axi_stream.empty() )
231 accel_called =
false;
239 newWord =
NetworkWord(temp.data, temp.keep, temp.last);
240 sRxpToTxp_Data.write(newWord);
#define PROCESSING_PACKET