[Matlab Coder] Generate C code with hierarchy

2 次查看(过去 30 天)
Hi,
I'm using Matlab coder to generate C code for my project so that I can put it through HLS. As I know, Matlab has an HDL coder toolbox to implement algorithm in Matlab and Simulink for HDL programming. However, my project requires to add some other modification in the HDL level with the use of Vivado HLS. Thus, I need to manually modify and redefine the C code generated by Matlab Coder. Right now, I have some trouble with the hierachy of the generated C code, and causes my a lot of troubles in debugging. Below is my Matlab code hierachy:
------Rk_4.m
|<------------------------------ IS_dynamics.m
It means that I have a file named as Rk_4.m that is calling a lower level file (IS_dynamics.m) mutiple times during the execution. After using Matlab coder for Rk_4.m file, I noticed that the generated C code in Rk_4.c didn't make any call to the function IS_dynamics as it did in Matlab. Instead, it generates C code for IS_dynamics.m file and places inside the Rk_4.c, which creates a complicated and hard to keep track c code file. Hopefully, the picture below can explain more what my problem is:
Thus, I want to ask, If there is an option in Matlab coder that I can generate my RK_4.c file so that It will call the function IS_dynamics (maybe from the file IS_dynamics.c) instead of extracting IS_dynamic.m directly inside RK_4.c.

采纳的回答

Darshan Ramakant Bhat
The function "Is_dynamics" is getting inlined by compiler optimization while generating code from MATLAB. Please try coder.inline('never') option on the called function :

更多回答(1 个)

Kiran Kintali
Kiran Kintali 2022-3-21
SystemC Code Generation from MATLAB
Generate Synthesizable SystemC Code from MATLAB® algorithms for use with Cadence Stratus HLS Workflows

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by