| Contents | Index |
The required elements for a code generation control file are as follows:
A control file implements a single function, which is invoked during the code generation process.
The function must instantiate a code generation control object, set its properties, and return the object to the code generator.
Setting up a code generation control object requires the use of a small number of methods, as described in Code Generation Control Objects and Methods. You do not need to know internal details of the code generation control object or the class to which it belongs.
You construct the object using the hdlnewcontrol function. The argument to hdlnewcontrol is the name of the control file itself. Use the mfilename function to pass in the file name, as shown in the following example.
function c = dct8config
c = hdlnewcontrol(mfilename);
% Set target language for Verilog.
c.set('TargetLanguage','Verilog');
% Set top-level subsystem from which code is generated.
c.generateHDLFor('dct8_fixed/OneD_DCT8');
Following the constructor call, your code will invoke methods of the code generation control object. The previous example calls the set and generateHDLFor methods. These and all other public methods of the object are discussed in Code Generation Control Objects and Methods.
Your control file must be attached to your model before code generation, as described in Using Control Files in the Code Generation Process. The interface between the code generator and your attached control file is automatic.
A control file must be located in either the current working folder, or a folder that is in the MATLAB path.
However, your control files should not be located within the MATLAB tree because they could be overwritten by subsequent installations.
![]() | Overview of Control Files | Code Generation Control Objects and Methods | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |