MATLAB: I want to convert matlab code to hdl, but the problem is that i have multiple ‘.m’ files and each file has some reference from other files,how to convert these files into hdl codes

HDL Coder

i want to convert matlab code to hdl, but the problem is that i have multiple '.m' files and each file has some reference from other files,how to convert these files into hdl codes?

Best Answer

That should not be a problem. When you ask to process your top-level function, the coder will automatically find the routines that are called, and the routines that they call, and so on.
If you were using MATLAB Compiler instead of the HDL Coder, then the MATLAB Compiler tool would not always be able to find all referenced routines: it cannot automatically find routines that executed by eval() or evalc() or feval() on a string, or file handles created by str2func(). An case where the routine to be executed is determined at execution time by constructing the routine name from a string cannot be handled automatically by MATLAB Compiler. The %#function pragma is used to give "hints" to the MATLAB Compiler in such cases.
For HDL Coder, it seems to me that none of those methods of dynamic execution are supported anyhow, so this should not be a factor. But still, if you have a function being referred to that is not "obvious" then adding %#function pragma would not hurt.