cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
test_harris.cpp
Go to the documentation of this file.
1 
17 
36 #include "../include/harris.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_harris ("image_stream_from_harris");
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  harris(
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 HARRIS
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  uint16_t Thresh; // Threshold for HLS
214  float Th;
215  if (FILTER_WIDTH == 3) {
216  Th = 30532960.00;
217  Thresh = 442;
218  } else if (FILTER_WIDTH == 5) {
219  Th = 902753878016.0;
220  Thresh = 3109;
221  } else if (FILTER_WIDTH == 7) {
222  Th = 41151168289701888.000000;
223  Thresh = 566;
224  }
225 
226 
227  //------------------------------------------------------
228  //-- STEP-1.1 : CREATE MEMORY FOR OUTPUT IMAGES
229  //------------------------------------------------------
230  // cvtColor(in_img, img_gray, CV_BGR2GRAY);
231  // Convert rgb into grayscale
232  hls_out_img.create(in_img.rows, in_img.cols, CV_8U); // create memory for hls output image
233  ocv_out_img.create(in_img.rows, in_img.cols, CV_8U); // create memory for opencv output image
234 
235  #if NO
236  static xf::cv::Mat<IN_TYPE, HEIGHT, WIDTH, XF_NPPC1> imgInput(in_img.rows, in_img.cols);
237  static xf::cv::Mat<IN_TYPE, HEIGHT, WIDTH, XF_NPPC1> imgOutput(in_img.rows, in_img.cols);
238  static xf::cv::Mat<IN_TYPE, HEIGHT, WIDTH, XF_NPPC1> imgOutputTb(in_img.rows, in_img.cols);
239  imgInput.copyTo(in_img.data);
240  // imgInput = xf::cv::imread<IN_TYPE, HEIGHT, WIDTH, XF_NPPC1>(argv[1], 0);
241  ap_uint<INPUT_PTR_WIDTH> *imgInputArray = (ap_uint<INPUT_PTR_WIDTH>*) malloc(in_img.rows * in_img.cols * sizeof(ap_uint<INPUT_PTR_WIDTH>));
242  ap_uint<OUTPUT_PTR_WIDTH> *imgOutputArrayTb = (ap_uint<OUTPUT_PTR_WIDTH>*) malloc(in_img.rows * in_img.cols * sizeof(ap_uint<OUTPUT_PTR_WIDTH>));
243  ap_uint<OUTPUT_PTR_WIDTH> *imgOutputArray = (ap_uint<OUTPUT_PTR_WIDTH>*) malloc(in_img.rows * in_img.cols * sizeof(ap_uint<OUTPUT_PTR_WIDTH>));
244  xf::cv::xfMat2Array<INPUT_PTR_WIDTH, IN_TYPE, HEIGHT, WIDTH, NPIX>(imgInput, imgInputArray);
245  #endif
246 
247  #if RO
248  static xf::cv::Mat<IN_TYPE, HEIGHT, WIDTH, XF_NPPC8> imgInput(in_img.rows, in_img.cols);
249  static xf::cv::Mat<IN_TYPE, HEIGHT, WIDTH, XF_NPPC8> imgOutput(in_img.rows, in_img.cols);
250  static xf::cv::Mat<IN_TYPE, HEIGHT, WIDTH, XF_NPPC1> imgOutputTb(in_img.rows, in_img.cols);
251  #endif
252 
253  while (tb_trials++ < TB_TRIALS) {
254 
255 
256  printf ( "##################################################### \n" );
257  printf ( "## TESTBENCH #%u STARTS HERE ##\n", tb_trials );
258  printf ( "##################################################### \n" );
259 
260 
261  simCnt = 0;
262  nrErr = 0;
263 
264 #if NO
265  if ( !dumpImgToFile ( imgInput, "ifsSHL_Uaf_Data.dat", simCnt ) ) {
266  nrErr++;
267  }
268 #endif
269 
270 #if RO
271  // imgInput.copyTo(img_gray.data);
272  imgInput = xf::cv::imread<IN_TYPE, HEIGHT, WIDTH, XF_NPPC8> ( argv[1], 0 );
273 #endif
274 
275 
276 
277  //------------------------------------------------------
278  //-- STEP-1.2 : RUN HARRIS DETECTOR FROM OpenCV LIBRARY
279  //------------------------------------------------------
280  ocv_ref ( in_img, ocv_out_img, Th );
281 
282 
283 
284  //------------------------------------------------------
285  //-- STEP-2.1 : CREATE TRAFFIC AS INPUT STREAMS
286  //------------------------------------------------------
287  if ( nrErr == 0 ) {
288  if ( !setInputDataStream ( sSHL_Uaf_Data, "sSHL_Uaf_Data", "ifsSHL_Uaf_Data.dat", simCnt ) ) {
289  printf ( "### ERROR : Failed to set input data stream \"sSHL_Uaf_Data\". \n" );
290  nrErr++;
291  }
292 
293  //there are TOT_TRANSFERS streams from the the App to the Role
295  for ( int i=0; i<TOT_TRANSFERS; i++ ) {
296  siUdp_meta.write ( NetworkMetaStream ( tmp_meta ) );
297  }
298  //set correct node_rank and cluster_size
299  node_rank = 1;
300  cluster_size = 2;
301  }
302 
303  //------------------------------------------------------
304  //-- STEP-2.2 : SET THE PASS-THROUGH MODE
305  //------------------------------------------------------
306  //piSHL_This_MmioEchoCtrl.write(ECHO_PATH_THRU);
307  //[TODO] piSHL_This_MmioPostPktEn.write(DISABLED);
308  //[TODO] piSHL_This_MmioCaptPktEn.write(DISABLED);
309 
310  //------------------------------------------------------
311  //-- STEP-3 : MAIN TRAFFIC LOOP
312  //------------------------------------------------------
313  while ( !nrErr ) {
314 
315  // Keep enough simulation time for sequntially executing the FSMs of the main 3 functions
316  // (Rx-Proc-Tx)
318 #ifdef ENABLE_DDR
321 #endif
322 #endif
323  ) {
324  stepDut();
325 
326  if ( simCnt > 2 ) {
327  assert ( s_udp_rx_ports == PORTS_OPENED );
328  }
329 
330 if (simCnt < 0)
331  exit(0);
332 #ifdef ENABLE_DDR
333 
334  if ( !sROL_Shl_Mem_WrCmdP0.empty() ) {
335  printf ( "DEBUG tb: Read a memory write command from SHELL/Mem/Mp0 \n" );
336  //-- Read a memory write command from SHELL/Mem/Mp0
337  sROL_Shl_Mem_WrCmdP0.read ( dmCmd_MemCmdP0 );
338  //assert ( dmCmd_MemCmdP0.bbt == CHECK_CHUNK_SIZE );
339  assert ( dmCmd_MemCmdP0.type == 1 && dmCmd_MemCmdP0.dsa == 0 && dmCmd_MemCmdP0.eof == 1 && dmCmd_MemCmdP0.drr == 1 && dmCmd_MemCmdP0.tag == 0x0 );
340  ddr_addr_in = (unsigned int)dmCmd_MemCmdP0.saddr / BPERMDW_512; // Convert the byte-aligned address to local mem of stack tb.
341  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);
342  assert (ddr_addr_in <= MEMORY_LINES_512-1);
343  //ddr_write_req_iter++;
344  //printf ( "DEBUG tb: (ddr_write_req_iter)%(MEMORY_LINES_512-1)=%u\n", (ddr_write_req_iter)%(MEMORY_LINES_512-1));
345  if ((++ddr_write_req_iter)%(MEMORY_LINES_512) == 0) {
346  ddr_write_req_iter = 0;
347  }
348  printf ( "DEBUG tb: ddr_write_req_iter=%u\n", ddr_write_req_iter);
349 
350 #ifdef ENABLE_DDR_EMULATE_DELAY_IN_TB
351  /*
352  * 16 -> emulate a response in 16 cycles
353  * 1 -> emulate immediate response
354  * CYCLES_UNTIL_TIMEOUT -> on purpose timeout
355  */
356  if (ddr_write_req_iter == 1) {
357  wait_cycles_to_ack_ddr_status = TYPICAL_DDR_LATENCY;
358  }
359  else if (ddr_write_req_iter == 2) {
360  wait_cycles_to_ack_ddr_status = TYPICAL_DDR_LATENCY;
361  }
362  else {
363  wait_cycles_to_ack_ddr_status = TYPICAL_DDR_LATENCY;
364  }
365  if (!sSHL_Rol_Mem_WrStsP0.empty()) {
366  printf("WARNING: Emptying sSHL_Rol_Mem_WrStsP0 fifo.\n");
367  dmSts_MemWrStsP0 = sSHL_Rol_Mem_WrStsP0.read();
368  }
369 #else
370  wait_cycles_to_ack_ddr_status = 0;
371 #endif
372  count_cycles_to_ack_ddr_status = 0;
373  ddr_write_sts_req = false;
374  }
375 
376  if ( !sROL_Shl_Mem_WriteP0.empty() ) {
377  sROL_Shl_Mem_WriteP0.read ( memP0 );
378  printf ( "DEBUG tb: Write a memory line from SHELL/Mem/Mp0 \n" );
379 
380  assert ( memP0.tkeep == 0xffffffffffffffff );
381 
382  /* Read from AXI stream DDR interface and write to the memory mapped interface of
383  * DDR channel P0. In the real HW, this is enabled by the AXI interconnect and AXI
384  * Datamover, being instantiated in VHDL.
385  * */
386  printf ( "DEBUG tb: Writting to address 0x%x : %u an amount of %u bytes\n", ddr_addr_in, memP0.tdata.to_long(), BPERMDW_512);
387  //lcl_mem0[ddr_addr_in++] = memP0.tdata;
388  memcpy(&lcl_mem0[ddr_addr_in++], &memP0.tdata, BPERMDW_512);
389  ddr_write_sts_req = true;
390  }
391  // When we have emulated the writting to lcl_mem0, we acknowledge with a P0 status
392  if ((ddr_write_sts_req == true) && !sSHL_Rol_Mem_WrStsP0.full() && (memP0.tlast == true)) {
393  if (count_cycles_to_ack_ddr_status++ == wait_cycles_to_ack_ddr_status) {
394  dmSts_MemWrStsP0.tag = 7;
395  dmSts_MemWrStsP0.okay = 1;
396  dmSts_MemWrStsP0.interr = 0;
397  dmSts_MemWrStsP0.slverr = 0;
398  dmSts_MemWrStsP0.decerr = 0;
399  printf ( "DEBUG tb: Write a memory status command to SHELL/Mem/Mp0 \n" );
400  sSHL_Rol_Mem_WrStsP0.write ( dmSts_MemWrStsP0 );
401  ddr_write_sts_req = false;
402  }
403  else{
404  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);
405  }
406  }
407 
408 
409 
410 #endif // ENABLE_DDR
411 
412 
413  //if( !soUdp_meta.empty())
414  //{
415  // NetworkMetaStream tmp_meta = soUdp_meta.read();
416  // printf("NRC received NRCmeta stream from node_rank %d.\n", (int) tmp_meta.tdata.src_rank);
417  //}
418 
419 
420  } else {
421 #ifdef ENABLE_DDR
422  if (!sSHL_Rol_Mem_WrStsP0.empty()) {
423  printf("WARNING: Emptying sSHL_Rol_Mem_WrStsP0 fifo.\n");
424  dmSts_MemWrStsP0 = sSHL_Rol_Mem_WrStsP0.read();
425  }
426 #endif
427  printf ( "## End of simulation at cycle=%3d. \n", simCnt );
428  break;
429  }
430 
431  } // End: while()
432 
433  //-------------------------------------------------------
434  //-- STEP-4 : DRAIN AND WRITE OUTPUT FILE STREAMS
435  //-------------------------------------------------------
436  //---- UAF-->SHELL Data ----
437  if ( !getOutputDataStream ( sUAF_Shl_Data, "sUAF_Shl_Data", "ofsUAF_Shl_Data.dat", simCnt ) ) {
438  nrErr++;
439  }
440  //---- UAF-->SHELL META ----
441  if ( !soUdp_meta.empty() ) {
442  int i = 0;
443  while ( !soUdp_meta.empty() ) {
444  i++;
445  NetworkMetaStream tmp_meta = soUdp_meta.read();
446  printf ( "NRC received NRCmeta stream from rank %d to rank %d.\n", ( int ) tmp_meta.tdata.src_rank, ( int ) tmp_meta.tdata.dst_rank );
447  assert ( tmp_meta.tdata.src_rank == node_rank );
448  //ensure forwarding behavior
449  assert ( tmp_meta.tdata.dst_rank == ( ( tmp_meta.tdata.src_rank + 1 ) % cluster_size ) );
450  }
451  //printf("DEBUG: i=%u\tTOT_TRANSFERS=%u\n", i, TOT_TRANSFERS);
452  assert ( i == TOT_TRANSFERS );
453  } else {
454  printf ( "Error No metadata received...\n" );
455  nrErr++;
456  }
457 
458  //-------------------------------------------------------
459  //-- STEP-5 : FROM THE OUTPUT FILE CREATE AN ARRAY
460  //-------------------------------------------------------
461  if ( !setInputFileToArray ( "ofsUAF_Shl_Data.dat", imgOutputArray, simCnt ) ) {
462  printf ( "### ERROR : Failed to set input array from file \"ofsUAF_Shl_Data.dat\". \n" );
463  nrErr++;
464  }
465  xf::cv::Array2xfMat<OUTPUT_PTR_WIDTH, OUT_TYPE, HEIGHT, WIDTH, NPIX> ( imgOutputArray, imgOutput );
466 
467 
468  //------------------------------------------------------
469  //-- STEP-6 : COMPARE INPUT AND OUTPUT FILE STREAMS
470  //------------------------------------------------------
471  int rc1 = system ( "diff --brief -w -i -y ../../../../test/ofsUAF_Shl_Data.dat \
472  ../../../../test/verify_UAF_Shl_Data.dat" );
473  if ( rc1 ) {
474  printf ( "## Error : File \'ofsUAF_Shl_Data.dat\' does not match \'verify_UAF_Shl_Data.dat\'.\n" );
475  } else {
476  printf ( "Output data in file \'ofsUAF_Shl_Data.dat\' verified.\n" );
477  }
478 
479  nrErr += rc1;
480 
481  printf ( "#####################################################\n" );
482  if ( nrErr ) {
483  printf ( "## ERROR - TESTBENCH #%u FAILED (RC=%d) !!! ##\n", tb_trials, nrErr );
484  } else {
485  printf ( "## SUCCESSFULL END OF TESTBENCH #%u (RC=0) ##\n", tb_trials );
486  }
487  printf ( "#####################################################\n" );
488 
489 
490 
491 
492 
493  } // End tb trials while loop
494 
495 
496 
497 
498 
499 
500 
501 
502  float K = 0.04;
503  uint16_t k = K * (1 << 16); // Convert to Q0.16 format
504 
505  #if NO
506 
507  // L2 Vitis Harris
508  cornerHarrisAccelArray(imgInputArray, imgOutputArrayTb, in_img.rows, in_img.cols, Thresh, k);
509  xf::cv::Array2xfMat<OUTPUT_PTR_WIDTH, OUT_TYPE, HEIGHT, WIDTH, NPIX>(imgOutputArrayTb, imgOutputTb);
510 
511  // L1 Vitis Harris
512  //harris_accel(imgInput, imgOutput, Thresh, k);
513 
514  #endif
515 
516  #if RO
517 
518  harris_accel(imgInput, imgOutputTb, Thresh, k);
519 
520  #endif
521 
523  xf::cv::imwrite("hls_out_tb.jpg", imgOutputTb);
524  xf::cv::imwrite("hls_out.jpg", imgOutput);
525 
526  unsigned int val;
527  unsigned short int row, col;
528 
529  cv::Mat out_img;
530  out_img = in_img.clone();
531 
532  std::vector<cv::Point> hls_points;
533  std::vector<cv::Point> ocv_points;
534  std::vector<cv::Point> common_pts;
535 
536  xf::cv::Mat<OUT_TYPE, HEIGHT, WIDTH, NPIX>* select_imgOutput;
537 
538  // Select which output you want to process for image outputs and corners comparisons:
539  // &imgOutput : The processed image by Harris IP inside the ROLE (i.e. I/O traffic is passing through SHELL)
540  // &imgOutputTb : The processed image by Harris IP in this testbench (i.e. I/O traffic is done in testbench)
541  select_imgOutput = &imgOutput;
542 
543  // Mark HLS points on the image
544  markPointsOnImage(*select_imgOutput, in_img, out_img, hls_points);
545 
546  // Write HLS and Opencv corners into a file
547  //nrErr +=
548  writeCornersIntoFile(in_img, ocv_out_img, out_img, hls_points, ocv_points, common_pts);
549 
550  // Clear memory
551  free(imgOutputArrayTb);
552  free(imgOutputArray);
553  free(imgInputArray);
554 
555 
556  return(nrErr);
557 }
558 
559 
560 
561 
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
#define FILTER_WIDTH
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
void markPointsOnImage(Mat &imgOutput, Mat &in_img, Mat &out_img, vector< Point > &hw_points)
Mark the points found by Gammacorrection into the image.
#define FRAME_WIDTH
Definition: config.h:46
void harris(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 Harris Application directives.
Definition: harris.cpp:918
#define BPERMDW_512
Definition: harris.hpp:120
#define PORTS_OPENED
Definition: harris.hpp:102
#define TB_TRIALS
Definition: test_harris.cpp:66
stream< NetworkMetaStream > siUdp_meta("siUdp_meta")
int main(int argc, char **argv)
Main testbench of Hrris.
stream< NetworkMetaStream > soUdp_meta("soUdp_meta")
int simCnt
ap_uint< 1 > piSHL_This_MmioCaptPktEn
Definition: test_harris.cpp:82
ap_uint< 1 > piSHL_This_MmioPostPktEn
Definition: test_harris.cpp:81
stream< UdpWord > sUAF_Shl_Data("sUAF_Shl_Data")
stream< UdpWord > image_stream_from_harris("image_stream_from_harris")
void stepDut()
Run a single iteration of the DUT model.
stream< UdpWord > sSHL_Uaf_Data("sSHL_Uaf_Data")
#define ENABLE_DDR_EMULATE_DELAY_IN_TB
Definition: test_harris.cpp:69
ap_uint< 32 > cluster_size
Definition: test_harris.cpp:93
ap_uint< 32 > s_udp_rx_ports
Definition: test_harris.cpp:89
ap_uint< 32 > node_rank
Definition: test_harris.cpp:92
void harris_accel(xf::cv::Mat< XF_8UC1, 16, 16, XF_NPPC1 > &_src, xf::cv::Mat< XF_8UC1, 16, 16, XF_NPPC1 > &_dst, unsigned short Thresh, unsigned short k)
Top-level accelerated function of the Harris Application with xf::cv I/F.
void cornerHarrisAccelArray(ap_uint< 8 > *img_inp, ap_uint< 64 > *img_out, int rows, int cols, int threshold, int k)
Top-level accelerated function of the Harris Application with array I/F.
#define MIN_TX_LOOPS
#define MIN_RX_LOOPS
#define TOT_TRANSFERS
Definition: config.h:70
stream< DmSts > sSHL_Rol_Mem_RdStsP0("sSHL_Rol_Mem_RdStsP0")
stream< Axis< 512 > > sSHL_Rol_Mem_ReadP0("sSHL_Rol_Mem_ReadP0")
stream< Axis< 512 > > sROL_Shl_Mem_WriteP0("sROL_Shl_Mem_WriteP0")
stream< DmCmd > sROL_Shl_Mem_WrCmdP0("sROL_Shl_Mem_WrCmdP0")
stream< DmCmd > sROL_Shl_Mem_RdCmdP0("sROL_Shl_Mem_RdCmdP0")
stream< DmSts > sSHL_Rol_Mem_WrStsP0("sSHL_Rol_Mem_WrStsP0")
#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
membus_t lcl_mem0[16384]
membus_t lcl_mem1[16384]
#define MEMORY_LINES_512
#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
unsigned int writeCornersIntoFile(cv::Mat &in_img, cv::Mat &ocv_out_img, cv::Mat &out_img, std::vector< cv::Point > &hls_points, std::vector< cv::Point > &ocv_points, std::vector< cv::Point > &common_pts)
Write the corners found by Harris into a file.
Definition: common.cpp:437
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