cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
test_sobel.cpp
Go to the documentation of this file.
1 
17 
36 #include "../include/sobel.hpp"
37 #include "../../common/src/common.cpp"
38 
39 using namespace std;
40 
41 //---------------------------------------------------------
42 // HELPERS FOR THE DEBUGGING TRACES
43 // .e.g: DEBUG_LEVEL = (MDL_TRACE | IPS_TRACE)
44 //---------------------------------------------------------
45 #define THIS_NAME "TB"
46 
47 #define TRACE_OFF 0x0000
48 #define TRACE_URIF 1 << 1
49 #define TRACE_UAF 1 << 2
50 #define TRACE_MMIO 1 << 3
51 #define TRACE_ALL 0xFFFF
52 
53 #define DEBUG_LEVEL (TRACE_ALL)
54 
55 
56 //------------------------------------------------------
57 //-- TESTBENCH DEFINES
58 //------------------------------------------------------
59 #define OK true
60 #define KO false
61 #define VALID true
62 #define UNVALID false
63 #define DEBUG_TRACE true
64 
65 // The number of sequential testbench executions
66 #define TB_TRIALS 2
67 
68 // Enable delay in the response channel of DDR AXI controller
69 #define ENABLE_DDR_EMULATE_DELAY_IN_TB
70 
71 #define ENABLED (ap_uint<1>)1
72 #define DISABLED (ap_uint<1>)0
73 
74 
75 //------------------------------------------------------
76 //-- DUT INTERFACES AS GLOBAL VARIABLES
77 //------------------------------------------------------
78 
79 //-- SHELL / Uaf / Mmio / Config Interfaces
80 //ap_uint<2> piSHL_This_MmioEchoCtrl;
83 
84 //-- SHELL / Uaf / Udp Interfaces
85 stream<UdpWord> sSHL_Uaf_Data ("sSHL_Uaf_Data");
86 stream<UdpWord> sUAF_Shl_Data ("sUAF_Shl_Data");
87 stream<UdpWord> image_stream_from_sobel ("image_stream_from_sobel");
88 
89 ap_uint<32> s_udp_rx_ports = 0x0;
90 stream<NetworkMetaStream> siUdp_meta ("siUdp_meta");
91 stream<NetworkMetaStream> soUdp_meta ("soUdp_meta");
92 ap_uint<32> node_rank;
93 ap_uint<32> cluster_size;
94 
95 #ifdef ENABLE_DDR
96 
97 //------------------------------------------------------
98 //-- SHELL / Role / Mem / Mp0 Interface
99 //------------------------------------------------------
100 //---- Read Path (MM2S) ------------
101 stream<DmCmd> sROL_Shl_Mem_RdCmdP0("sROL_Shl_Mem_RdCmdP0");
102 stream<DmSts> sSHL_Rol_Mem_RdStsP0("sSHL_Rol_Mem_RdStsP0");
103 stream<Axis<MEMDW_512> > sSHL_Rol_Mem_ReadP0 ("sSHL_Rol_Mem_ReadP0");
104 //---- Write Path (S2MM) -----------
105 stream<DmCmd> sROL_Shl_Mem_WrCmdP0("sROL_Shl_Mem_WrCmdP0");
106 stream<DmSts> sSHL_Rol_Mem_WrStsP0("sSHL_Rol_Mem_WrStsP0");
107 stream<Axis<MEMDW_512> > sROL_Shl_Mem_WriteP0("sROL_Shl_Mem_WriteP0");
108 
109 //------------------------------------------------------
110 //-- SHELL / Role / Mem / Mp1 Interface
111 //------------------------------------------------------
112 #define MEMORY_LINES_512 TOTMEMDW_512 /* 64 KiB */
115 #endif
116 
117 //------------------------------------------------------
118 //-- TESTBENCH GLOBAL VARIABLES
119 //------------------------------------------------------
120 int simCnt;
121 
122 
123 
127 void stepDut() {
128  sobel(
133  #ifdef ENABLE_DDR
134  ,
135  // sROL_Shl_Mem_RdCmdP0,
136  // sSHL_Rol_Mem_RdStsP0,
137  // sSHL_Rol_Mem_ReadP0,
141  lcl_mem0,
142  lcl_mem1
143  #endif
144  );
145  simCnt++;
146  printf("[%4.4d] STEP DUT \n", simCnt);
147 }
148 
149 
150 
151 
152 
157 int main(int argc, char** argv) {
158 
159  //------------------------------------------------------
160  //-- TESTBENCH LOCAL VARIABLES
161  //------------------------------------------------------
162  int nrErr;
163  unsigned int tb_trials = 0;
164 
165  printf("#####################################################\n");
166  printf("## MAIN TESTBENCH STARTS HERE ##\n");
167  printf("#####################################################\n");
168 
169 
170  //------------------------------------------------------
171  //-- TESTBENCH LOCAL VARIABLES FOR SOBEL
172  //------------------------------------------------------
173  cv::Mat in_img, img_gray;
174  cv::Mat hls_out_img, ocv_out_img;
175 
176  if (argc != 2) {
177  printf("Usage : %s <input image> \n", argv[0]);
178  return -1;
179  }
180  in_img = cv::imread(argv[1], 0); // reading in the color image
181 
182  if (!in_img.data) {
183  printf("ERROR: Failed to load the image ... %s\n!", argv[1]);
184  return -1;
185  }
186  else {
187  printf("INFO: Succesfully loaded image ... %s\n", argv[1]);
188  if (in_img.total() != FRAME_WIDTH * FRAME_HEIGHT) {
189  printf("WARNING: Resizing input image %s from [%u x %u] to [%u x %u] !\n", argv[1], in_img.rows, in_img.cols, FRAME_WIDTH, FRAME_HEIGHT);
190  cv::resize(in_img, in_img, cv::Size(FRAME_WIDTH, FRAME_HEIGHT), 0, 0, cv::INTER_LINEAR);
191  }
192  // Ensure that the selection of MTU is a multiple of 8 (Bytes per transaction)
193  assert(PACK_SIZE % 8 == 0);
194  }
195 
196  #ifdef ENABLE_DDR
197  memset(lcl_mem0, 0x0, sizeof(lcl_mem0));
198  memset(lcl_mem1, 0x0, sizeof(lcl_mem1));
199 
200  DmCmd dmCmd_MemCmdP0;
201  DmSts dmSts_MemWrStsP0;
202  DmSts dmSts_MemRdStsP0;
203  Axis<MEMDW_512> memP0;
204  ap_uint<64> currentMemPattern = 0;
205 
206  unsigned int ddr_addr_in = 0x0;
207  unsigned int ddr_write_req_iter = 0;
208  unsigned int wait_cycles_to_ack_ddr_status = 0;
209  unsigned int count_cycles_to_ack_ddr_status = 0;
210  bool ddr_write_sts_req = false;
211  #endif
212 
213 
214  //------------------------------------------------------
215  //-- STEP-1.1 : CREATE MEMORY FOR OUTPUT IMAGES
216  //------------------------------------------------------
217  // cvtColor(in_img, img_gray, CV_BGR2GRAY);
218  // Convert rgb into grayscale
219  hls_out_img.create(in_img.rows, in_img.cols, CV_8U); // create memory for hls output image
220  ocv_out_img.create(in_img.rows, in_img.cols, CV_8U); // create memory for opencv output image
221 
222  #if NO
223  static xf::cv::Mat<TYPE, HEIGHT, WIDTH, XF_NPPC1> imgInput(in_img.rows, in_img.cols);
224  static xf::cv::Mat<TYPE, HEIGHT, WIDTH, XF_NPPC1> imgOutput(in_img.rows, in_img.cols);
225  static xf::cv::Mat<TYPE, HEIGHT, WIDTH, XF_NPPC1> imgOutputTb(in_img.rows, in_img.cols);
226  imgInput.copyTo(in_img.data);
227  ap_uint<INPUT_PTR_WIDTH> *imgInputArray = (ap_uint<INPUT_PTR_WIDTH>*) malloc(in_img.rows * in_img.cols * sizeof(ap_uint<INPUT_PTR_WIDTH>));
228  ap_uint<OUTPUT_PTR_WIDTH> *imgOutputArrayTb = (ap_uint<OUTPUT_PTR_WIDTH>*) malloc(in_img.rows * in_img.cols * sizeof(ap_uint<OUTPUT_PTR_WIDTH>));
229  ap_uint<OUTPUT_PTR_WIDTH> *imgOutputArray = (ap_uint<OUTPUT_PTR_WIDTH>*) malloc(in_img.rows * in_img.cols * sizeof(ap_uint<OUTPUT_PTR_WIDTH>));
230  xf::cv::xfMat2Array<INPUT_PTR_WIDTH, TYPE, HEIGHT, WIDTH, NPIX>(imgInput, imgInputArray);
231  #endif
232 
233  #if RO
234  static xf::cv::Mat<TYPE, HEIGHT, WIDTH, XF_NPPC8> imgInput(in_img.rows, in_img.cols);
235  static xf::cv::Mat<TYPE, HEIGHT, WIDTH, XF_NPPC8> imgOutput(in_img.rows, in_img.cols);
236  static xf::cv::Mat<TYPE, HEIGHT, WIDTH, XF_NPPC1> imgOutputTb(in_img.rows, in_img.cols);
237  #endif
238 
239  while (tb_trials++ < TB_TRIALS) {
240 
241 
242  printf ( "##################################################### \n" );
243  printf ( "## TESTBENCH #%u STARTS HERE ##\n", tb_trials );
244  printf ( "##################################################### \n" );
245 
246 
247  simCnt = 0;
248  nrErr = 0;
249 
250 #if NO
251  if ( !dumpImgToFile ( imgInput, "ifsSHL_Uaf_Data.dat", simCnt ) ) {
252  nrErr++;
253  }
254 #endif
255 
256 #if RO
257  // imgInput.copyTo(img_gray.data);
258  imgInput = xf::cv::imread<TYPE, HEIGHT, WIDTH, XF_NPPC8> ( argv[1], 0 );
259 #endif
260 
261 
262 
263  //------------------------------------------------------
264  //-- STEP-1.2 : RUN SOBEL DETECTOR FROM OpenCV LIBRARY
265  //------------------------------------------------------
266  // ksize: aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ...
267  int ksize = WINDOW_SIZE ;
268  ocv_ref ( in_img, ocv_out_img, ksize);
269 
270 
271 
272  //------------------------------------------------------
273  //-- STEP-2.1 : CREATE TRAFFIC AS INPUT STREAMS
274  //------------------------------------------------------
275  if ( nrErr == 0 ) {
276  if ( !setInputDataStream ( sSHL_Uaf_Data, "sSHL_Uaf_Data", "ifsSHL_Uaf_Data.dat", simCnt ) ) {
277  printf ( "### ERROR : Failed to set input data stream \"sSHL_Uaf_Data\". \n" );
278  nrErr++;
279  }
280 
281  //there are TOT_TRANSFERS streams from the the App to the Role
283  for ( int i=0; i<TOT_TRANSFERS; i++ ) {
284  siUdp_meta.write ( NetworkMetaStream ( tmp_meta ) );
285  }
286  //set correct node_rank and cluster_size
287  node_rank = 1;
288  cluster_size = 2;
289  }
290 
291  //------------------------------------------------------
292  //-- STEP-2.2 : SET THE PASS-THROUGH MODE
293  //------------------------------------------------------
294  //piSHL_This_MmioEchoCtrl.write(ECHO_PATH_THRU);
295  //[TODO] piSHL_This_MmioPostPktEn.write(DISABLED);
296  //[TODO] piSHL_This_MmioCaptPktEn.write(DISABLED);
297 
298  //------------------------------------------------------
299  //-- STEP-3 : MAIN TRAFFIC LOOP
300  //------------------------------------------------------
301  while ( !nrErr ) {
302 
303  // Keep enough simulation time for sequntially executing the FSMs of the main 3 functions
304  // (Rx-Proc-Tx)
306 #ifdef ENABLE_DDR
309 #endif
310 #endif
311  ) {
312  stepDut();
313 
314  if ( simCnt > 2 ) {
315  assert ( s_udp_rx_ports == PORTS_OPENED );
316  }
317 
318 if (simCnt < 0)
319  exit(0);
320 #ifdef ENABLE_DDR
321 
322  if ( !sROL_Shl_Mem_WrCmdP0.empty() ) {
323  printf ( "DEBUG tb: Read a memory write command from SHELL/Mem/Mp0 \n" );
324  //-- Read a memory write command from SHELL/Mem/Mp0
325  sROL_Shl_Mem_WrCmdP0.read ( dmCmd_MemCmdP0 );
326  //assert ( dmCmd_MemCmdP0.bbt == CHECK_CHUNK_SIZE );
327  assert ( dmCmd_MemCmdP0.type == 1 && dmCmd_MemCmdP0.dsa == 0 && dmCmd_MemCmdP0.eof == 1 && dmCmd_MemCmdP0.drr == 1 && dmCmd_MemCmdP0.tag == 0x0 );
328  ddr_addr_in = (unsigned int)dmCmd_MemCmdP0.saddr / BPERMDW_512; // Convert the byte-aligned address to local mem of stack tb.
329  printf ( "DEBUG tb: Requesting writting to address %u (max depth = %u) an amount of %u bytes (%u memory lines), ddr_write_req_iter=%u\n", ddr_addr_in, MEMORY_LINES_512-1, (unsigned int)dmCmd_MemCmdP0.bbt, (unsigned int)(1 + (dmCmd_MemCmdP0.bbt - 1) / BPERMDW_512), ddr_write_req_iter);
330  assert (ddr_addr_in <= MEMORY_LINES_512-1);
331  //ddr_write_req_iter++;
332  //printf ( "DEBUG tb: (ddr_write_req_iter)%(MEMORY_LINES_512-1)=%u\n", (ddr_write_req_iter)%(MEMORY_LINES_512-1));
333  if ((++ddr_write_req_iter)%(MEMORY_LINES_512) == 0) {
334  ddr_write_req_iter = 0;
335  }
336  printf ( "DEBUG tb: ddr_write_req_iter=%u\n", ddr_write_req_iter);
337 
338 #ifdef ENABLE_DDR_EMULATE_DELAY_IN_TB
339  /*
340  * 16 -> emulate a response in 16 cycles
341  * 1 -> emulate immediate response
342  * CYCLES_UNTIL_TIMEOUT -> on purpose timeout
343  */
344  if (ddr_write_req_iter == 1) {
345  wait_cycles_to_ack_ddr_status = TYPICAL_DDR_LATENCY;
346  }
347  else if (ddr_write_req_iter == 2) {
348  wait_cycles_to_ack_ddr_status = TYPICAL_DDR_LATENCY;
349  }
350  else {
351  wait_cycles_to_ack_ddr_status = TYPICAL_DDR_LATENCY;
352  }
353  if (!sSHL_Rol_Mem_WrStsP0.empty()) {
354  printf("WARNING: Emptying sSHL_Rol_Mem_WrStsP0 fifo.\n");
355  dmSts_MemWrStsP0 = sSHL_Rol_Mem_WrStsP0.read();
356  }
357 #else
358  wait_cycles_to_ack_ddr_status = 0;
359 #endif
360  count_cycles_to_ack_ddr_status = 0;
361  ddr_write_sts_req = false;
362  }
363 
364  if ( !sROL_Shl_Mem_WriteP0.empty() ) {
365  sROL_Shl_Mem_WriteP0.read ( memP0 );
366  printf ( "DEBUG tb: Write a memory line from SHELL/Mem/Mp0 \n" );
367 
368  assert ( memP0.tkeep == 0xffffffffffffffff );
369 
370  /* Read from AXI stream DDR interface and write to the memory mapped interface of
371  * DDR channel P0. In the real HW, this is enabled by the AXI interconnect and AXI
372  * Datamover, being instantiated in VHDL.
373  * */
374  // printf ( "DEBUG tb: Writting to address 0x%x : %u an amount of %u bytes\n", ddr_addr_in, memP0.tdata.to_long(), BPERMDW_512);
375  std::cout << "DEBUG tb: Writting to address 0x" << std::hex << ddr_addr_in << " : " << memP0.tdata << " an amount of " << std::dec << BPERMDW_512 << " bytes" << std::endl;
376  //lcl_mem0[ddr_addr_in++] = memP0.tdata;
377  memcpy(&lcl_mem0[ddr_addr_in++], &memP0.tdata, BPERMDW_512);
378  ddr_write_sts_req = true;
379  }
380  // When we have emulated the writting to lcl_mem0, we acknowledge with a P0 status
381  if ((ddr_write_sts_req == true) && !sSHL_Rol_Mem_WrStsP0.full() && (memP0.tlast == true)) {
382  if (count_cycles_to_ack_ddr_status++ == wait_cycles_to_ack_ddr_status) {
383  dmSts_MemWrStsP0.tag = 0;
384  dmSts_MemWrStsP0.okay = 1;
385  dmSts_MemWrStsP0.interr = 0;
386  dmSts_MemWrStsP0.slverr = 0;
387  dmSts_MemWrStsP0.decerr = 0;
388  printf ( "DEBUG tb: Write a memory status command to SHELL/Mem/Mp0 \n" );
389  sSHL_Rol_Mem_WrStsP0.write ( dmSts_MemWrStsP0 );
390  ddr_write_sts_req = false;
391  }
392  else{
393  printf ( "DEBUG tb: Waiting to write a memory status command to SHELL/Mem/Mp0 [%u out of %u] cycles\n", count_cycles_to_ack_ddr_status, wait_cycles_to_ack_ddr_status);
394  }
395  }
396 
397 
398 
399 #endif // ENABLE_DDR
400 
401 
402  //if( !soUdp_meta.empty())
403  //{
404  // NetworkMetaStream tmp_meta = soUdp_meta.read();
405  // printf("NRC received NRCmeta stream from node_rank %d.\n", (int) tmp_meta.tdata.src_rank);
406  //}
407 
408 
409  } else {
410 #ifdef ENABLE_DDR
411  if (!sSHL_Rol_Mem_WrStsP0.empty()) {
412  printf("WARNING: Emptying sSHL_Rol_Mem_WrStsP0 fifo.\n");
413  dmSts_MemWrStsP0 = sSHL_Rol_Mem_WrStsP0.read();
414  }
415 #endif
416  printf ( "## End of simulation at cycle=%3d. \n", simCnt );
417  break;
418  }
419 
420  } // End: while()
421 
422  //-------------------------------------------------------
423  //-- STEP-4 : DRAIN AND WRITE OUTPUT FILE STREAMS
424  //-------------------------------------------------------
425  //---- UAF-->SHELL Data ----
426  if ( !getOutputDataStream ( sUAF_Shl_Data, "sUAF_Shl_Data", "ofsUAF_Shl_Data.dat", simCnt ) ) {
427  nrErr++;
428  }
429  //---- UAF-->SHELL META ----
430  if ( !soUdp_meta.empty() ) {
431  int i = 0;
432  while ( !soUdp_meta.empty() ) {
433  i++;
434  NetworkMetaStream tmp_meta = soUdp_meta.read();
435  printf ( "NRC received NRCmeta stream from rank %d to rank %d.\n", ( int ) tmp_meta.tdata.src_rank, ( int ) tmp_meta.tdata.dst_rank );
436  assert ( tmp_meta.tdata.src_rank == node_rank );
437  //ensure forwarding behavior
438  assert ( tmp_meta.tdata.dst_rank == ( ( tmp_meta.tdata.src_rank + 1 ) % cluster_size ) );
439  }
440  //printf("DEBUG: i=%u\tTOT_TRANSFERS=%u\n", i, TOT_TRANSFERS);
441  assert ( i == TOT_TRANSFERS );
442  } else {
443  printf ( "Error No metadata received...\n" );
444  nrErr++;
445  }
446 
447  //-------------------------------------------------------
448  //-- STEP-5 : FROM THE OUTPUT FILE CREATE AN ARRAY
449  //-------------------------------------------------------
450  if ( !setInputFileToArray ( "ofsUAF_Shl_Data.dat", imgOutputArray, simCnt ) ) {
451  printf ( "### ERROR : Failed to set input array from file \"ofsUAF_Shl_Data.dat\". \n" );
452  nrErr++;
453  }
454  xf::cv::Array2xfMat<OUTPUT_PTR_WIDTH, TYPE, HEIGHT, WIDTH, NPIX> ( imgOutputArray, imgOutput );
455 
456 
457  //------------------------------------------------------
458  //-- STEP-6 : COMPARE INPUT AND OUTPUT FILE STREAMS
459  //------------------------------------------------------
460  int rc1 = system ( "diff --brief -w -i -y ../../../../test/ofsUAF_Shl_Data.dat \
461  ../../../../test/verify_UAF_Shl_Data.dat" );
462  if ( rc1 ) {
463  printf ( "## Error : File \'ofsUAF_Shl_Data.dat\' does not match \'verify_UAF_Shl_Data.dat\'.\n" );
464  } else {
465  printf ( "Output data in file \'ofsUAF_Shl_Data.dat\' verified.\n" );
466  }
467 
468  nrErr += rc1;
469 
470  printf ( "#####################################################\n" );
471  if ( nrErr ) {
472  printf ( "## ERROR - TESTBENCH #%u FAILED (RC=%d) !!! ##\n", tb_trials, nrErr );
473  } else {
474  printf ( "## SUCCESSFULL END OF TESTBENCH #%u (RC=0) ##\n", tb_trials );
475  }
476  printf ( "#####################################################\n" );
477 
478 
479 
480 
481 
482  } // End tb trials while loop
483 
484 
485 
486 
487 
488 
489 
490 
492  #if NO
493 
494  // L2 Vitis Sobel
495  medianBlurAccelArray(imgInputArray, imgOutputArrayTb, in_img.rows, in_img.cols);
496  xf::cv::Array2xfMat<OUTPUT_PTR_WIDTH, TYPE, HEIGHT, WIDTH, NPIX>(imgOutputArrayTb, imgOutputTb);
497 
498  // L1 Vitis Sobel
499  //sobel_accel(imgInput, imgOutput, Thresh, k);
500 
501  #endif
502 
503  #if RO
504 
505  sobel_accel(imgInput, imgOutputTb);
506 
507  #endif
508 
510  xf::cv::imwrite("hls_out_tb.jpg", imgOutputTb);
511  xf::cv::imwrite("hls_out.jpg", imgOutput);
512  cv::imwrite("ocv_ref_out.jpg", ocv_out_img);
513 
514  unsigned int val;
515  unsigned short int row, col;
516 
517  cv::Mat out_img;
518  out_img = in_img.clone();
519 
520  std::vector<cv::Point> hls_points;
521  std::vector<cv::Point> ocv_points;
522  std::vector<cv::Point> common_pts;
523 
524  xf::cv::Mat<TYPE, HEIGHT, WIDTH, NPIX>* select_imgOutput;
525 
526  // Select which output you want to process for image outputs and corners comparisons:
527  // &imgOutput : The processed image by Sobel IP inside the ROLE (i.e. I/O traffic is passing through SHELL)
528  // &imgOutputTb : The processed image by Sobel IP in this testbench (i.e. I/O traffic is done in testbench)
529  select_imgOutput = &imgOutput;
530 
531  // Clear memory
532  free(imgOutputArrayTb);
533  free(imgOutputArray);
534  free(imgInputArray);
535 
536 
537  return(nrErr);
538 }
539 
540 
541 
542 
ap_uint< 64 > currentMemPattern
ap_uint< 40 > saddr
ap_uint< 1 > drr
ap_uint< 1 > eof
ap_uint< 23 > bbt
ap_uint< 4 > tag
ap_uint< 6 > dsa
ap_uint< 1 > type
ap_uint< 1 > okay
ap_uint< 1 > decerr
ap_uint< 1 > slverr
ap_uint< 4 > tag
ap_uint< 1 > interr
void ocv_ref(cv::Mat img_gray, cv::Mat &ocv_out_img, float Th)
Definition: xf_ocv_ref.hpp:552
#define FRAME_HEIGHT
Definition: config.h:43
#define FRAME_WIDTH
Definition: config.h:46
#define BPERMDW_512
Definition: harris.hpp:120
#define PORTS_OPENED
Definition: harris.hpp:102
#define MIN_TX_LOOPS
#define MIN_RX_LOOPS
#define TOT_TRANSFERS
Definition: config.h:70
#define WINDOW_SIZE
void medianBlurAccelArray(ap_uint< 8 > *img_inp, ap_uint< 64 > *img_out, int rows, int cols)
Top-level accelerated function of the MedianBlur Application with array I/F.
#define EXTRA_DDR_LATENCY_DUE_II
Definition: memtest.hpp:99
#define DDR_LATENCY
Definition: memtest.hpp:98
#define ENABLE_DDR
Definition: memtest.hpp:42
membus_512_t membus_t
Definition: memtest.hpp:92
#define TYPICAL_DDR_LATENCY
Definition: memtest.hpp:97
#define PACK_SIZE
Definition: config.h:51
bool setInputDataStream(stream< UdpAppData > &sDataStream, const string dataStreamName, const string inpFileName)
Initialize an input data stream from a file.
Definition: tb_nal.cpp:214
#define DEFAULT_RX_PORT
Definition: nal.hpp:139
bool getOutputDataStream(stream< UdpAppData > &sDataStream, const string dataStreamName, const string outFileName)
Fill an output file with data from an output stream.
Definition: tb_nal.cpp:526
void sobel(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, stream< DmCmd > &soMemWrCmdP0, stream< DmSts > &siMemWrStsP0, stream< Axis< 512 > > &soMemWriteP0, membus_t *lcl_mem0, membus_t *lcl_mem1)
Main process of the Sobel Application directives.
Definition: sobel.cpp:51
stream< DmSts > sSHL_Rol_Mem_RdStsP0("sSHL_Rol_Mem_RdStsP0")
#define TB_TRIALS
Definition: test_sobel.cpp:66
stream< NetworkMetaStream > siUdp_meta("siUdp_meta")
stream< Axis< 512 > > sSHL_Rol_Mem_ReadP0("sSHL_Rol_Mem_ReadP0")
int main(int argc, char **argv)
Main testbench of Hrris.
Definition: test_sobel.cpp:157
stream< NetworkMetaStream > soUdp_meta("soUdp_meta")
int simCnt
Definition: test_sobel.cpp:120
stream< Axis< 512 > > sROL_Shl_Mem_WriteP0("sROL_Shl_Mem_WriteP0")
ap_uint< 1 > piSHL_This_MmioCaptPktEn
Definition: test_sobel.cpp:82
ap_uint< 1 > piSHL_This_MmioPostPktEn
Definition: test_sobel.cpp:81
stream< DmCmd > sROL_Shl_Mem_WrCmdP0("sROL_Shl_Mem_WrCmdP0")
stream< UdpWord > sUAF_Shl_Data("sUAF_Shl_Data")
stream< UdpWord > image_stream_from_sobel("image_stream_from_sobel")
stream< DmCmd > sROL_Shl_Mem_RdCmdP0("sROL_Shl_Mem_RdCmdP0")
membus_t lcl_mem0[(1+(IMGSIZE - 1)/(512/8))]
Definition: test_sobel.cpp:113
void stepDut()
Run a single iteration of the DUT model.
Definition: test_sobel.cpp:127
#define MEMORY_LINES_512
Definition: test_sobel.cpp:112
membus_t lcl_mem1[(1+(IMGSIZE - 1)/(512/8))]
Definition: test_sobel.cpp:114
stream< UdpWord > sSHL_Uaf_Data("sSHL_Uaf_Data")
stream< DmSts > sSHL_Rol_Mem_WrStsP0("sSHL_Rol_Mem_WrStsP0")
#define ENABLE_DDR_EMULATE_DELAY_IN_TB
Definition: test_sobel.cpp:69
ap_uint< 32 > cluster_size
Definition: test_sobel.cpp:93
ap_uint< 32 > s_udp_rx_ports
Definition: test_sobel.cpp:89
ap_uint< 32 > node_rank
Definition: test_sobel.cpp:92
void sobel_accel(xf::cv::Mat< XF_8UC1, 1024, 1024, XF_NPPC1 > &_src, xf::cv::Mat< XF_8UC1, 1024, 1024, XF_NPPC1 > &_dst)
bool dumpImgToFile(xf::cv::Mat< OUT_TYPE, HEIGHT, WIDTH, NPIX > &_img, const std::string outFileName, int simCnt)
Fill an output file with data from an image.
bool setInputFileToArray(const std::string inpFileName, ap_uint< OUTPUT_PTR_WIDTH > *imgArray, int simCnt)
Initialize an input array from a file with format "tdata tkeep tlast".
ap_uint<(D+7)/8 > tkeep
Definition: axi_utils.hpp:49
ap_uint< 1 > tlast
Definition: axi_utils.hpp:50
ap_uint< D > tdata
Definition: axi_utils.hpp:48
NetworkMeta tdata
Definition: network.hpp:109
NodeId dst_rank
Definition: network.hpp:95
NodeId src_rank
Definition: network.hpp:97