Why does makehdl generates so many vhdl files even for a simple FIR filter that was generated with the Simulink hdl FIR block? Is there a way to reduce the number of files?

6 次查看(过去 30 天)
Why does makehdl generates so many vhdl files even for a simple FIR filter that was generated with the Simulink hdl FIR block? Is there a way to reduce the number of files?

回答(1 个)

Adarsh
Adarsh 2025-5-8
Hi @Osvy,
I am assuming by Simple FIR filter you mean “Discrete FIR Filter” block. So, consider a model with just a “Discrete FIR Filter” block and “input port” and “output port”. Now when “makehdl” is used to generate HDL code for this model you might notice that it produces many VHDL files even for a simple FIR Filter.
It happens because even simple “FIR Filter” blocks can internally use multiple sub-blocks like “multipliers” and “adders” etc, resulting in its own VHDL file.
You can refer to the documentation link below to observe what algorithms are implemented inside a single “Discrete FIR Filter” block:
And the code generated form “makehdl” may contain additional files for utility functions, packages or shared resources and sometimes may include “Test Benches” as well.
To reduce the number of files generated you can flatten the model hierarchy as the first option to reduce the number of files generated as shown in the documentation link below:
If in any case, you are using multiple “Subsystem” blocks then you can make the HDL coder to reuse subsystem code. For more information on how to generate reusable code for subsystems you can refer to the following MATLAB Answer link:
If in any case, you have multiple “Masked Subsystem” blocks which have same components but different parameter values then you can follow the process in the below documentation link to generate reusable code and reduce the number of files:
I hope it helps.

类别

Help CenterFile Exchange 中查找有关 Optimization 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by