cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sayli10
Visitor
Visitor
1,866 Views
Registered: ‎12-14-2018

Synthesis error

Hi, I am trying to synthesis one C code in vivado 2017.4. My main file is in C++ and other supporting files are in C. The same code I have tested on the visual studio IDE, which works fine on visual IDE. But in vivado, this same C code is not working. My code has some C functions such as malloc, calloc, free etc. For that, I have include malloc.h header file but still getting an error as "not supported C/C++ function malloc". Also, I am getting issues of "has no function body", even after adding files properly. I have attached all the errors - 

ERROR: [SYNCHK 200-41] ../../src/sol1.c:64: unsupported pointer reinterpretation from type '[13 x double]*' to type 'i8*' on variable 'pSys'.
ERROR: [SYNCHK 200-71] ../../src/sol1.c:64: function 'grampc_init(typeGRAMPC**, void*)' has no function body.
ERROR: [SYNCHK 200-11] ../../src/sol1.c:68: Variable 'grampc.param.Nx' has an unsynthesizable type 'i32*P*' (possible cause(s): pointer to pointer or global pointer).
ERROR: [SYNCHK 200-71] ../../src/sol1.c:68: function 'grampc_setparam_real_vector(typeGRAMPC const*, char const*, double const*)' has no function body.
ERROR: [SYNCHK 200-71] ../../src/sol1.c:76: function 'grampc_setparam_real(typeGRAMPC const*, char const*, double)' has no function body.
ERROR: [SYNCHK 200-71] ../../src/sol1.c:82: function 'grampc_setopt_int(typeGRAMPC const*, char const*, int)' has no function body.
ERROR: [SYNCHK 200-71] ../../src/sol1.c:87: function 'grampc_setopt_string(typeGRAMPC const*, char const*, char const*)' has no function body.
ERROR: [SYNCHK 200-71] ../../src/sol1.c:88: function 'grampc_setopt_real_vector(typeGRAMPC const*, char const*, double const*)' has no function body.
ERROR: [SYNCHK 200-71] ../../src/sol1.c:91: function 'grampc_estim_penmin(typeGRAMPC*, int)' has no function body.
ERROR: [SYNCHK 200-61] ../../src/sol1.c:121: unsupported memory access on variable 'grampc.sol.xnext' which is (or contains) an array with unknown size at compile time.
ERROR: [SYNCHK 200-71] ../../src/sol1.c:124: function 'grampc_run(typeGRAMPC const*)' has no function body.
ERROR: [HLS 200-70] Synthesizability check failed.

 

Regards,

Sayli.

0 Kudos
3 Replies
dpaul24
Scholar
Scholar
1,847 Views
Registered: ‎08-07-2014

@sayli10,

Perhaps you must read carefully the supported functions by Vivado HLS.

This thread will be helpful: https://forums.xilinx.com/t5/Vivado-High-Level-Synthesis-HLS/Calloc-Malloc-and-free/td-p/777123

Last but not the least, Vivado HLS is about generating hardware. Please stop thinking from a software design point of view and think about what hardware design is to be generated from the C/C++ code.

 

 

------------FPGA enthusiast------------
Consider giving "Kudos" if you like my answer. Please mark my post "Accept as solution" if my answer has solved your problem

nupurs
Moderator
Moderator
1,709 Views
Registered: ‎06-24-2015

@sayli10 

 

In addition to what @dpaul24  said, we recommend using all c files or all cpp files. Please try not to use both of them in the same project as it could lead to issues later.

Thanks,
Nupur
--------------------------------------------------------------------------------------------
Google your question before posting. If someone's post answers your question, mark the post as answer with "Accept as solution". If you see a particularly good and informative post, consider giving it Kudos (click on the 'thumbs-up' button).
u4223374
Advisor
Advisor
1,690 Views
Registered: ‎04-26-2015

In addition to the two excellent posts above ... read UG902 Chapter 3. This covers the vast majority of what you can or cannot do in HLS. The second section of that covers dynamic memory allocation, and the very quick summary is "not available". This is because, as @dpaul24 has said, you're building hardware. The hardware configuration is defined during synthesis - there is no way for HLS to allocate more memory on-the-fly, and no underlying OS to handle memory management.