[Matlab Coder] Generate C code with hierarchy

2 ビュー (過去 30 日間)
Duc Dung Vu
Duc Dung Vu 2021 年 10 月 5 日
回答済み: Kiran Kintali 2022 年 3 月 21 日
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
Darshan Ramakant Bhat 2021 年 10 月 5 日
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