For the MATLAB Function block, you can use the InstantiateFunctions parameter
to generate a VHDL® entity
or Verilog® module
for
each function. HDL Coder™ generates code for each entity
or module
in
a separate file.
The InstantiateFunctions options for the MATLAB Function block are listed in the following table.
InstantiateFunctions Setting | Description |
---|---|
'off' (default) | Generate code for functions inline. |
'on' | Generate a VHDL |
To set the InstantiateFunctions parameter using the HDL Block Properties dialog box:
Right-click the MATLAB Function block.
Select HDL Code > HDL Block Properties.
For InstantiateFunctions, select on.
To set the InstantiateFunctions parameter
from the command line, use hdlset_param
. For
example, to generate instantiable code for functions in a MATLAB
Function block, myMatlabFcn
, in your DUT
subsystem, myDUT
, enter:
hdlset_param('my_DUT/my_MATLABFcnBlk', 'InstantiateFunctions', 'on')
If you want to generate instantiable code for some functions
but not others, enable the option to generate instantiable code for
functions, and use coder.inline
. See coder.inline
for details.
The software generates code inline when:
Function calls are within conditional code or for
loops.
Any function is called
with a nonconstant struct
input.
The function has state, such as a persistent variable, and is called multiple times.
There is an enumeration anywhere in the design function.
Check for MATLAB Function block settings