cancel
Showing results for 
Search instead for 
Did you mean: 
446 Views
Registered: ‎08-21-2018

hls co-simulation

Jump to solution

Hello, I am using co-simulation with hls. The following warning message will cause the simulation results to not appear.

WARNING: Hls::stream 'hls::stream<ap_axiu<8, 1, 1, 1> >.2' is read while empty, which may result in RTL simulation hanging. 

But code synthesis can pass.Below is my top level function, and the test code. Can you help me find out how to solve it?

void ImgPre_L(AXIS8 &vid_inL, AXIS8 &vid_outL, int rows, int cols){

#pragma HLS INTERFACE axis register both port=vid_inL
#pragma HLS INTERFACE axis register both port=vid_outL
#pragma HLS INTERFACE s_axilite port=return
#pragma HLS INTERFACE s_axilite port=rows
#pragma HLS INTERFACE s_axilite port=cols
hls::Window<3, 3, ap_fixed<32,12> > PAR_L_CAMM;
hls::Window<3, 3, ap_fixed<32,2> > PAR_L_RM;

PAR_L_CAMM.val[0][0] = PAR_L_CAMM_RAW[0];
PAR_L_CAMM.val[0][1] = PAR_L_CAMM_RAW[1];
PAR_L_CAMM.val[0][2] = PAR_L_CAMM_RAW[2];
PAR_L_CAMM.val[1][0] = PAR_L_CAMM_RAW[3];
PAR_L_CAMM.val[1][1] = PAR_L_CAMM_RAW[4];
PAR_L_CAMM.val[1][2] = PAR_L_CAMM_RAW[5];
PAR_L_CAMM.val[2][0] = PAR_L_CAMM_RAW[6];
PAR_L_CAMM.val[2][1] = PAR_L_CAMM_RAW[7];
PAR_L_CAMM.val[2][2] = PAR_L_CAMM_RAW[8];

hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_16SC2> hmap1L(rows, cols);
hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_16UC2> hmap2L(rows, cols);


IMG_GRAY imgL_in(rows, cols);
IMG_GRAY imgR_in(rows, cols);
IMG_GRAY imgL_rmap(rows, cols);
IMG_GRAY img_erode(rows, cols);
IMG_GRAY img_dilate(rows, cols);

#pragma HLS DATAFLOW

hls::AXIvideo2Mat(vid_inL, imgL_in);

hls::InitUndistortRectifyMapInverse(PAR_L_CAMM, PAR_L_DISTC, PAR_L_CAMM, hmap1L, hmap2L);
hls::Remap<16>(imgL_in, imgL_rmap, hmap1L, hmap2L, HLS_INTER_LINEAR);
hls::Erode(imgL_rmap, img_erode);
hls::Dilate(img_erode, img_dilate);

hls::Mat2AXIvideo(img_dilate, vid_outL);

return;
}

#define INPUT_IMAGE_L "left.bmp"
#define OUTPUT_IMAGE "result.bmp"

using namespace std;
using namespace cv;

int main (int argc, char** argv) {
// Load data in OpenCV image format
IplImage* srcl = cvLoadImage(INPUT_IMAGE_L, CV_LOAD_IMAGE_GRAYSCALE);
IplImage* dst = cvCreateImage(cvGetSize(srcl), IPL_DEPTH_8U, 1);
cvShowImage("hls_src", srcl);


AXIS8 srcl_axi;
AXIS8 dst_axi;

// Convert OpenCV format to AXI4 Stream format
IplImage2AXIvideo(srcl, srcl_axi);

ImgPre_L(srcl_axi, dst_axi, 640, 480);

AXIvideo2IplImage(dst_axi, dst);
cvShowImage("hls_dst", dst);
waitKey(0);
return 0;
}

 
Thank you
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Xilinx Employee
Xilinx Employee
414 Views
Registered: ‎09-05-2018

Re: hls co-simulation

Jump to solution

Hey @zhang842709698,

You can try to narrow down your issue by running C Simulation with the 'Debug' option checked. Step through the code to see when the warning is issued.

Also, we recommend the xfOpenCV library; the HLS Video OpenCV API's are deprecated.

Nicholas Moellers

Xilinx Worldwide Technical Support

View solution in original post

0 Kudos
2 Replies
Highlighted
Xilinx Employee
Xilinx Employee
415 Views
Registered: ‎09-05-2018

Re: hls co-simulation

Jump to solution

Hey @zhang842709698,

You can try to narrow down your issue by running C Simulation with the 'Debug' option checked. Step through the code to see when the warning is issued.

Also, we recommend the xfOpenCV library; the HLS Video OpenCV API's are deprecated.

Nicholas Moellers

Xilinx Worldwide Technical Support

View solution in original post

0 Kudos
Highlighted
Moderator
Moderator
346 Views
Registered: ‎11-21-2018

Re: hls co-simulation

Jump to solution

Hi @zhang842709698 

If your question is answered or your issue is solved, please kindly mark the response which helped as solution (click on "Accept as solution" button below the reply)

 

If this is not solved/answered, please reply in the topic giving more information on your current status.

 

Thanks and Regards,

Aoife
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**
0 Kudos