UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Newbie omarhommos
Newbie
8,334 Views
Registered: ‎04-02-2016

Synthesis failed, image resize oepration

 

Hey all,

 

So i'm doign a design that applies several morphological operations to an image. The operations include an image resize (from 720*960 to 640*480).

The code get synthesised perfectly without applying the dataflow directive.

When the dataflow directive is applied, the synthesis gets aborted and the console shows the following: 

 

@I [XFORM-712] Applying dataflow to function 'image_filter' (top.cpp:18), detected/extracted 18 process function(s):
'Block_Mat.exit18056_proc'
'hls::AXIvideo2Mat<32, 720, 960, 32>1'
'hls::Resize<32, 720, 960, 480, 640>1'
'hls::CvtColor<HLS_BGR2GRAY, 32, 0, 480, 640>'
'hls::Duplicate<480, 640, 0, 0>'
'Loop_1_proc'
'Loop_loop_height_proc'
'Loop_3_proc'
'Loop_loop_height_proc253'
'hls::AbsDiff<480, 640, 0, 0, 0>'
'hls::Threshold<480, 640, 0, 0>'
'hls::Erode<0, 0, 480, 640>'
'hls::Dilate<0, 0, 480, 640>'
'Loop_5_proc'
'Loop_loop_height_proc352'
'Loop_7_proc'
'Loop_loop_height_proc400'
'hls::Mat2AXIvideo<32, 480, 640, 0>'.
function-local metadata used in wrong function
metadata !{[640 x i8]* %"k_buf[0].val[0]"}
%"k_buf[0].val[0]" = alloca [640 x i8], align 1
Broken module found, compilation aborted!

 

When i remove the image resize operation from my code (keep images in the original resolution), the synthesis runs perfectly.

I've tried running an example project and the synthesis worked perfectly, so i guess it's not a problem with my version of Vivado.

Any idea on what may have caused this synthesis error? it might be a trivial error in the code that my eyes missed.

 

#include "top.h"

void image_filter(AXI_STREAM& INPUT_STREAM, AXI_STREAM& OUTPUT_STREAM, int rows,
int cols) {

 

//Create AXI streaming interfaces for the core
#pragma HLS INTERFACE axis port=INPUT_STREAM bundle=INPUT_STREAM
#pragma HLS INTERFACE axis port=OUTPUT_STREAM bundle=OUTPUT_STREAM

#pragma HLS INTERFACE s_axilite port=rows bundle=CONTROL_BUS offset=0x14
#pragma HLS INTERFACE s_axilite port=cols bundle=CONTROL_BUS offset=0x1C

#pragma HLS INTERFACE s_axilite port=return bundle=CONTROL_BUS

#pragma HLS INTERFACE ap_stable port=rows
#pragma HLS INTERFACE ap_stable port=cols

 

//Processing code section

//constants definition
int rows1 = 480;
int cols1 = 640;

 

// Morphological Operations structural elements, no SE2 because it's similar to default SE
hls::Window<3, 30, unsigned char> SE1;
hls::Window<3, 13, unsigned char> SE3;

 

// image matrices initialization
hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3> _src(rows, cols); //src
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC3> resized(rows1, cols1); //resized image
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> gray(rows1, cols1); //grayscale image
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> grayCopy1(rows1, cols1); //resized image
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> grayCopy2(rows1, cols1); //resized image
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> eroded1(rows1, cols1); //eroded image, first imopen
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> dilated1(rows1, cols1); //dilated image, first imopen
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> enhanced(rows1, cols1); //enhanced
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> binarized(rows1, cols1); //binarized
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> eroded2(rows1, cols1); //eroded image, second imopen
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> dilated2(rows1, cols1); //dilated image, second imopen
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> dilated3(rows1, cols1); //dilated image, imclose
hls::Mat<MAX_HEIGHT1, MAX_WIDTH1, HLS_8UC1> _dst(rows1, cols1); //dst

 

//Optimization directives
#pragma HLS dataflow
#pragma HLS stream variable=grayCopy2.data_stream depth=4000 //each of Erode and Dilate incur 3 lines of delay. 640*(3+3)<4000

 

// image processes
hls::AXIvideo2Mat(INPUT_STREAM, _src);

hls::Resize(_src, resized);
hls::CvtColor<HLS_BGR2GRAY>(resized, gray); //grayscale conversion
hls::Duplicate(gray, grayCopy1, grayCopy2);
hls::Erode<hls::MORPH_RECT, 1>(grayCopy1, eroded1, SE1); //1st imopen
hls::Dilate<hls::MORPH_RECT, 1>(eroded1, dilated1, SE1);
hls::AbsDiff(grayCopy2, dilated1, enhanced);
hls::Threshold(enhanced, binarized, 60, 255, HLS_THRESH_BINARY);
hls::Erode(binarized, eroded2); //2nd imopen
hls::Dilate(eroded2, dilated2);
hls::Dilate<hls::MORPH_RECT, 1>(dilated2, dilated3, SE3); //imclose
hls::Erode<hls::MORPH_RECT, 1>(dilated3, _dst, SE3);

hls::Mat2AXIvideo(_dst, OUTPUT_STREAM);

}

 

0 Kudos