Usage of Matlab 2017b: Import filename of Simulink-Model into generated HDL-file (usage of HDL-coder)

5 views (last 30 days)
I use Matlab/Simulink 2017b for HDL code generation from Simulink model.
In HDL coder/Global Settings/File Comment Customization i will insert a 'Custom File Header Comment' for the generated HDL code. I want to import the filename of the simulink-model into the generated hdl code file:
Header of HDL-file (see als attachment)
-- File name: <%Filename%>.vhd
-- Design Unit: <%Filename%>(RTL)
-- DAL-level: A
...
Filename shall be replaced in the header of generated HDL-file from HDL-coder with the file-name of the Simulink model:
Example: File name of Simulink-model: PT1_Filter:
Header of generated HDL-File:
-- File name: PT1_Filter.vhd
-- Design Unit: PT1_Filter(RTL)
-- DAL-level: A
...
It does not work. What is the problem?
Thank you
Josef

Answers (1)

Stefanie Schwarz
Stefanie Schwarz on 4 Aug 2022
Edited: Stefanie Schwarz on 20 Dec 2022
In MATLAB R2017b, it is not possible to use macro-style keywords for custom header/footer comments with HDL Coder.
We apologize that the documentation gave the wrong impression that these are macros. We addressed this in the R2021a version of the "File Comment Customization Parameters" doc page.
To adjust the header/footer comment dynamically, use a programmatic approach to generate the HDL Code:
>> hdlset_param(gcs,'CustomFileHeaderComment', ...
['File name: ' gcs '.vhd' newline...
'Design Unit: ' gcs '(RTL)' newline...
'Date: ' datestr(now)]);
>> makehdl(gcs);

Categories

Find more on Code Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!