Usage of Matlab 2017b: Import filename of Simulink-Model into generated HDL-file (usage of HDL-coder)
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
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);
1 Comment
Stefanie Schwarz
on 20 Dec 2022
Since R2021b, timestamp macros (__DATE__, __TIME__, __TIMESTAMP__) are available for custom header file comments with HDL Coder:
See Also
Categories
Find more on Model Compatibility Checks 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!