cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
roymeijer2503
Visitor
Visitor
173 Views
Registered: ‎03-29-2021

Unable to enforce a carried dependence constrain... & Unable to schedule 'load' operation...

I'm trying to make a box filter IP using Vivado HLS, and it contains a line buffer which can store 5 lines of pixels (5 lines, 640 pixels, 8 bits per pixel). However, when I do the C Synthesis, I get the following warnings:

WARNING: [SCHED 204-68] Unable to enforce a carried dependence constraint (II = 1, distance = 1, offset = 1)
   between 'load' operation ('line_buffer_0_load', ../../../source/ip/video_boxfilter/source/main.cpp:82) on array 'line_buffer[0]', ../../../source/ip/video_boxfilter/source/main.cpp:41 and 'store' operation (../../../source/ip/video_boxfilter/source/main.cpp:69) of variable 'tmp.data.V', ../../../source/ip/video_boxfilter/source/main.cpp:67 on array 'line_buffer[0]', ../../../source/ip/video_boxfilter/source/main.cpp:41.
WARNING: [SCHED 2] c 04-69('line_buffer_0_load', ../../../source/ip/video_boxfilter/source/main.cpp:82) on array 'line_buffer[0]', ../../../source/ip/video_boxfilter/source/main.cpp:41 due to limited memory ports. Please consider using a memory core with more ports or partitioning the array 'line_buffer_0'.

The C Synthesis does complete, but it gets stuck during the C/RTL Cosimulation, and I think this is the reason. What am I doing wrong?

 

This is what my function looks like:

void video_boxfilter(t_stream & frame_in, uint16_t rows, uint16_t cols, t_stream & frame_out) {
	#pragma HLS INTERFACE axis port=frame_in
	#pragma HLS INTERFACE s_axilite port=rows bundle=config
	#pragma HLS INTERFACE s_axilite port=cols bundle=config
	#pragma HLS INTERFACE s_axilite port=return bundle=config
	#pragma HLS INTERFACE axis port=frame_out

	#pragma HLS DATAFLOW

	uint8_t line_buffer [5][WIDTH];
	int16_t index [2] = {0, 0};

	#pragma HLS array_partition variable=line_buffer dim=1 complete
	#pragma HLS array_partition variable=index complete

	uint16_t row_idx = 0;

	uint8_t pixel_in;
	t_sample pixel_out;
	uint8_t pixel_box [5][5];

	#pragma HLS array_partition variable=pixel_box dim=2 complete
	bool done = false;
	while(done == false) {

	#pragma HLS LOOP_FLATTEN OFF
	#pragma HLS PIPELINE

		if (row_idx < rows + 5) {

			uint16_t temp_idx_1 = index[1];
			uint16_t temp_idx_0 = index[0];

			//read new pixel if not all pixels have been read
			if (row_idx < rows) {
				pixel_in = frame_in.read().data;
				line_buffer [temp_idx_0][temp_idx_1] = pixel_in;
			}

			//if line buffer is filled
			if (row_idx >= 5) {
				uint16_t sum = 0;
				//store buffer value in pixelbox, compute average pixel
				for (uint8_t i = 0; i < 5; i++) {
					for (uint8_t j = 0; j < 5; j++) {
						#pragma HLS UNROLL
						int16_t col_idx_pb = (temp_idx_1 + j - 5 < cols && temp_idx_1 + j - 5 > 0 ? temp_idx_1 + j - 5 : temp_idx_1);
						assert(col_idx_pb >= 0 && col_idx_pb < cols);
						uint8_t temp_lb = line_buffer[i][col_idx_pb];
						pixel_box[i][j] = temp_lb;
						sum += (uint16_t)(pixel_box[i][j]);
					}
				}
				//store result
				pixel_out.data = (uint8_t)(sum/25);
				pixel_out.last = index[1] >= cols - 1;
				pixel_out.user = (row_idx == 5) && (index[1] == 0);

				//write result to output
				frame_out.write(pixel_out);
			}

			//update line buffer index
			if 	(temp_idx_1 >= cols - 1) {
				index[1] = 0;
				if (temp_idx_0 >= 5 - 1) {
					index[0] = 0;
				} else {
					index[0] = temp_idx_0 + 1;
				}
				row_idx++;
			} else {
				index[1] = temp_idx_1 + 1;
			}
		} else {
			row_idx = 0;
			done = true;
		}
	}
}

 

Thank you and regards

0 Kudos
0 Replies