How to reuse function and generate less files using HDL coder

I have a simulink design that is very repetetive and uses the same subsystems and blocks multiple times.
The HDL coder is generating a huge number of files, for instance I have multiple Image Filter blocks and the coder generates ,for each of them, a number of files for padding, data memory lines, line buffer.... the project becomes unweildy very quickly with over a 1000 files.
Is there a way to reuse functions and subsystems throughout the project?

 Respuesta aceptada

Sreejith Menon
Sreejith Menon el 20 de Feb. de 2019
Can you please mark the identical subsystems as "Atomic Subsystems" (Block Parameters > Treat as atomic unit)? That should trigger HDL Coder to share the files for the identical subsystems.
regards,
Sreejith

5 comentarios

This doesn't seem to work for me, using identical atomic subsysetems to generate less files and resuable HDL code works sometimes and does not work other times, I am probably missing something, but I check for data types and just reuse the same subsystem by copy/pasting it, but the Coder still generates files for every susbsystem, I'm mainly reusing the Image filter block if that is relavent.
Atomic subsystems are the recommended approach for your use case. If the data types at the interface are same and if you have copy-pasted the subsystems, then it should generally work fine.
But if we can’t prove that the Atomic subsystems are identical for code generation, you will get separate files from HDL Coder. We will need to look at your design to comment more on why this is happening. Will you be willing to share some parts of your design with us?
Thanks.
Alla
Alla el 3 de Jul. de 2019
Editada: Alla el 3 de Jul. de 2019
Helllo, I can share the design since it's just me testing and trying things for now. The design has three main blocks, each blocks has a few subsystems, the first main block does generate reusable code, the second and third don't however, although they're similar only more processing identical elements used, groups of them made into subsystems with a deeper hierarchy, just copy pasting. the design is a bit messy granted, that's why I'm probably missing something, although I tired different approches.
I attched the design, a matlab script that generates some test constants and an example image for the Image from File block.
Hello,
I tried your designs and there were some compilation issues. Can you get in touch with our customer support - https://www.mathworks.com/support/contact_us.html?
That will be much quicker to resolve these minor issues in the design. The support team will get in touch with us after that.
thanks.
It wokrs on my end but I'll see what I can do, thank you for the help

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 18 de Feb. de 2019

Comentada:

el 9 de Jul. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by