Skip to content

Commit f91004d

Browse files
authored
Merge pull request #75 from MicrochipTech/fix_training4_shuran
hls driver function call updates for main.non-blocking.cpp in Training4
2 parents 6a35f32 + 79cc08c commit f91004d

File tree

1 file changed

+12
-4
lines changed
  • Training4/icicle-kit-reference-design/script_support/additional_configurations/smarthls/invert_and_threshold/main_variations

1 file changed

+12
-4
lines changed

Training4/icicle-kit-reference-design/script_support/additional_configurations/smarthls/invert_and_threshold/main_variations/main.non-blocking.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,34 @@ int main(int argc, char **argv) {
6161
bmp_pixel_t *OutBitMap1 = (bmp_pixel_t*)hls_malloc(HEIGHT * WIDTH * sizeof(bmp_pixel_t), HLS_ALLOC_NONCACHED);
6262
bmp_pixel_t *OutBitMap2 = (bmp_pixel_t*)hls_malloc(HEIGHT * WIDTH * sizeof(bmp_pixel_t), HLS_ALLOC_NONCACHED);
6363

64+
#ifdef HAS_ACCELERATOR
65+
void *invert_virt_addr = invert_setup();
66+
void *threshold_to_zero_virt_addr = threshold_to_zero_setup();
67+
#endif
6468
double t0 = timestamp();
6569
for(int i = 0; i < HEIGHT/N_ROWS; i++) {
6670
if (do_invert) {
6771
#ifdef HAS_ACCELERATOR
68-
invert_write_input_and_start((uint32_t *)&BitMap[i*WIDTH*N_ROWS]);
72+
invert_write_input_and_start((uint32_t *)&BitMap[i*WIDTH*N_ROWS], invert_virt_addr);
6973
#else
7074
invert((uint32_t *)&BitMap[i*WIDTH*N_ROWS], (uint32_t *)&OutBitMap1[i*WIDTH*N_ROWS]);
7175
#endif
7276
}
7377

7478
if (threshold > 0) {
7579
#ifdef HAS_ACCELERATOR
76-
threshold_to_zero_write_input_and_start((uint32_t *)&BitMap[i*WIDTH*N_ROWS], threshold);
80+
threshold_to_zero_write_input_and_start((uint32_t *)&BitMap[i*WIDTH*N_ROWS], threshold, threshold_to_zero_virt_addr);
7781
#else
7882
threshold_to_zero((uint32_t *)&BitMap[i*WIDTH*N_ROWS], (uint32_t *)&OutBitMap2[i*WIDTH*N_ROWS], threshold);
7983
#endif
8084
}
8185

8286
#ifdef HAS_ACCELERATOR
8387
if (do_invert)
84-
invert_join_and_read_output((uint32_t *)&OutBitMap1[i*WIDTH*N_ROWS]);
88+
invert_join_and_read_output((uint32_t *)&OutBitMap1[i*WIDTH*N_ROWS], invert_virt_addr);
8589

8690
if (threshold > 0)
87-
threshold_to_zero_join_and_read_output((uint32_t *)&OutBitMap2[i*WIDTH*N_ROWS]);
91+
threshold_to_zero_join_and_read_output((uint32_t *)&OutBitMap2[i*WIDTH*N_ROWS], threshold_to_zero_virt_addr);
8892
#endif
8993
}
9094
double t1 = timestamp();
@@ -95,6 +99,10 @@ int main(int argc, char **argv) {
9599
hls_free(OutBitMap1);
96100
hls_free(OutBitMap2);
97101
hls_free(BitMap);
102+
#ifdef HAS_ACCELERATOR
103+
invert_teardown();
104+
threshold_to_zero_teardown();
105+
#endif
98106
return 0;
99107
}
100108

0 commit comments

Comments
 (0)