cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mizan123
Contributor
Contributor
743 Views
Registered: ‎10-30-2018

Vision function implementation with axi stream support (pre synthesis failed)

This is the repost of my previous post as I am not getting any response. Any help would be really appreciated.

 

I am using Vitis HLS 2020.1.  I want to generate a simple IP to convert the color using Vitis vision library examples files and hence I modified them a little for AXI Stream-based input and output. There is no error showing when running the synthesis, but it stops within few seconds. I have tried enabling/disabling DATAFLOW pragma but didn't solve the problem. Here is my main code.

#include "xf_cvt_color_config_gen_vitis.h"
void cvtcolor_rgb2bgr(stream_t& stream_in, stream_t& stream_out) {

    #pragma HLS INTERFACE axis register both port = stream_in
    #pragma HLS INTERFACE axis register both port = stream_out
    #pragma HLS INTERFACE s_axilite  port=return

    xf::cv::Mat<XF_8UC3, HEIGHT, WIDTH, NPC1> _imgInput(HEIGHT, WIDTH);
    xf::cv::Mat<XF_8UC3, HEIGHT, WIDTH, NPC1> _imgOutput(HEIGHT, WIDTH);

    #pragma HLS DATAFLOW

    int AXIvideo2xfMat (hls::stream< ap_axiu<32*XF_NPPC8,1,1,1> >&  stream_in, xf::cv::Mat<XF_8UC3,HEIGHT, WIDTH, XF_NPPC8>& imgInput);
    xf::cv::rgb2bgr<XF_8UC3, XF_8UC3, HEIGHT, WIDTH, NPC1>(_imgInput, _imgOutput);
    int xfMat2AXIvideo  (xf::cv::Mat<XF_8UC3,HEIGHT, WIDTH, XF_NPPC8>& imgOutput, hls::stream< ap_axiu<32 * NPC1,1,1,1> >&  stream_out);}

 

Associated header file code

#ifndef _XF_CVT_COLOR_CONFIG_GEN_VITIS_H_
#define _XF_CVT_COLOR_CONFIG_GEN_VITIS_H_

#include "hls_stream.h"
#include "ap_int.h"
#include "xf_config_params.h"
#include "common/xf_common.hpp"
#include "common/xf_utility.hpp"
#include "imgproc/xf_cvt_color.hpp"
#include "imgproc/xf_cvt_color_1.hpp"

// Has to be set when synthesizing
#define _XF_SYNTHESIS_ 1

// Image Dimensions
static constexpr int WIDTH = 1920;
static constexpr int HEIGHT = 1080;

typedef ap_axiu<32 * XF_NPPC8,1,1,1> interface_t;
typedef hls::stream<interface_t> stream_t;
void cvtcolor_rgb2bgr(stream_t& stream_in, stream_t& stream_out);

#endif

Console output as below:

Starting C synthesis ...
C:/Xilinx/Vitis/2020.1/bin/vitis_hls.bat D:/VivadoHLS20/convertcolor/solution1/csynth.tcl
INFO: [HLS 200-10] Running 'C:/Xilinx/Vitis/2020.1/bin/unwrapped/win64.o/vitis_hls.exe'
INFO: [HLS 200-10] For user 'MIRA' on host 'blpc-entw1' (Windows NT_amd64 version 6.2) on Tue Jan 26 12:28:31 +0100 2021
INFO: [HLS 200-10] In directory 'D:/VivadoHLS20'
Sourcing Tcl script 'D:/VivadoHLS20/convertcolor/solution1/csynth.tcl'
INFO: [HLS 200-10] Opening project 'D:/VivadoHLS20/convertcolor'.
INFO: [HLS 200-10] Adding design file 'vision/L1/examples/cvtcolor/xf_cvt_color_accel_gen_vitis.cpp' to the project
INFO: [HLS 200-10] Opening solution 'D:/VivadoHLS20/convertcolor/solution1'.
INFO: [SYN 201-201] Setting up clock 'default' with a period of 10ns.
INFO: [HLS 200-10] Setting target device to 'xczu7ev-ffvc1156-2-e'
INFO: [HLS 200-1505] Using flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/html_docs/xilinx2020_1/hls-guidance/200-1505.html
INFO: [HLS 200-1464] Running solution command: config_export -display_name=rgbtobgr
INFO: [HLS 200-1464] Running solution command: config_export -format=ip_catalog
INFO: [HLS 200-1464] Running solution command: config_export -rtl=verilog
INFO: [HLS 200-10] Analyzing design file 'vision/L1/examples/cvtcolor/xf_cvt_color_accel_gen_vitis.cpp' ... 
WARNING: [HLS 207-5324] unused parameter 'index': D:/VivadoHLS20/vision/L1/include\common/xf_structs.hpp:667:87
WARNING: [HLS 207-5324] unused parameter 'index': D:/VivadoHLS20/vision/L1/include\common/xf_structs.hpp:687:60
WARNING: [HLS 207-5324] unused parameter 'index': D:/VivadoHLS20/vision/L1/include\common/xf_structs.hpp:1255:102
WARNING: [HLS 207-5324] unused parameter 'index': D:/VivadoHLS20/vision/L1/include\common/xf_structs.hpp:1565:34
INFO: [HLS 200-777] Using interface defaults for 'Vivado' target.
Pre-synthesis failed.
    while executing
"source D:/VivadoHLS20/convertcolor/solution1/csynth.tcl"
    invoked from within
"hls::main D:/VivadoHLS20/convertcolor/solution1/csynth.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 hls::main {*}$args"
    (procedure "hls_proc" line 5)
    invoked from within
"hls_proc $argv"
Finished C synthesis.
0 Kudos
9 Replies
dsakjl
Voyager
Voyager
726 Views
Registered: ‎07-20-2018

Hi @mizan123 ,

Are you declaring the functions AXIvideo2xfMat()/xfMat2AXIvideo() in main? Or are you trying to call them?

Regards.

0 Kudos
mizan123
Contributor
Contributor
716 Views
Registered: ‎10-30-2018

Those are vision library functions, associated libraries are declared in header file. 

0 Kudos
dsakjl
Voyager
Voyager
702 Views
Registered: ‎07-20-2018

@mizan123, OK. But are you trying to call that functions?

0 Kudos
mizan123
Contributor
Contributor
695 Views
Registered: ‎10-30-2018

Yes, is it wrong format or what? I don't understand what are you implying over calling the function.

0 Kudos
dsakjl
Voyager
Voyager
689 Views
Registered: ‎07-20-2018

Hi @mizan123 ,

you're not invoking functions that way, just declaring.

To call that functions:

int ret;

ret = AXIvideo2xfMat(stream_in, imgInput);

ret = xfMat2AXIvideo(imgOutput, stream_out);

And you should check ret for errors.

Regards.

 

0 Kudos
mizan123
Contributor
Contributor
676 Views
Registered: ‎10-30-2018

The function is working okay. The simulation is working okay. Only synthesis is failing. 

0 Kudos
dsakjl
Voyager
Voyager
651 Views
Registered: ‎07-20-2018

Can you share your test bench?

0 Kudos
praseetha
Visitor
Visitor
375 Views
Registered: ‎02-05-2021

Hi @dsakjl ,

I am facing a similar issue too on vitis HLS.

This is my .h file

#ifndef _LOOP_PIPELINE_H_
#define _LOOP_PIPELINE_H_
#include <iostream>
#include <fstream>
using namespace std;
#include "hls_stream.h"
#include "ap_int.h"
#define DIM 7
#define DIM01 100
#define DIM02 100

#include <iostream>
#include <fstream>
using namespace std;

 

void loop_pipeline(int N,int rowss[DIM01], int coll[DIM01], int vall[DIM01],int irad[100][100]);

#endif

 

I need to use loop unroll on two of my nested loops. 

When i use it..

l_1: for( y = 0; y <100; y ++)

{
#pragma HLS UNROLL

l_2:for( x = 0; x <100; x++)


{
#pragma HLS UNROLL

I get the following errors: 

while executing
"source C:/Users/WS2-Praseetha/Pictures/loop_pipeline2/loop_pipeline/solution1/csynth.tcl"
invoked from within

0 Kudos
mizan123
Contributor
Contributor
290 Views
Registered: ‎10-30-2018

@praseetha My problem was solved using Vivado HLS 2020.1, which should be started from the command line. Vitis HLS 2020.1 has some other bugs along with the mentioned one here for AXI stream support.

Of course, you need to take care of library code errors if you want to use vision library in Vivado HLS (there were many errors depending on which function you want to use.)

Besides this solution to my problem, I don't think your error is similar to mine.

0 Kudos