取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
sususususususu
Observer
Observer
292 次查看
注册日期: ‎09-03-2021

vitis hls Co-simulation if fail, but systhesis and c simulation is successful.

this is top function

my ZYNQ is 7020.

---------------------------------------------------------------------------------

void test(ap_uint<8>* img_in,
ap_uint<8>* img_out,
int height,
int width)
{
#pragma HLS INTERFACE m_axi port=img_in offset=slave bundle=gmem0 depth=2
#pragma HLS INTERFACE m_axi port=img_out offset=slave bundle=gmem0 depth=2
#pragma HLS INTERFACE s_axilite port=height bundle=gmem1
#pragma HLS INTERFACE s_axilite port=width bundle=gmem1
#pragma HLS INTERFACE s_axilite port=return bundle=control

xf::cv::Mat<XF_8UC1, HEIGHT, WIDTH, XF_NPPC1> imgInput(height, width);
xf::cv::Mat<XF_8UC1,HEIGHT,WIDTH,XF_NPPC1> imgOutput(height, width);

xf::cv::Array2xfMat<PTR_WIDTH_GRAY, XF_8UC1, HEIGHT, WIDTH, XF_NPPC1>(img_in, imgInput);
//sobel<XF_8UC1,HEIGHT,WIDTH,XF_NPPC1>(imgInput,imgOutput);
xf::cv::xfMat2Array<PTR_WIDTH_GRAY, XF_8UC1, HEIGHT,WIDTH, XF_NPPC1>(imgInput, img_out);
}

---------------------------------------------------------------------------------

this is error.

ERROR: System recieved a signal named SIGSEGV and the program has to stop immediately!
This signal was generated when a program tries to read or write outside the memory that is allocated for it, or to write memory that can only be read.
Possible cause of this problem may be: 1) the depth setting of pointer type argument is much larger than it needed; 2)insufficient depth of array argument; 3)null pointer etc.
Current execution stopped during CodeState = CALL_C_DUT.
You can search CodeState variable name in apatb*.cpp file under ./sim/wrapc dir to locate the position.

ERROR: [COSIM 212-360] Aborting co-simulation: C TB simulation failed.
ERROR: [COSIM 212-320] C TB testing failed, stop generating test vectors. Please check C TB or re-run cosim.
ERROR: [COSIM 212-5] *** C/RTL co-simulation file generation failed. ***
ERROR: [COSIM 212-4] *** C/RTL co-simulation finished: FAIL ***

Thanks.

0 项奖励
6 回复数
wenchen
Moderator
Moderator
259 次查看
注册日期: ‎05-27-2018

Hi @sususususususu ,

遇到此类问题一般都是以为端口上设置得maxi interface的深度和test bench 里面的深度不一致导致的。

depth: 指定TB要处理的最大样本数。 此设置指示 HLS 工具为 RTL 协同仿真创建的验证适配器中所需的 FIFO 的最大大小。

你可以看到示例代码给到的深度参数是TB测试一整张图片的深度大小,所以一定要参考参考设计。你设计里面深度为2显然是不够的。

static constexpr int __XF_DEPTH = (HEIGHT * WIDTH * (XF_PIXELWIDTH(IN_TYPE, NPC1)) /  / (INPUT_PTR_WIDTH / 8);
static constexpr int __XF_DEPTH_OUT = (HEIGHT * WIDTH * (XF_PIXELWIDTH(OUT_TYPE, NPC1)) /  / (OUTPUT_PTR_WIDTH / 8);

void sobel_accel(ap_uint<INPUT_PTR_WIDTH>* img_inp,
                 ap_uint<OUTPUT_PTR_WIDTH>* img_out1,
                 ap_uint<OUTPUT_PTR_WIDTH>* img_out2,
                 int rows,
                 int cols) {
// clang-format off
    #pragma HLS INTERFACE m_axi     port=img_inp  offset=slave bundle=gmem1  depth=__XF_DEPTH
    #pragma HLS INTERFACE m_axi     port=img_out1  offset=slave bundle=gmem2 depth=__XF_DEPTH_OUT
    #pragma HLS INTERFACE m_axi     port=img_out2  offset=slave bundle=gmem3 depth=__XF_DEPTH_OUT
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 项奖励
sususususususu
Observer
Observer
209 次查看
注册日期: ‎09-03-2021

I test  official sobel code ,but i fail.

Does the software need to be configured with anything?

 

0 项奖励
wenchen
Moderator
Moderator
186 次查看
注册日期: ‎05-27-2018

Hi @sususususususu 

Please refer to this blog and the latest Vitis Vision Library.

 

https://forums.xilinx.com/t5/Xilinx-%E4%BA%A7%E5%93%81%E8%AE%BE%E8%AE%A1%E4%B8%8E%E5%8A%9F%E8%83%BD%E8%B0%83%E8%AF%95%E6%8A%80%E5%B7%A7/Vitis-Vision-%E5%88%A9%E7%94%A8Vitis-HLS-tcl-shell-%E4%B8%80%E9%94%AE%E8%B7%91%E9%80%9A%E8%A7%86%E8%A7%89%E5%8A%A0...

Wen

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 项奖励
sususususususu
Observer
Observer
129 次查看
注册日期: ‎09-03-2021

problem_1:what is OPENCV_LIB_REF?I don't know.

this is my opencv install path.

QQ浏览器截图20210916105153.png

problem_2:包括用于验证测试平台的图像:-argv“ $ {XF_PROJ_ROOT} /data/128x128.png” 

what is XF_PROJ_ROOT.

0 项奖励
sususususususu
Observer
Observer
129 次查看
注册日期: ‎09-03-2021

problem_3:where do I need to set ?

Is here?

QQ浏览器截图20210916105955.png

sususususususu_0-1631762900917.png

 

Thank you very much.

0 项奖励
wenchen
Moderator
Moderator
99 次查看
注册日期: ‎05-27-2018

Hi @sususususususu ,

You can modify the tcl file and use the HLS non-project mode to create the project. 

Please download the tcl file at the bottom of the article.

# ------------------------------------------------------------------------------
# Vitis Vision and OpenCV Libary Path Information
# ------------------------------------------------------------------------------
set XF_PROJ_ROOT "/home/vicky/Xilinx/Vitis_Libraries-master/vision" 	
set OPENCV_INCLUDE "/home/vicky/opencv/include" 
set OPENCV_LIB "/home/vicky/opencv/lib" 		

# ------------------------------------------------------------------------------
# Vitis HLS Project Information
# ------------------------------------------------------------------------------
set PROJ_DIR "$XF_PROJ_ROOT/L1/examples/resize"
set SOURCE_DIR "$PROJ_DIR/"
set PROJ_NAME "hls_example"
set PROJ_TOP "resize_accel"
set SOLUTION_NAME "sol1"
set SOLUTION_PART "xcvu11p-flgb2104-1-e"
set SOLUTION_CLKP 5 

# ------------------------------------------------------------------------------
# OpenCV C Simulation / CoSimulation Library References
#------------------------------------------------------------------------------
set VISION_INC_FLAGS "-I$XF_PROJ_ROOT/L1/include -std=c++0x"
set OPENCV_INC_FLAGS "-I$OPENCV_INCLUDE"
set OPENCV_LIB_FLAGS "-L $OPENCV_LIB"

# Windows OpenCV Include Style:
# set OPENCV_LIB_REF   "-lopencv_imgcodecs3411 -lopencv_imgproc3411 -lopencv_core3411 -lopencv_highgui3411 -lopencv_flann3411 -lopencv_features2d3411"

# Linux OpenCV Include Style:
set OPENCV_LIB_REF   "-lopencv_imgcodecs -lopencv_imgproc -lopencv_core -lopencv_highgui -lopencv_flann -lopencv_features2d"

https://forums.xilinx.com/t5/High-Level-Synthesis-HLS/Using-Vitis-Vision-Libraries-and-OpenCV/td-p/1170435

Find the answer in the post above:

Wen

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 项奖励