| Simulink® HDL Coder™ | ![]() |
Generate forEach calls for insertion into code generation control files
hdlnewforeach
hdlnewforeach('blockpath')
hdlnewforeach({'blockpath1','blockpath2',...})
[cmd, impl] = hdlnewforeach
[cmd, impl] = hdlnewforeach('blockpath')
[cmd, impl] = hdlnewforeach({'blockpath1','blockpath2',...})
[cmd, impl, parms] = hdlnewforeach
[cmd, impl, parms] = hdlnewforeach('blockpath')
[cmd, impl, parms] = hdlnewforeach({'blockpath1','blockpath2',...})
The coder provides the hdlnewforeach utility to help you construct forEach calls for use in code generation control files. Given a selection of one or more blocks from your model, hdlnewforeach returns the following for each selected block, as string data in the MATLAB® workspace:
A forEach call coded with the correct modelscope, blocktype, and default implementation arguments for the block
(Optional) A cell array of cell arrays of strings enumerating the available implementations for the block, in package.class form
(Optional) A cell array of cell arrays of strings enumerating the names of implementation parameters (if any) corresponding to the block implementations. hdlnewforeach does not list data types and other details of block implementation parameters. See Block Implementation Parameters for that information.
hdlnewforeach returns a forEach call for each selected block in the model. Each call is returned as a string.
hdlnewforeach('blockpath') returns a forEach call for a specified block in the model. The call is returned as a string.
The 'blockpath' argument is a string specifying the full path to the desired block.
hdlnewforeach({'blockpath1','blockpath2',...}) returns a forEach call for each specified block in the model. Each call is returned as a string.
The {'blockpath1','blockpath2',...} argument is a cell array of strings, each of which specifies the full path to a desired block.
[cmd, impl] = hdlnewforeach returns a forEach call for each selected block in the model to the string variable cmd. In addition, the call returns a cell array of cell arrays of strings (impl) enumerating the available implementations for the block.
[cmd, impl] = hdlnewforeach('blockpath') returns a forEach call for a specified block in the model to the string variable cmd. In addition, the call returns a cell array of cell arrays of strings (impl) enumerating the available implementations for the block.
The 'blockpath' argument is a string specifying the full path to the desired block.
[cmd, impl] = hdlnewforeach({'blockpath1','blockpath2',...}) returns a forEach call for each specified block in the model to the string variable cmd. In addition, the call returns a cell array of cell arrays of strings (impl) enumerating the available implementations for the block.
The {'blockpath1','blockpath2',...} argument is a cell array of strings, each of which specifies the full path to a desired block.
[cmd, impl, parms] = hdlnewforeach returns a forEach call for each selected block in the model to the string variable cmd. In addition, the call returns:
A cell array of cell arrays of strings (impl) enumerating the available implementations for the block.
A cell array of cell arrays of strings (parms) enumerating the available implementation parameters corresponding to each implementation.
[cmd, impl, parms] = hdlnewforeach('blockpath') returns a forEach call for a specified block in the model to the string variable cmd. In addition, the call returns:
A cell array of cell arrays of strings (impl) enumerating the available implementations for the block.
A cell array of cell arrays of strings (parms) enumerating the available implementation parameters corresponding to each implementation.
The 'blockpath' argument is a string specifying the full path to the desired block.
[cmd, impl, parms] = hdlnewforeach({'blockpath1','blockpath2',...}) returns a forEach call for each specified block in the model to the string variable cmd. In addition, the call returns:
A cell array of cell arrays of strings (impl) enumerating the available implementations for the block.
A cell array of cell arrays of strings (parms) enumerating the available implementation parameters corresponding to each implementation.
The {'blockpath1','blockpath2',...} argument is a cell array of strings, each of which specifies the full path to a desired block.
Before invoking hdlnewforeach, you must run checkhdl or makehdl to build in-memory information about the model. If you do not run checkhdl or makehdl, hdlnewforeach will display an error message indicating that you should run checkhdl or makehdl.
hdlnewforeach returns an empty string for blocks that do not have an HDL implementation. hdlnewforeach also returns an empty string for subsystems, which are a special case. Subsystems do not have a default implementation class, but special-purpose subsystems implementations are provided (see Interfacing Subsystems and Models to HDL Code).
After invoking hdlnewforeach, you will generally want to insert the forEach calls returned by the function into a control file, and use the implementation and parameter information returned to specify a nondefault block implementation. See Generating Selection/Action Statements with the hdlnewforeach Function for a worked example.
The following example generates forEach commands for two explicitly specified blocks.
hdlnewforeach({'sfir_fixed/symmetric_fir/Add4',...
'sfir_fixed/symmetric_fir/Product2'})
ans =
c.forEach('sfir_fixed/symmetric_fir/Add4',...
'built-in/Sum', {},...
'hdldefaults.SumLinearHDLEmission', {});
c.forEach('sfir_fixed/symmetric_fir/Product2',...
'built-in/Product', {},...
'hdldefaults.ProductLinearHDLEmission', {});
The following example generates a forEach command for an explicitly specified Sum block. The implementation and parameters information returned is listed after the forEach command.
[cmd,impl, parms] = hdlnewforeach('sfir_fixed/symmetric_fir/Add4')
cmd =
c.forEach('sfir_fixed/symmetric_fir/Add4',...
'built-in/Sum', {},...
'hdldefaults.SumLinearHDLEmission', {});
impl =
{3x1 cell}
parms =
{1x1 cell} {1x1 cell} {1x1 cell}
>> impl{1}
ans =
'hdldefaults.SumTreeHDLEmission'
'hdldefaults.SumLinearHDLEmission'
'hdldefaults.SumCascadeHDLEmission'
>> parms{1:3}
ans =
'OutputPipeline'
ans =
'OutputPipeline'
ans =
'OutputPipeline'
![]() | hdlnewcontrolfile | hdlsetup | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |