HDL Coder™ Reference
HDL Coder™ Reference
Reference
R2014a
How to Contact MathWorks
www.mathworks.com Web
comp.soft-sys.matlab Newsgroup
www.mathworks.com/contact_TS.html Technical Support
508-647-7000 (Phone)
508-647-7001 (Fax)
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
March 2013 Online only New for Version 3.2 (R2013a)
September 2013 Online only Revised for Version 3.3 (R2013b)
March 2014 Online only Revised for Version 3.4 (Release 2014a)
Contents
Supported Blocks
2
iii
iv Contents
1
Functions — Alphabetical
List
checkhdl
Syntax checkhdl(bdroot)
checkhdl('modelname')
checkhdl('subsysname')
checkhdl(gcb)
output = checkhdl('system')
Description checkhdl generates an HDL Code Generation Check Report, saves the
report to the target folder, and displays the report in a new window.
Before generating HDL code, use checkhdl to check your subsystems
or models.
The report lists compatibility errors with a link to each block or
subsystem that caused a problem. To highlight and display incompatible
blocks, click each link in the report while keeping the model open.
The report file name is system_report.html. system is the name of
the subsystem or model passed in to checkhdl.
When a model or subsystem passes checkhdl, that does not imply code
generation will complete. checkhdl does not verify all block parameters.
checkhdl(bdroot) examines the current model for HDL code
generation compatibility.
checkhdl('modelname') examines the specified model, modelname.
checkhdl('subsysname') examines a subsystem. subsysname is the
full block path for a subsystem at any level of the model hierarchy.
checkhdl(gcb) examines the currently selected subsystem.
output = checkhdl('system')
does not generate a report. Instead, it returns a 1xN struct array with
one entry for each error, warning, or message. system specifies a model
or the full block path for a subsystem at any level of the model hierarchy.
checkhdl reports three levels of compatibility problems:
1-2
checkhdl
Examples Check the subsystem symmetric_fir within the model sfir_fixed for
HDL code generation compatibility and generate a compatibility report.
checkhdl('sfir_fixed/symmetric_fir')
output =
output(1)
1-3
checkhdl
ans =
path: 'sfir_fixed_err/symmetric_fir_err/Product'
type: 'block'
message: 'Unhandled mixed double and non-double datatypes at ports of block'
level: 'Error'
1-4
hdladvisor
Syntax hdladvisor(gcb)
hdladvisor(subsystem)
hdladvisor(model,'SystemSelector')
Examples Open the subsystem symmetric_fir within the model sfir_fixed into
the HDL Workflow Advisor.
hdladvisor('sfir_fixed/symmetric_fir')
Alternatives You can also open the HDL Workflow Advisor from the your model
window by selecting Code > HDL Code > HDL Workflow Advisor.
See Also “What Is the HDL Workflow Advisor?” | “Using the HDL Workflow
Advisor Window”
1-5
hdlapplycontrolfile
Tips • As of release R2010b, use of control files is not recommended, and the
coder does not support the attachment of a control file to a new model.
Instead, the coder now saves non-default block implementation
and implementation parameter settings to the model itself. This
eliminates the need to load and save a separate control file. The
coder provides the hdlapplycontrolfile utility as a quick way
to transfer HDL settings from existing models that have attached
control files to other models.
• After you apply control file settings to a model, be sure to save the
model.
• If you have existing models with attached control files, you should
convert them to the current format. To do this, simply open the
model and save it. Saving a model clears its attachment to its control
file, but the control file itself is preserved so that you can apply it to
other models if you wish.
For backward compatibility, the coder continues to support models
that have attached control files. See “READ THIS FIRST: Control
File Compatibility and Conversion Issues” for further information.
1-6
hdlapplycontrolfile
Input modelname
Arguments Name of the target model, to which control file settings are applied.
Default: None
controlfilename
Name of the control file containing hdl settings to be applied
Default: None
dutname
Full path to the top-level subsystem (the device under test or DUT)
within the target model.
Default: None
hdlapplycontrolfile('sfir_fixed_newVersion','sfir_fixed_control.m')
Successfully loaded control file 'sfir_fixed_control.m' ...
hdlapplycontrolfile('sfir_fixed_newVersion/symmetric_fir','sfir_fixed_control.m')
Successfully loaded control file 'sfir_fixed_control.m' ...
1-7
hdlapplycontrolfile
See Also | “READ THIS FIRST: Control File Compatibility and Conversion
Issues”
1-8
hdlcoder.optimizeDesign
1-9
hdlcoder.optimizeDesign
model = 'sfir_fixed';
dutSubsys = 'symmetric_fir';
open_system(model);
hdlset_param(model,'HDLSubsystem',[model,'/',dutSubsys]);
hdlset_param(model,'GenerateHDLTestBench','on');
oc = hdlcoder.OptimizationConfig;
oc.IterationLimit = 10;
1-10
hdlcoder.optimizeDesign
hdlcoder.optimizeDesign(model,oc)
Iteration 0
Generate and synthesize HDL code ...
(CP ns) 16.26 (Constraint ns) 5.85 (Elapsed s) 143.66 Iteration 1
Generate and synthesize HDL code ...
(CP ns) 16.26 (Constraint ns) 5.85 (Elapsed s) 278.72 Iteration 2
Generate and synthesize HDL code ...
(CP ns) 10.25 (Constraint ns) 12.73 (Elapsed s) 427.22 Iteration 3
Generate and synthesize HDL code ...
(CP ns) 9.55 (Constraint ns) 9.73 (Elapsed s) 584.37 Iteration 4
Generate and synthesize HDL code ...
(CP ns) 9.55 (Constraint ns) 9.38 (Elapsed s) 741.04 Iteration 5
Generate and synthesize HDL code ...
Exiting because critical path cannot be further improved.
Summary report: summary.html
Achieved Critical Path (CP) Latency : 9.55 ns Elapsed : 741.04 s
Iteration 0: (CP ns) 16.26 (Constraint ns) 5.85 (Elapsed s) 143.66
Iteration 1: (CP ns) 16.26 (Constraint ns) 5.85 (Elapsed s) 278.72
Iteration 2: (CP ns) 10.25 (Constraint ns) 12.73 (Elapsed s) 427.22
Iteration 3: (CP ns) 9.55 (Constraint ns) 9.73 (Elapsed s) 584.37
Iteration 4: (CP ns) 9.55 (Constraint ns) 9.38 (Elapsed s) 741.04
Final results are saved in
/tmp/hdlsrc/sfir_fixed/hdlexpl/Final-07-Jan-2014-17-04-41
Validation model: gm_sfir_fixed_vnl
Then coder stops after five iterations because the fourth and fifth
iterations had the same critical path, which indicates that the coder
1-11
hdlcoder.optimizeDesign
has found the minimum critical path. The design’s maximum clock
frequency after optimization is 1 / 9.55 ns, or 104.71 MHz.
model = 'sfir_fixed';
dutSubsys = 'symmetric_fir';
open_system(model);
hdlset_param(model,'HDLSubsystem',[model,'/',dutSubsys]);
hdlset_param(model,'GenerateHDLTestBench','off');
oc = hdlcoder.OptimizationConfig;
1-12
hdlcoder.optimizeDesign
oc.ExplorationMode = ...
hdlcoder.OptimizationConfig.ExplorationMode.TargetFrequency;
oc.TargetFrequency = 50;
oc.IterationLimit = 10; =
hdlcoder.optimizeDesign(model,oc)
Iteration 0
Generate and synthesize HDL code ...
(CP ns) 16.26 (Constraint ns) 20.00 (Elapsed s) 134.02 Iteration 1
Generate and synthesize HDL code ...
Exiting because constraint (20.00 ns) has been met (16.26 ns).
Summary report: summary.html
Achieved Critical Path (CP) Latency : 16.26 ns Elapsed : 134.02 s
Iteration 0: (CP ns) 16.26 (Constraint ns) 20.00 (Elapsed s) 134.02
Final results are saved in
/tmp/hdlsrc/sfir_fixed/hdlexpl/Final-07-Jan-2014-17-07-14
Validation model: gm_sfir_fixed_vnl
Then coder stops after one iteration because it has achieved the target
clock frequency. The critical path is 16.26 ns, a clock frequency of
61.50 GHz.
1-13
hdlcoder.optimizeDesign
model = 'sfir_fixed';
dutSubsys = 'symmetric_fir';
open_system(model);
hdlset_param(model,'HDLSubsystem',[model,'/',dutSubsys]);
Set your synthesis tool and target device options to the same values
as in the interrupted run.
hdlset_param(model,'GenerateHDLTestBench','on');
oc = hdlcoder.OptimizationConfig;
oc.ResumptionPoint = 'Iter5-07-Jan-2014-17-04-29';
hdlcoder.optimizeDesign(model,oc)
1-14
hdlcoder.optimizeDesign
Then coder stops after one additional iteration because it has achieved
the target clock frequency. The critical path is 9.55 ns, or a clock
frequency of 104.71 MHz.
model = 'sfir_fixed';
dutSubsys = 'symmetric_fir';
open_system(model);
hdlset_param(model,'HDLSubsystem',[model,'/',dutSubsys]);
1-15
hdlcoder.optimizeDesign
Set your synthesis tool and target device options to the same values as
in the original run.
hdlcoder.optimizeDesign(model,
'hdlsrc/sfir_fixed/hdlexpl/Final-19-Dec-2013-23-05-04/cpGuidance.mat')
Functions hdlcoder.supportedDevices
Properties SynthesisToolSynthesisToolDeviceNameSynthesisToolChipFamilySynthesisToolP
1-16
hdlcoder.supportedDevices
Syntax hdlcoder.supportedDevices
hdlcoder.supportedDevices
Click the Xilinx ISE Device List link to open the supported target
device report and view details for your target device.
sfir_fixed
1-17
hdlcoder.supportedDevices
hdlset_param ('sfir_fixed',
'SynthesisToolChipFamily', 'Virtex6',
'SynthesisToolDeviceName','xc6vlx130t',
'SynthesisToolPackageName', 'ff484',
'SynthesisToolSpeedValue', '-1')
View the nondefault parameters for your model, including target device
information.
hdldispmdlparams
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HDL CodeGen Parameters (non-default)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1-18
hdldispblkparams
Syntax hdldispblkparams(path)
hdldispblkparams(path,'all')
Input path
Arguments Path to a block or subsystem in the current model.
Default: None
’all’
If you pass in the string 'all', hdldispblkparams displays the names
and values of all HDL properties of the specified block.
hdldispblkparams('simplevectorsum/vsum/Sum of Elements')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HDL Block Parameters ('simplevectorsum/vsum/Sum of Elements')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Implementation
Architecture : Linear
Implementation Parameters
InputPipeline : 1
1-19
hdldispblkparams
The following example displays HDL block parameters and values for
the currently selected block, (a Sum of Elements block).
hdldispblkparams(gcb,'all')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HDL Block Parameters ('simplevectorsum/vsum/Sum of
Elements')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Implementation
Architecture : Linear
Implementation Parameters
InputPipeline : 0
OutputPipeline : 0
1-20
hdldispmdlparams
Syntax hdldispmdlparams(model)
hdldispmdlparams(model,'all')
Input model
Arguments Name of an open model.
Default: None
’all’
If you pass in the string'all' , hdldispmdlparams displays the names
and values of all HDL properties of the specified model.
Examples The following example displays HDL properties of the current model
that have nondefault values.
hdldispmdlparams(bdroot)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HDL CodeGen Parameters (non-default)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CodeGenerationOutput : 'GenerateHDLCodeAndDisplayGeneratedModel'
HDLSubsystem : 'simplevectorsum_2atomics/Subsystem'
OptimizationReport : 'on'
ResetInputPort : 'rst'
ResetType : 'Synchronous'
1-21
hdldispmdlparams
hdldispmdlparams(bdroot,'all')
%%%%%%%%%%%%%%%%%%%%%%%%%
HDL CodeGen Parameters
%%%%%%%%%%%%%%%%%%%%%%%%%
AddPipelineRegisters : 'off'
Backannotation : 'on'
BlockGenerateLabel : '_gen'
CheckHDL : 'off'
ClockEnableInputPort : 'clk_enable'
.
.
.
VerilogFileExtension : '.v'
1-22
hdlget_param
Purpose Return value of specified HDL block-level parameter for specified block
Syntax p = hdlget_param(block_path,prop)
Input block_path
Arguments Path to a block or subsystem in the current model.
Default: None
prop
A string designating one of the following:
• The name of an HDL block property of the block or subsystem
specified by block_path.
• 'all' : If prop is set to 'all', hdlget_param returns Name,Value
pairs for HDL properties of the specified block.
Default: None
Tips • Use hdlget_param only to obtain the value of HDL block parameters
(see “HDL Block Properties” for a list of block implementation
parameters). Use hdldispmdlparams to see the values of HDL model
parameters. To obtain the value of general model parameters, use
the get_param function.
Output p
Arguments p receives the value of the HDL block property specified by prop. The
data type and dimensions of p depend on the data type and dimensions
of the value returned. If prop is set to 'all', p is a cell array.
1-23
hdlget_param
Examples In the following example hdlget_param returns the value of the HDL
block parameter OutputPipeline to the variable p.
p = hdlget_param(gcb,'OutputPipeline')
p =
p = hdlget_param(gcb,'all')
p =
1-24
hdllib
Syntax hdllib
hdllib('html')
Description hdllib creates a library of blocks that are compatible with HDL code
generation. Use blocks from this library to build models that are
compatible with the coder.
The default library name is hdlsupported. After you generate the
library, you can save it to a folder of your choice.
Regenerate the library each time you install a new release to keep it
current.
hdllib
hdllib('html')
1-25
hdllib
1-26
hdlnewblackbox
Syntax hdlnewblackbox
hdlnewblackbox('blockpath')
hdlnewblackbox({'blockpath1','blockpath2',...'blockpathN'})
[cmd, impl] = hdlnewblackbox
[cmd, impl] = hdlnewblackbox('blockpath')
[cmd, impl] = hdlnewblackbox({'blockpath1','blockpath2',
...'blockpathN'})
[cmd, impl, params] = hdlnewblackbox
[cmd, impl, params] = hdlnewblackbox('blockpath')
[cmd, impl, params] = hdlnewblackbox({'blockpath1','blockpath2',
...'blockpathN'})
Description The hdlnewblackbox utility helps you construct forEach calls for
use in code generation control files when generating black box
interfaces. Given a selection of one or more blocks from your model,
hdlnewblackbox returns the following as string data in the MATLAB
workspace for each selected block:
• A forEach call coded with the modelscope, blocktype, and default
implementation class (SubsystemBlackBoxHDLInstantiation)
arguments for the block.
• (Optional) a cell array of strings enumerating the available
implementations classes for the subsystem.
• (Optional) A cell array of cell arrays of strings enumerating the names
of implementation parameters corresponding to the implementation
classes. hdlnewblackbox does not list data types and other details
of implementation parameters.
hdlnewblackbox returns a forEach call for each selected block in the
model.
1-27
hdlnewblackbox
1-28
hdlnewblackbox
Tips After invoking hdlnewblackbox, you will generally want to insert the
forEach calls returned by the function into a control file, and use the
implementation information returned to specify a nondefault block
implementation.
Examples % Return a forEach call for a specific subsystem to the MATLAB workspace
hdlnewblackbox('sfir_fixed/symmetric_fir');
%
% Return forEach calls for all currently selected blocks to the MATLAB workspace
1-29
hdlnewblackbox
hdlnewblackbox;
%
% Return forEach calls, implementation names, and implementation parameter names
% for all currently selected blocks to string variables
[cmd,impl,parms] = hdlnewblackbox;
1-30
hdlnewcontrol
Purpose Construct code generation control object for use in control file
See also • “READ THIS FIRST: Control File Compatibility and Conversion
Issues”
1-31
hdlnewcontrolfile
Syntax hdlnewcontrolfile
hdlnewcontrolfile('blockpath')
hdlnewcontrolfile({'blockpath1','blockpath2',...'blockpathN'})
t = hdlnewcontrolfile(...)
1-32
hdlnewcontrolfile
1-33
hdlnewforeach
Purpose Generate forEach calls for insertion into code generation control files
Syntax 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',...})
Description 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 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.
• (Optional) A cell array of cell arrays of strings enumerating the
names of implementation parameters corresponding to the block
implementations. See “HDL Block Properties” for that data types
and other details of block implementation parameters.
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.
1-34
hdlnewforeach
1-35
hdlnewforeach
Tips 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 “External Component Interfaces”).
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.
Examples The following example generates forEach commands for two explicitly
specified blocks.
1-36
hdlnewforeach
hdlnewforeach({'sfir_fixed/symmetric_fir/Add4',...
'sfir_fixed/symmetric_fir/Product2'})
ans =
c.forEach('./symmetric_fir/Add4',...
'built-in/Sum', {},...
'default', {}); % Default architecture is 'Linear'
c.forEach('./symmetric_fir/Product2',...
'built-in/Product', {},...
'default', {}); % Default architecture is 'Linear'
impl =
{3x1 cell}
parms =
>> impl{1}
ans =
1-37
hdlnewforeach
'Linear'
'Cascade'
'Tree'ans =
>> parms{1:3}
ans =
'InputPipeline' 'OutputPipeline'
ans =
'InputPipeline' 'OutputPipeline'
ans =
'InputPipeline' 'OutputPipeline'
1-38
hdlrestoreparams
Syntax hdlrestoreparams(subsys)
hdlrestoreparams(subsys,filename)
sfir_fixed
hdlsaveparams('sfir_fixed/symmetric_fir')
1-39
hdlrestoreparams
hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3)
hdlset_param('sfir_fixed/symmetric_fir/Product',
'InputPipeline', 5)
hdlsaveparams('sfir_fixed/symmetric_fir')
hdlset_param('sfir_fixed', 'HDLSubsystem',
'sfir_fixed/symmetric_fir');
hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3);
hdlset_param('sfir_fixed/symmetric_fir/Product',
'InputPipeline', 5);
hdlsaveparams('sfir_fixed/symmetric_fir',
'sfir_saved_params.m')
hdlrestoreparams('sfir_fixed/symmetric_fir')
hdlsaveparams('sfir_fixed/symmetric_fir')
hdlset_param('sfir_fixed', 'HDLSubsystem',
'sfir_fixed');
hdlrestoreparams('sfir_fixed/symmetric_fir',
'sfir_saved_params.m')
hdlsaveparams('sfir_fixed/symmetric_fir')
1-40
hdlrestoreparams
hdlset_param('sfir_fixed', 'HDLSubsystem',
'sfir_fixed/symmetric_fir');
hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3);
hdlset_param('sfir_fixed/symmetric_fir/Product',
'InputPipeline', 5);
1-41
hdlsaveparams
Syntax hdlsaveparams(subsys)
hdlsaveparams(subsys,filename)
sfir_fixed
hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3)
hdlset_param('sfir_fixed/symmetric_fir/Product', 'InputPipeline', 5)
1-42
hdlsaveparams
hdlsaveparams('sfir_fixed/symmetric_fir')
sfir_fixed
hdlsaveparams('sfir_fixed/symmetric_fir')
hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3)
hdlset_param('sfir_fixed/symmetric_fir/Product',
'InputPipeline', 5)
hdlsaveparams('sfir_fixed/symmetric_fir')
hdlset_param('sfir_fixed', 'HDLSubsystem',
'sfir_fixed/symmetric_fir');
hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3);
hdlset_param('sfir_fixed/symmetric_fir/Product',
'InputPipeline', 5);
1-43
hdlsaveparams
hdlsaveparams('sfir_fixed/symmetric_fir',
'sfir_saved_params.m')
hdlrestoreparams('sfir_fixed/symmetric_fir')
hdlsaveparams('sfir_fixed/symmetric_fir')
hdlset_param('sfir_fixed', 'HDLSubsystem',
'sfir_fixed');
hdlrestoreparams('sfir_fixed/symmetric_fir',
'sfir_saved_params.m')
hdlsaveparams('sfir_fixed/symmetric_fir')
hdlset_param('sfir_fixed', 'HDLSubsystem',
'sfir_fixed/symmetric_fir');
hdlset_param('sfir_fixed/symmetric_fir', 'SharingFactor', 3);
hdlset_param('sfir_fixed/symmetric_fir/Product',
'InputPipeline', 5);
1-44
hdlset_param
Syntax hdlset_param(path,Name,Value)
Tips • When you set multiple parameters on the same model or block, use
a single hdlset_param command with multiple pairs of arguments,
rather than multiple hdlset_param commands. This technique
is more efficient because using a single call requires evaluating
parameters only once.
• To set HDL block parameters for multiple blocks, use the
find_system function to locate the blocks of interest. Then, use
a loop to iterate over the blocks and call hdlset_param to set the
desired parameters.
Input path
Arguments Path to the model or block for which hdlset_param is to set one or more
parameter values.
Default: None
’Name’
Name is a string specifying the name of one of the following:
1-45
hdlset_param
Default: None
’Value’
Value is a value to be applied to the corresponding property in a
Name,Value argument.
Examples The following example uses the sfir_fixed model to demonstrate how
to locate a group of blocks in a subsystem and specify the same output
pipeline depth for each of the blocks.
open sfir_fixed;
prodblocks = find_system('sfir_fixed/symmetric_fir', 'BlockType', 'Product');
for ii=1:length(prodblocks), hdlset_param(prodblocks{ii}, 'OutputPipeline', 2), end;
1-46
hdlsetup
Syntax hdlsetup('modelname')
1-47
makehdl
Syntax makehdl(model)
makehdl(model,Name,Value)
Basic Options
1-48
makehdl
Report Generation
1-49
makehdl
1-50
makehdl
Coding Style
1-51
makehdl
1-52
makehdl
1-53
makehdl
Test Bench
1-54
makehdl
Script Generation
1-55
makehdl
1-56
makehdl
1-57
makehdl
Generated Model
1-58
makehdl
Synthesis
1-59
makehdl
1-60
makehdl
1-61
makehdl
1-62
makehdl
Generate HDL code for the current model with code generation options
set to default values.
makehdl(bdroot)
1-63
makehdl
sfir_fixed;
makehdl('sfir_fixed/symmetric_fir','TargetLanguage','Verilog')
bdclose('sfir_fixed');
Check Subsystem for Compatibility with HDL Code
Generation
Check that the subsystem symmetric_fir is compatible with HDL code
generation, then generate HDL.
1-64
makehdl
sfir_fixed;
makehdl('sfir_fixed/symmetric_fir','CheckHDL','on')
bdclose('sfir_fixed');
1-65
makehdltb
Syntax makehdltb(subsys)
makehdltb(subsys,Name,Value)
Basic Options
1-66
makehdltb
Test Bench
1-67
makehdltb
1-68
makehdltb
Time after clock enable is asserted before starting output data checks,
specified in number of samples.
For more information, see IgnoreDataChecking.
1-69
makehdltb
Coding Style
Script Generation
1-70
makehdltb
1-71
makehdltb
1-72
makehdltb
1-73
makehdltb
makehdl('sfir_fixed/symmetric_fir')
1-74
makehdltb
makehdltb('sfir_fixed/symmetric_fir')
The generated VHDL test bench code is saved in the hdlsrc folder.
Generate Verilog Test Bench
Generate Verilog DUT and test bench for a subsystem.
makehdl('sfir_fixed/symmetric_fir','TargetLanguage','Verilog')
makehdltb('sfir_fixed/symmetric_fir','TargetLanguage','Verilog')
1-75
makehdltb
1-76
supportPackageInstaller
Syntax supportPackageInstaller
1-77
supportPackageInstaller
1-78
2
Supported Blocks
1-D Lookup Table
Description The 1-D Lookup Table block is a one-dimensional version of the n-D
Lookup Table block. For HDL code generation information, see n-D
Lookup Table.
2-2
2-D Lookup Table
Description The 2-D Lookup Table block is a one-dimensional version of the n-D
Lookup Table block. For HDL code generation information, see n-D
Lookup Table.
2-3
Abs
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-4
Add
Description The Add block is the same as the Sum block. For HDL code generation
information, see Sum.
2-5
Assertion
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-6
Assignment
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-7
Atomic Subsystem
Description The Atomic Subsystem block is a version of the Subsystem block. For
HDL code generation information, see Subsystem.
For information on the Simulink simulation behavior and block
parameters, see Atomic Subsystem.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-8
Bias
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-9
Bit Clear
Purpose Bit Clear implementations, properties, and restrictions for HDL code
generation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-10
Bit Concat
Purpose Bit Concat implementations, properties, and restrictions for HDL code
generation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-11
Bit Reduce
Purpose Bit Reduce implementations, properties, and restrictions for HDL code
generation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-12
Bit Rotate
Purpose Bit Rotate implementations, properties, and restrictions for HDL code
generation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-13
Bit Set
Purpose Bit Set implementations, properties, and restrictions for HDL code
generation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-14
Bit Shift
Purpose Bit Shift implementations, properties, and restrictions for HDL code
generation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-15
Bit Slice
Purpose Bit Slice implementations, properties, and restrictions for HDL code
generation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-16
Bitwise Operator
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-17
Biquad Filter
Description The Biquad Filter block is available with DSP System Toolbox™.
For information on the Simulink simulation behavior and block
parameters, see Biquad Filter.
2-18
Biquad Filter
2-19
Biquad Filter
2-20
Biquad Filter
AddPipelineRegisters Support
When you use AddPipelineRegisters, registers are placed based on
filter implementation. The pipeline register placement determines the
latency.
HDL Filter For HDL filter property descriptions, see “HDL Filter Block Properties”.
Properties
2-21
Biquad Filter
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Complex The coder supports use of complex coefficients and complex input
Coefficients signals for all filter structures of the Biquad Filter block, except
and Data decimators and interpolators. In many cases, you can use complex data
and complex coefficients in combination. The following table shows
Support
the filter structures that support complex data and/or coefficients, and
the permitted combinations.
Restrictions • Data vector and frame inputs are not supported for HDL code
generation.
2-22
Biquad Filter
2-23
BPSK Demodulator Baseband
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-24
BPSK Modulator Baseband
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-25
Bus Creator
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions Setup
2-26
Bus Creator
2-27
Bus Creator
Concepts • “Buses”
2-28
Bus Selector
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Setup
2-29
Bus Selector
Limitations
You cannot select Output as bus for HDL code generation.
Concepts • “Buses”
2-30
Chart
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-31
Chart
root level of your model, embed the chart in a subsystem and connect
the relevant signals to the subsystem inputs and outputs.
Data Types
The current release supports a subset of MATLAB data types in charts
intended for use in HDL code generation. Supported data types are
Note Results obtained from HDL code generated for models using
double or single data types might not be bit-true to results obtained
from simulation of the original model.
• Fixed point
• Boolean
Chart Initialization
You must enable the chart property Execute (enter) Chart at
Initialization. This option executes the update chart function
immediately following chart initialization. The option is required for
HDL because outputs must be available at time 0 (hardware reset).
“Execution of a Chart at Initialization” describes existing restrictions
under this property.
The reset action must not entail the delay of combinatorial logic.
Therefore, do not perform arithmetic in initialization actions.
2-32
Chart
Imported Code
A chart intended for HDL code generation must be entirely
self-contained. The following restrictions apply:
• You can define and use one and only one input event per Stateflow
chart. (There is no restriction on the number of output events you
can use.)
• The coder does not support HDL code generation for charts that have
a single input event, and which also have nonzero initial values on
the chart’s output ports.
2-33
Chart
Loops
Do not explicitly use loops other than for loops in a chart intended for
HDL code generation. Observe the following restrictions on for loops:
The for loop example, sf_for, shows a design pattern for a for loop
using a graphical function.
Other Restrictions
The coder imposes a number of additional restrictions on the use of
classic chart features. These limitations exist because HDL does not
support some features of general-purpose sequential programming
languages.
2-34
Chart
Temporal logic can be used provided the base events are limited to
these types of implicit events.
2-35
Chart
• Do not read from output ports if you do not have the Initialize
Outputs Every Time Chart Wakes Up chart option selected.
• Do not use Data Store Memory objects.
• Do not use pointer (&) or indirection (*) operators. See the discussion
of “Pointer and Address Operations”.
• If a chart gets a runtime overflow error during simulation, it is
possible to disable data range error checking and generate HDL
code for the chart. However, in such cases results obtained from the
generated HDL code might not be bit-true to results obtained from
the simulation. Recommended practice is to enable overflow checking
and eliminate overflow conditions from the model during simulation.
Related • “Generate HDL for Mealy and Moore Finite State Machines”
Examples • “Design Patterns Using Advanced Chart Features”
2-36
Check Dynamic Gap
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-37
Check Dynamic Range
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-38
Check Static Gap
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-39
Check Static Range
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-40
Check Discrete Gradient
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-41
Check Dynamic Lower Bound
Description The Check Dynamic Lower Bound block is available with Simulink.
For information on the Simulink simulation behavior and block
parameters, see Check Dynamic Lower Bound.
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-42
Check Dynamic Upper Bound
Description The Check Dynamic Upper Bound block is available with Simulink.
For information on the Simulink simulation behavior and block
parameters, see Check Dynamic Upper Bound.
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-43
Check Input Resolution
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-44
Check Static Lower Bound
Description The Check Static Lower Bound block is available with Simulink.
For information on the Simulink simulation behavior and block
parameters, see Check Static Lower Bound.
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-45
Check Static Upper Bound
Description The Check Static Upper Bound block is available with Simulink.
For information on the Simulink simulation behavior and block
parameters, see Check Static Upper Bound.
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-46
CIC Decimation
Description The CIC Decimation block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see CIC Decimation.
The coder supports both Coefficient source options (Dialog
parameters or Multirate filter object (MFILT)).
When you select Multirate filter object (MFILT), you can enter
either a filter object name or a direct filter specification in the
Multirate filter variable field.
HDL Filter For HDL filter property descriptions, see “HDL Filter Block Properties”.
Properties
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • Vector and frame inputs are not supported for HDL code generation.
2-47
CIC Decimation
2-48
CIC Interpolation
Description The CIC Interpolation block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see CIC Interpolation.
The coder supports both Coefficient source options (Dialog
parameters or Multirate filter object (MFILT)). When you select
Multirate filter object (MFILT), you can enter either a filter object
name or a direct filter specification in the Multirate filter variable
field.
HDL Filter For HDL filter property descriptions, see “HDL Filter Block Properties”.
Properties
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • Vector and frame inputs are not supported for HDL code generation.
• When you select Multirate filter object (MFILT), the filter
object specified in the Multirate filter variable field must be a
2-49
CIC Interpolation
2-50
Compare To Constant
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-51
Compare To Zero
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-52
Complex to Real-Imag
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-53
Constant
HDL
Implementations
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-54
Constant
Restrictions • The Logic Value implementation does not support the double
data type. If you specify this implementation for a Constant of type
double, a code-generation error occurs.
• For Sample time, enter -1. Delay balancing does not support an
inf sample time.
2-55
Constellation Diagram
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-56
Convert 1-D to 2-D
Description The Convert 1-D to 2-D block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Convert 1-D to 2-D.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-57
Convolutional Deinterleaver
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-58
Convolutional Deinterleaver
• Double or single data types are not supported for either input or
output signals.
• Initial conditions for the block must be set to zero.
• At least two rows of interleaving are required.
2-59
Convolutional Encoder
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
• Must be sample-based,
• Must have boolean or ufix1 data type.
• ½ to 1/7
• 2/3
• Continuous
• Reset on nonzero input via port
If you select this mode, you must select the Delay reset action
to next time step option. When you select this option, the
2-60
Convolutional Encoder
2-61
Convolutional Interleaver
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
• Double or single data types are not supported for either input or
output signals.
2-62
Convolutional Interleaver
2-63
Cosine
HDL The HDL code implements Cosine using the quarter-wave lookup table
you specify in the Simulink block parameters.
Implementations
To avoid generating a division operator (/) in the HDL code, for
Number of data points for lookup table, enter (2^n)+1, where n is
an integer.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions This block does not have restrictions for HDL code generation.
If you see the following warnings for the Sine or Cosine block, you can
ignore them:
• HDL code generation for the Lookup Table (n-D) block does
not support out-of-range inputs. Set the "Diagnostic
for out of range input" block parameter to "Error" to
suppress this warning.
• Using linear interpolation on the Lookup Table (n-D)
block, may require using a divide operator in the
generated HDL, which may not be synthesizable.
2-64
Counter Free-Running
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-65
Counter Limited
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-66
Data Type Conversion
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions If you configure a Data Type Conversion block for double to fixed-point
or fixed-point to double conversion, a warning displays during code
generation.
2-67
Data Type Duplicate
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-68
Data Type Propagation
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-69
Decrement Real World
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-70
Decrement Stored Integer
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-71
Delay
HDL To generate a reset port in the HDL code, set External reset to Level.
Implementations
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-72
Delay
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-73
Demux
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-74
Digital Filter
Description The Digital Filter block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Digital Filter.
HDL When you specify SerialPartition and ReuseAccum for a Digital Filter
block, observe the following constraints.
Implementations
• If you specify Dialog parameters as the Coefficient source:
- Set Transfer function type to FIR (all zeros).
- Select Filter structure as one of : Direct form,, Direct form
symmetric, or Direct form asymmetric.
2-75
Digital Filter
AddPipelineRegisters Support
When you use AddPipelineRegisters, registers are placed based on
filter implementation. The pipeline register placement determines the
latency.
HDL Filter For HDL filter property descriptions, see “HDL Filter Block Properties”.
Properties
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Complex The coder supports use of complex coefficients and complex input
Coefficients signals for all filter structures of the Digital Filter block, except
and Data decimators and interpolators. In many cases, you can use complex data
and complex coefficients in combination. The following table shows
Support
the filter structures that support complex data and/or coefficients, and
the permitted combinations.
2-76
Digital Filter
Restrictions • If you select the Digital Filter block Discrete-time filter object
option, you must have the DSP System Toolbox software to generate
code for the block.
• Initial conditions must be set to zero. HDL code generation is not
supported for nonzero initial states.
• The coder does not support the Digital Filter block Input port(s)
option for HDL code generation.
2-77
Direct Lookup Table (n-D)
Description The Direct Lookup Table (n-D) block is available with Simulink.
For information on the Simulink simulation behavior and block
parameters, see Direct Lookup Table (n-D).
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-78
Direct Lookup Table (n-D)
2-79
Discrete FIR Filter
Description The Discrete FIR Filter block is available with Simulink, but a DSP
System Toolbox license is required to use a filter structure other than
Direct Form.
For information on the Simulink simulation behavior and block
parameters, see Discrete FIR Filter.
2-80
Discrete FIR Filter
HDL When you specify SerialPartition and ReuseAccum for a Discrete FIR
Filter block, select Filter structure as one of the following:
Implementations
• Direct form
• Direct form symmetric
• Direct form asymmetric
HDL Filter For HDL filter property descriptions, see “HDL Filter Block Properties”.
Properties
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • The coder does not support unsigned inputs for the Discrete FIR
Filter block.
• Initial conditions must be set to zero. HDL code generation is not
supported for nonzero initial states.
• The coder does not support the following options of the Discrete FIR
Filter block:
- Filter Structure : Lattice MA
• CoeffMultipliers options are supported only when using a fully
parallel architecture. The CoeffMultipliers property is hidden
2-81
Discrete FIR Filter
from the HDL Block Properties dialog box when you select a serial
architecture.
2-82
Discrete PID Controller
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-83
Discrete Transfer Fcn
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • You must use the Inherit: Inherit via internal rule option for
data type propagation if, and only if, the input data type is double.
• Frame, matrix, and vector input data types are not supported.
• The leading denominator coefficient (a0) must be 1 or -1.
• Resource sharing
• Distributed pipelining
2-84
Discrete-Time Eye Diagram Scope
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-85
Discrete-Time Signal Trajectory Scope
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-86
Discrete-Time Integrator
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • Use of state ports is not supported for HDL code generation. Clear
the Show state port option.
• Use of external initial conditions is not supported for HDL code
generation. Set Initial condition source to Internal.
• Width of input and output signals must not exceed 32 bits.
2-87
Display
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-88
Divide
Default Mode
In default mode, the Divide block supports only integer data types for
HDL code generation.
Reciprocal Mode
The Divide block is in reciprocal mode when Number of Inputs is
set to /. In reciprocal mode, the Divide block has the HDL block
implementations described in the following table.
2-89
Divide
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Complex This block does not support code generation for division with complex
Data signals.
Support
2-90
Divide
Restrictions When you use the Divide block in reciprocal mode, the following
restrictions apply:
2-91
DocBlock
Restrictions Set the Document type parameter of the DocBlock to Text. The coder
does not support the HTML or RTF options.
2-92
Dot Product
HDL
Implementations
Implementations Description
Linear (default) Generates a chain of N operations (multipliers)
for N inputs.
Tree This implementation has minimal latency but
is large and slow. It generates a tree-shaped
structure of multipliers.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-93
Downsample
Best It is good practice to follow the Downsample block with a unit delay.
Practices This will prevent the code generator from inserting an extra bypass
register in the HDL code. See “HDL Optimized QPSK Transmitter”
for an example.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-94
DSP Constant (Obsolete)
Description HDL support for the DSP Constant (Obsolete) block will be removed in
a future release. Use the Constant block instead.
2-95
Dual Port RAM
Purpose Dual Port RAM implementations, properties, and restrictions for HDL
code generation
RAM Initialization
Code generated to initialize a RAM is intended for simulation only, and
may be ignored by synthesis tools.
Some synthesis tools may not infer RAMs with a clock enable. Set
RAMArchitecture to 'WithoutClockEnable' if your synthesis tool does
2-96
Dual Port RAM
not support RAM structures with a clock enable, and cannot map your
generated HDL code to FPGA RAM resources. To learn how to generate
RAMs without clock enables for your design, see the Getting Started
with RAM and ROM example. To open the example, type the following
command at the MATLAB prompt:
hdlcoderramrom
• Small RAM size: your synthesis tool may use registers to implement
a small RAM for better performance.
• A clock enable signal is present. You can suppress generation of a
clock enable signal in RAM blocks, as described in “Implement RAM
With or Without Clock Enable” on page 2-196.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-97
Dual Rate Dual Port RAM
Purpose Dual Rate Dual Port RAM implementations, properties, and restrictions
for HDL code generation
Description The Dual Rate Dual Port RAM block is available with Simulink.
For information on the Simulink simulation behavior and block
parameters, see Dual Rate Dual Port RAM.
RAM Initialization
Code generated to initialize a RAM is intended for simulation only, and
may be ignored by synthesis tools.
Some synthesis tools may not infer RAMs with a clock enable. Set
RAMArchitecture to WithoutClockEnable if your synthesis tool does
2-98
Dual Rate Dual Port RAM
not support RAM structures with a clock enable, and cannot map your
generated HDL code to FPGA RAM resources.
• Small RAM size: your synthesis tool may use registers to implement
a small RAM for better performance.
• A clock enable signal is present. You can suppress generation of a
clock enable signal in RAM blocks, as described in “Implement RAM
With or Without Clock Enable” on page 2-196.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-99
Enable
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-100
Enabled Subsystem
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-101
Enabled Subsystem
Restrictions The coder supports HDL code generation for enabled subsystems that
meet the following conditions:
• The DUT (i.e., the top-level subsystem for which code is generated)
must not be an enabled subsystem.
• The coder does not support subsystems that are both triggered and
enabled for HDL code generation.
• The enable signal must be a scalar.
• The data type of the enable signal must be either boolean or ufix1.
• Outputs of the enabled subsystem must have an initial value of 0.
• All inputs and outputs of the enabled subsystem (including the
enable signal) must run at the same rate.
• The Show output port parameter of the Enable block must be set
to Off.
• The States when enabling parameter of the Enable block must be
set to held (i.e., the Enable block does not reset states when enabled).
• The Output when disabled parameter for the enabled subsystem
output port(s) must be set to held (i.e., the enabled subsystem does
not reset output values when disabled).
• If the DUT contains the following blocks, RAMArchitecture must be
set to WithClockEnable:
- Dual Port RAM
- Simple Dual Port RAM
- Single Port RAM
• The following blocks are not supported in enabled subsystems
targeted for HDL code generation:
- CIC Decimation
- CIC Interpolation
- FIR Decimation
2-102
Enabled Subsystem
- FIR Interpolation
- Downsample
- Upsample
- HDL Cosimulation blocks for HDL Verifier™
- Rate Transition
- FFT
- HDL Streaming FFT
Example The Automatic Gain Controller example shows how you can use enabled
subsystems in HDL code generation. To open the example, enter:
hdlcoder_agc
2-103
Enumerated Constant
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-104
Error Rate Calculation
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-105
Extract Bits
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-106
FFT HDL Optimized
Description The FFT HDL Optimized block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see FFT HDL Optimized.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-107
FIR Decimation
Description The FIR Decimation block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see FIR Decimation.
The coder supports both Coefficient source options (Dialog
parameters or Multirate filter object (MFILT)).
When you select Multirate filter object (MFILT), you can enter
either a filter object name or a direct filter specification in the
Multirate filter variable field.
AddPipelineRegisters Support
When you use AddPipelineRegisters, registers are placed based on
filter implementation. The pipeline register placement determines the
latency.
2-108
FIR Decimation
HDL Filter For HDL filter property descriptions, see “HDL Filter Block Properties”.
Properties
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • Initial conditions must be set to zero. HDL code generation is not
supported for nonzero initial states.
• Vector and frame inputs are not supported for HDL code generation.
• When you select Multirate filter object (MFILT), the filter object
specified in the Multirate filter variable field must be either a
mfilt.firdecim object or a mfilt.firtdecim object. If you specify
some other type of filter object, an error will occur.
• When you select Dialog parameters, the following fixed-point
options are not supported for HDL code generation:
- Slope and Bias scaling
- Inherit via internal rule
• CoeffMultipliers options are supported only when using a fully
parallel architecture. The CoeffMultipliers property is hidden
from the HDL Block Properties dialog box when you select a serial
architecture.
2-109
FIR Interpolation
Description The FIR Interpolation block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see FIR Interpolation.
The coder supports both Coefficient source options (Dialog
parameters or Multirate filter object (MFILT)). When you select
Multirate filter object (MFILT), you can enter either a filter object
name or a direct filter specification in the Multirate filter variable
field.
HDL The SerialPartition property is set automatically for you on the FIR
Interpolation Block when you select Fully Serial architecture.
Implementations
Distributed Arithmetic Support
Distributed Arithmetic properties DALUTPartition and DARadix are
supported for the following filter structures.
AddPipelineRegisters Support
When you use AddPipelineRegisters, registers are placed based on
filter implementation. The pipeline register placement determines the
latency.
2-110
FIR Interpolation
HDL Filter For HDL filter property descriptions, see “HDL Filter Block Properties”.
Properties
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • Initial conditions must be set to zero. HDL code generation is not
supported for nonzero initial states.
• Vector and frame inputs are not supported for HDL code generation.
• When you select Multirate filter object (MFILT), the filter
object specified in the Multirate filter variable field must be a
mfilt.firinterp object. If you specify some other type of filter
object, an error will occur.
• When you select Dialog parameters, the following fixed-point
options are not supported for HDL code generation:
- Coefficients: Slope and Bias scaling
- Product Output: Inherit via internal rule
• CoeffMultipliers options are supported only when using a fully
parallel architecture. The CoeffMultipliers property is hidden
from the HDL Block Properties dialog box when you select a serial
architecture.
2-111
Floating Scope
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-112
Frame Conversion
Description The Frame Conversion block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Frame Conversion.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-113
From
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-114
Gain
HDL
Implementations
ConstMultiplierOptimizationDescription
2-115
Gain
ConstMultiplierOptimizationDescription
required. When you specify auto, the coder does not use
multipliers, unless conditions are such that CSD or FCSD
optimizations are not possible (for example, if the design
uses floating-point arithmetic).
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-116
General CRC Generator HDL Optimized
Description The General CRC Generator HDL Optimized block is available with
Communications System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see General CRC Generator HDL Optimized.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-117
General CRC Syndrome Detector HDL Optimized
Description The General CRC Syndrome Detector HDL Optimized block is available
with Communications System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see General CRC Syndrome Detector HDL Optimized.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-118
General Multiplexed Deinterleaver
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-119
General Multiplexed Interleaver
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-120
Goto
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-121
Ground
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-122
HDL Cosimulation
2-123
HDL Cosimulation
The requirements for using the HDL Cosimulation block for code
generation are the same as those for cosimulation. If you want
to check these conditions before initiating code generation, select
Simulation > Update Diagram.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-124
HDL Counter
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-125
HDL FIFO
Purpose HDL FIFO implementations, properties, and restrictions for HDL code
generation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-126
IFFT HDL Optimized
Description The IFFT HDL Optimized block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see IFFT HDL Optimized.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-127
Increment Real World
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-128
Increment Stored Integer
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-129
Index Vector
Description The Index Vector block is a Multiport Switch block with Number
of data ports set to 1. For HDL code generation information, see
Multiport Switch.
2-130
Inport
2-131
Integer-Input RS Encoder HDL Optimized
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-132
Integer-Output RS Decoder HDL Optimized
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-133
LMS Filter
Purpose LMS Filter implementations, properties, and restrictions for HDL code
generation
Description The LMS Filter block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see LMS Filter.
HDL By default, the LMS Filter implementation uses a linear sum for the
FIR section of the filter.
Implementations
The LMS Filter implements a tree summation (which has a shorter
critical path) under the following conditions:
HDL Filter For HDL filter property descriptions, see “HDL Filter Block Properties”.
Properties
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • The coder does not support the Normalized LMS algorithm of the
LMS Filter.
• The Reset port supports only Boolean and unsigned inputs.
2-134
LMS Filter
2-135
Logical Operator
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-136
M-PSK Demodulator Baseband
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-137
M-PSK Modulator Baseband
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-138
Magnitude-Angle to Complex
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-139
Math Function
HDL conj
Implementations
Implementations Description
ComplexConjugate Compute complex conjugate. See Math Function
in the Simulink documentation.
hermitian
Implementations Description
Hermitian Compute hermitian. See Math Function in the
Simulink documentation.
reciprocal
2-140
Math Function
transpose
Implementations Description
Transpose Compute array transpose. See Math Function in
the Simulink documentation.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Complex The conj, hermitian, and transpose functions support complex data.
Data
Support
2-141
Math Function
2-142
MATLAB Function
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • If the block contains a System object™, block inputs cannot have
non-discrete (constant or Inf) sample time.
For the MATLAB language subset supported for HDL code generation
from a MATLAB Function block, see:
2-143
MATLAB Function
2-144
MATLAB System
Description You can define a System object and use it in a MATLAB System block
for HDL code generation.
The MATLAB System block is available with Simulink.
For information on the Simulink behavior and block parameters, see
MATLAB System.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-145
Matrix Concatenate
Description The Matrix Concatenate block is the same as the Vector Concatenate
block with Mode set to Multidimensional array. For HDL code
generation information, see Vector Concatenate.
2-146
Matrix Viewer
Description The Matrix Viewer block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Matrix Viewer.
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-147
Maximum
HDL
Implementations
Implementations Description
default The Tree implementation is large and slow
Tree but has minimal latency.
Cascade This implementation is optimized for latency
* area, with medium speed. See “Cascade
Implementation Best Practices”.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-148
Memory
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-149
Minimum
HDL
Implementations
Implementations Description
default The Tree implementation is large and slow
Tree but has minimal latency.
Cascade This implementation is optimized for latency
* area, with medium speed. See “Cascade
Implementation Best Practices”.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-150
MinMax
HDL
Implementations
Implementations Description
default The Tree implementation is large and slow
Tree but has minimal latency.
Cascade This implementation is optimized for latency
* area, with medium speed. See “Cascade
Implementation Best Practices”.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-151
Model
HDL
Implementations
Implementations Description
ModelReference (default) Use the ModelReference implementation
when you want to generate code from a
referenced model and any nested models. For
more information, see “How To Generate Code
for a Referenced Model”.
BlackBox Use the BlackBox implementation to
instantiate an HDL wrapper, or black box
interface, for legacy or external HDL code. If
you specify a black box interface, the coder
does not attempt to generate HDL code for the
referenced model.
For more information, see “Generate Black
Box Interface for Referenced Model”.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions When you generate HDL code for referenced models, the following
limitations apply:
• Block parameters for the Model block must be set to their default
values.
2-152
Model
• If multiple model references refer to the same model, their HDL block
properties must be the same.
• Referenced models cannot be protected models.
• Hierarchical distributed pipelining must be disabled.
• Distributed pipelining
• Constrained output pipelining
2-153
Model Info
Purpose Model Info implementations, properties, and restrictions for HDL code
generation
2-154
Model Variants
Description The Model Variants block is a version of the Model block. For HDL code
generation information, see Model.
2-155
Multiport Selector
Description The Multiport Selector block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Multiport Selector.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-156
Multiport Switch
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Example You can set Data port order to Specify indices, and enter
enumeration values for the Data port indices. For example, you can
connect the Enumerated Constant block to the Multiport Switch control
port and use the enumerated types as data port indices.
2-157
Multiport Switch
2-158
Mux
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-159
n-D Lookup Table
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-160
n-D Lookup Table
2-161
NCO
Description HDL support for the NCO block will be removed in a future release.
Use the NCO HDL Optimized block instead.
2-162
NCO HDL Optimized
Description The NCO HDL Optimized block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see NCO HDL Optimized.
HDL Filter For HDL filter property descriptions, see “HDL Filter Block Properties”.
Properties
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-163
Outport
2-164
PN Sequence Generator
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions Inputs:
• You can select Input port as the Output mask source on the
block. However, in this case the Mask input signal must be a vector
of data type ufix1.
• If Reset on nonzero input is selected, the input to the Rst port
must have data type Boolean.
Outputs:
• Outputs of type double are not supported for HDL code generation.
All other output types (including bit packed outputs) are supported.
2-165
Prelookup
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-166
Prelookup
2-167
Product
HDL
Implementations
Implementations Description
Linear (default) Generates a chain of N operations (multipliers)
for N inputs.
Tree This implementation has minimal latency but
is large and slow. It generates a tree-shaped
structure of multipliers.
Note: Product blocks that have a vector input
with two or more elements support Tree and
Cascade.
Cascade This implementation optimizes latency * area
and is faster than the Tree implementation.
It computes partial products and cascades
multipliers.
Note: Product blocks that have a vector input
with two or more elements support Tree and
Cascade.
See “Cascade Implementation Best Practices”.
Divide Mode
For block implementations of the Product block in divide mode, see
Divide.
2-168
Product
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-169
Product of Elements
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-170
QPSK Demodulator Baseband
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-171
QPSK Modulator Baseband
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-172
Rate Transition
Best It is good practice to follow the Rate Transition block with a unit delay.
Practices This will prevent the code generator from inserting an extra bypass
register in the HDL code.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-173
Real-Imag to Complex
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-174
Reciprocal
Description The Reciprocal block is the Divide block with Number of Inputs is set
to /. For HDL code generation information, see Divide.
2-175
Reciprocal Sqrt
HDL
Implementations
Implementations Description
SqrtFunction (default) Use the iterative Newton method. Select this
RecipSqrtNewton option to optimize area.
RecipSqrtNewtonSingleRate Use the single rate pipelined Newton method.
Select this option to optimize speed, or if you
want a single rate implementation.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • In the Block Parameters dialog box, in the Algorithm tab, for
Method, you must select Newton-Raphson.
• Input must be an unsigned scalar value.
• Output is a fixed-point scalar value.
2-176
Rectangular QAM Demodulator Baseband
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • The block does not support single or double data types for HDL code
generation.
• The coder supports the following Output type options:
- Integer
- Bit is supported only if the Decision Type selected is Hard
decision.
• The coder requires that Normalization Method be set to Minimum
Distance Between Symbols, with a Minimum distance of 2.
• The coder requires that Phase offset (rad) be set to a value that is
multiple a of pi/4.
2-177
Rectangular QAM Modulator Baseband
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • The block does not support single or double data types for HDL code
generation.
• When Input Type is set to Bit, the block does not support HDL code
generation for input types other than boolean or ufix1.
2-178
Relational Operator
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-179
Relay
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-180
Repeat
Best The Repeat block uses fewer hardware resources than the Upsample
Practices block. Use the Repeat block if your algorithm does not require
zero-padding upsampling.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-181
Reshape
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-182
Saturation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-183
Saturation Dynamic
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-184
Scope
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-185
Selector
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-186
Shift Arithmetic
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Complex Data Support
This block supports code generation for complex signals.
Restrictions In the Function Block Parameters dialog box, for Bits to shift, you
must set Source to Dialog. The Input port option is not supported
for HDL code generation.
2-187
Sign
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-188
Signal Conversion
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-189
Signal Specification
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-190
Signal To Workspace
Description The Signal To Workspace block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Signal To Workspace.
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-191
Simple Dual Port RAM
Description The Simple Dual Port RAM block is available with Simulink.
For information on the Simulink simulation behavior and block
parameters, see Simple Dual Port RAM.
Some synthesis tools may not infer RAMs with a clock enable. Set
RAMArchitecture to WithoutClockEnable if your synthesis tool does
not support RAM structures with a clock enable, and cannot map your
2-192
Simple Dual Port RAM
hdlcoderramrom
• Small RAM size: your synthesis tool may use registers to implement
a small RAM for better performance.
• A clock enable signal is present. You can suppress generation of a
clock enable signal in RAM blocks, as described in “Implement RAM
With or Without Clock Enable” on page 2-196.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-193
Sine
HDL The HDL code implements Sine using the quarter-wave lookup table
you specify in the Simulink block parameters.
Implementations
To avoid generating a division operator (/) in the HDL code, for
Number of data points for lookup table, enter (2^n)+1, where n is
an integer.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions This block does not have restrictions for HDL code generation.
If you see the following warnings for the Sine or Cosine block, you can
ignore them:
• HDL code generation for the Lookup Table (n-D) block does
not support out-of-range inputs. Set the "Diagnostic
for out of range input" block parameter to "Error" to
suppress this warning.
• Using linear interpolation on the Lookup Table (n-D)
block, may require using a divide operator in the
generated HDL, which may not be synthesizable.
2-194
Sine Wave
Purpose Sine Wave implementations, properties, and restrictions for HDL code
generation
Description The Sine Wave block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Sine Wave.
Restrictions For HDL code generation, you must select the following Sine Wave
block settings:
Output:
2-195
Single Port RAM
Purpose Single Port RAM implementations, properties, and restrictions for HDL
code generation
Some synthesis tools may not infer RAMs with a clock enable. Set
RAMArchitecture to WithoutClockEnable if your synthesis tool does
not support RAM structures with a clock enable, and cannot map your
2-196
Single Port RAM
hdlcoderramrom
• Small RAM size: your synthesis tool may use registers to implement
a small RAM for better performance.
• A clock enable signal is present. You can suppress generation of a
clock enable signal in RAM blocks, as described in “Implement RAM
With or Without Clock Enable” on page 2-196.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-197
Spectrum Analyzer
Description The Spectrum Analyzer block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Spectrum Analyzer.
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-198
Sqrt
HDL
Implementations
2-199
Sqrt
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-200
State Transition Table
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-201
Stop Simulation
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-202
Subsystem
HDL
Implementations
Implementation Description
Module (default) Generate code for the subsystem and the blocks within the
subsystem.
AlteraBlackBox Specify an Altera DSP Builder Subsystem.
BlackBox Generate a black-box interface. That is, the generated HDL code
includes only the input/output port definitions for the subsystem.
In this way, you can use a subsystem in your model to generate an
interface to existing manually written HDL code.
The black-box interface generated for subsystems is similar to the
interface generated for Model blocks, but without generation of
clock signals.
No HDL Remove the subsystem from the generated code. You can use the
subsystem in simulation but treat it as a “no-op” in the HDL code.
XilinxBlackBox Specify a Xilinx System Generator Subsystem.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-203
Subtract
Description The Subtract block is a Sum block with List of signs set to +-. For
HDL code generation information, see Sum.
For information on the Simulink simulation behavior and block
parameters, see Subtract.
2-204
Sum
The coder supports Tree and Cascade implementations for Sum blocks
that have a single vector input with multiple elements.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-205
Sum of Elements
Description The Sum of Elements block is a Sum block with more than two inputs.
For HDL code generation information, see Sum.
For information on the Simulink simulation behavior and block
parameters, see Sum of Elements.
2-206
Switch
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-207
Tapped Delay
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-208
Terminator
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-209
Time Scope
Purpose Time Scope implementations, properties, and restrictions for HDL code
generation
Description The Time Scope block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Time Scope.
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-210
To File
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-211
To VCD File
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-212
To Workspace
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-213
Trigger
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-214
Triggered Subsystem
• If the trigger source is a Signal Builder block, but the other triggered
subsystem inputs come from other sources, insert a Rate Transition
block into the signal path before the trigger input.
2-215
Triggered Subsystem
• If all inputs (including the trigger) come from a Signal Builder block,
they have the same rate, so special action is not required.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions The coder supports HDL code generation for triggered subsystems that
meet the following conditions:
• The DUT (that is, the top-level subsystem for which code is
generated) must not be a triggered subsystem.
• The coder does not support subsystems that are both triggered and
enabled for HDL code generation.
• The trigger signal must be a scalar.
• The data type of the trigger signal must be either boolean or ufix1.
• Outputs of the triggered subsystem must have an initial value of 0.
• All inputs and outputs of the triggered subsystem (including the
trigger signal) must run at the same rate. (See “Using the Signal
Builder Block” on page 2-215 for information on a special case.)
• The Show output port parameter of the Trigger block must be set
to Off.
• If the DUT contains the following blocks, RAMArchitecture must be
set to WithClockEnable:
- Dual Port RAM
2-216
Triggered Subsystem
2-217
Trigonometric Function
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions The Trigonometric Function block supports HDL code generation for
the following functions:
For the sin and cos functions, unsigned data types are supported for
CORDIC approximations.
The coder gives an error when:
2-218
Truth Table
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-219
Unary Minus
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-220
Unit Delay
Purpose Unit Delay implementations, properties, and restrictions for HDL code
generation
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-221
Unit Delay Enabled
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-222
Unit Delay Enabled Resettable
Description The Unit Delay Enabled Resettable block is available with Simulink.
For information on the Simulink simulation behavior and block
parameters, see Unit Delay Enabled Resettable.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-223
Unit Delay Resettable
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-224
Upsample
Best Consider whether your model can use the Repeat block instead of
Practices Upsample. The Repeat block uses fewer hardware resources, so it is
a best practice to only use Upsample when your algorithm requires
zero-padding upsampling.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-225
Variable Selector
Description The Variable Selector block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Variable Selector.
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-226
Variant Subsystem
HDL The coder generates code for only the active variant.
Implementations
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-227
Vector Concatenate
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-228
Vector Scope
Description The Vector Scope block is available with DSP System Toolbox.
For information on the Simulink simulation behavior and block
parameters, see Vector Scope.
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-229
Viterbi Decoder
2-230
Viterbi Decoder
See the “HDL Code Generation for Viterbi Decoder” example model for
an example using TracebackStagesPerPipeline.
RAM-Based Traceback
Instead of using registers, you can choose to use RAMs to save the
survivor branch information.
2-231
Viterbi Decoder
2-232
Viterbi Decoder
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
Restrictions • Punctured code: Do not select this option. Punctured code requires
frame-based input, which the coder does not support.
• Decision type: the coder does not support the Unquantized decision
type.
• Error if quantized input values are out of range: The coder
does not support this option.
• Operation mode: The coder supports only the Continuous mode.
• Enable reset input port: HDL support is provided when you
enable both Enable reset input port and Delay reset action to
next time step. You must select Continuous operation mode.
2-233
Viterbi Decoder
Example The “HDL Code Generation for Viterbi Decoder” example demonstrates
HDL code generation for a fixed-point Viterbi Decoder block, with
pipelined traceback decoding. To open the example, type the following
command:
showdemo commviterbihdl_m
2-234
Waterfall
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-235
Zero-Order Hold
HDL Block For HDL block property descriptions, see “HDL Block Properties”.
Properties
2-236
XY Graph
HDL The coder does not generate HDL code for this block when you use it
in your model.
Implementations
2-237
XY Graph
2-238
3
Properties — Alphabetical
List
BalanceDelays property
Usage You can further control delay balancing within the model by disabling
Notes or enabling delay balancing for subsystems within the model.
3-2
BlockGenerateLabel property
Purpose Specify string to append to block labels used for HDL GENERATE
statements
Settings 'string'
Default: '_gen'
Specify a postfix string to append to block labels used for HDL GENERATE
statements.
3-3
CheckHDL property
Settings 'on'
Selected
Check the model or subsystem for HDL compatibility before generating
code, and report problems encountered. This is equivalent to executing
the checkhdl function before calling makehdl.
'off' (default)
Cleared (default)
Do not check the model or subsystem for HDL compatibility before
generating code.
3-4
ClockEdge property
3-5
ClockEnableInputPort property
Purpose Name HDL port for model’s clock enable input signals
Settings 'string'
Default: 'clk_enable'
The string specifies the name for the model’s clock enable input port.
If you override the default with (for example) the string
'filter_clock_enable' for the generating subsystem filter_subsys,
the generated entity declaration might look as follows:
ENTITY filter_subsys IS
PORT( clk : IN std_logic;
filter_clock_enable : IN std_logic;
reset : IN std_logic;
filter_subsys_in : IN std_logic_vector (15 DOWNTO 0);
filter_subsys_out : OUT std_logic_vector (15 DOWNTO 0);
);
END filter_subsys;
Usage The clock enable signal is asserted active high (1). Thus, the input value
Notes must be high for the generated entity’s registers to be updated.
3-6
ClockEnableOutputPort property
Settings 'string'
Default: 'ce_out'
The string specifies the name for the generated clock enable output port.
A clock enable output is generated when the design requires one.
3-7
ClockHighTime property
Purpose Specify period, in nanoseconds, during which test bench drives clock
input signals high (1)
Settings ns
Default: 5
The clock high time is expressed as a positive integer.
The ClockHighTime and ClockLowTime properties define the period and
duty cycle for the clock signal. Using the defaults, the clock signal is a
square wave (50% duty cycle) with a period of 10 ns.
3-8
ClockInputs property
makehdl(gcb, 'ClockInputs','Multiple');
3-9
ClockInputPort property
Settings 'string'
Default: 'clk'.
The string specifies the clock input port name.
If you override the default with (for example) the string 'filter_clock'
for the generated entity my_filter, the generated entity declaration
might look as follows:
ENTITY my_filter IS
PORT( filter_clock : IN std_logic;
clk_enable : IN std_logic;
reset : IN std_logic;
my_filter_in : IN std_logic_vector (15 DOWNTO 0); -- sfix16_En15
my_filter_out : OUT std_logic_vector (15 DOWNTO 0); -- sfix16_En15
);
END my_filter;
3-10
ClockLowTime property
Purpose Specify period, in nanoseconds, during which test bench drives clock
input signals low (0)
Settings Default: 5
The clock low time is expressed as a positive integer.
3-11
ClockProcessPostfix property
Settings 'string'
Default: '_process'.
The coder uses process blocks for register operations. The label for each
of these blocks is derived from a register name and the postfix _process.
For example, the coder derives the label delay_pipeline_process in
the following block declaration from the register name delay_pipeline
and the default postfix string _process:
delay_pipeline_process : PROCESS (clk, reset)
BEGIN
.
.
.
3-12
CodeGenerationOutput property
Settings 'string'
Default: 'GenerateHDLCode'
Generate code but do not display the generated model.
'GenerateHDLCodeAndDisplayGeneratedModel'
Generate both code and model, and display model when completed.
'DisplayGeneratedModelOnly'
Create and display generated model, but do not proceed to code
generation.
3-13
ComplexImagPostfix property
Settings 'string'
Default: '_im'.
3-14
ComplexRealPostfix property
Settings 'string'
Default: '_re'.
3-15
DateComment property
-- ----------------------------------------------------
--
-- File Name: hdlsrc\symmetric_fir.vhd
-- Created: 2011-02-14 07:21:36
--
'off'
Omit time/date information in the generated HDL file header.
-- ----------------------------------------------------
--
-- File Name: hdlsrc\symmetric_fir.vhd
--
By omitting the time/date information in the file header, you can more
easily determine if two HDL files contain identical code. You can also
avoid extraneous revisions of the same file when checking in HDL files
to a source code management (SCM) system.
3-16
DistributedPipeliningPriority property
3-17
EDAScriptGeneration property
3-18
EnablePrefix property
Purpose Specify base name string for internal clock enables in generated code
Settings 'string'
Default: 'enb'
Specify the string used as the base name for internal clock enables and
other flow control signals in generated code.
3-19
EntityConflictPostfix property
Settings 'string'
Default: '_block'
The specified postfix resolves duplicate VHDL entity or Verilog module
names.
For example, if the coder detects two entities with the name MyFilter,
the coder names the first entity MyFilter and the second entity
MyFilter_block.
3-20
ForceClock property
3-21
ForceClockEnable property
Purpose Specify whether test bench forces clock enable input signals
3-22
ForceReset property
3-23
GenerateCoSimBlock property
Settings 'on'
If your installation includes one or more of the following HDL simulation
features, the coder generates an HDL Cosimulation block for each:
3-24
GenerateCoSimModel property
Purpose Generate model containing HDL Cosimulation block for use in testing
DUT
3-25
GeneratedModelName property
Settings 'string'
By default, the name of a generated model is the same as that of
the original model. Assign a string value to GeneratedModelName to
override the default.
3-26
GeneratedModelNamePrefix property
Settings 'string'
Default: 'gm_'
The specified string is prepended to the name of the generated model.
3-27
GenerateHDLCode property
See Also “Generate HDL Code Using the Configuration Parameters Dialog Box”
3-28
GenerateValidationModel property
Settings 'on'
Generate a validation model that highlights generated delays and other
differences between your original model and the generated model. With
a validation model, you can observe the effects of streaming, resource
sharing, and delay balancing.
'off' (default)
Do not generate a validation model.
3-29
GenerateWebview property
Settings 'on'
Include model Web view in the code generation report.
'off' (default)
Omit model Web view in the code generation report.
Usage With a model Web view, you can click a link in the generated code to
Notes highlight the corresponding block in the model.
3-30
HandleAtomicSubsystem property
3-31
HDLCodingStandard property
Purpose Generate HDL code that follows the specified coding standard.
3-32
HDLCompileInit property
Settings 'string'
Default: 'vlib work\n'.
3-33
HDLCompileTerm property
Settings 'string'
The default is the null string ('').
3-34
HDLCompileFilePostfix property
Purpose Specify postfix string appended to file name for generated Mentor
Graphics ModelSim compilation scripts
Settings 'string'
Default:'_compile.do'.
For example, if the name of the device under test or test bench is
my_design, the coder adds the postfix _compile.do to form the name
my_design_compile.do.
3-35
HDLCompileVerilogCmd property
Purpose Specify command string written to compilation script for Verilog files
Settings 'string'
Default: 'vlog %s %s\n'.
The two arguments are the contents of the SimulatorFlags property
and the file name of the current module. To omit the flags, set
SimulatorFlags to '' (the default).
3-36
HDLCompileVHDLCmd property
Purpose Specify command string written to compilation script for VHDL files
Settings 'string'
Default: 'vcom %s %s\n'.
The two arguments are the contents of the SimulatorFlags property
and the file name of the current entity. To omit the flags, set
SimulatorFlags to '' (the default).
3-37
HDLControlFiles property
Settings {'string'}
Pass in a cell array containing a string that specifies a control file to
be attached to the current model. Defaults are
Usage To clear the property (so that control files are not invoked during code
Notes generation), pass in a cell array containing the null string, as in the
following example:
makehdl(gcb,'HDLControlFiles',{''});
See Also For a detailed description of the structure and use of control files, see
“Code Generation Control Objects and Methods”.
3-38
HDLMapFilePostfix property
Purpose Specify postfix string appended to file name for generated mapping file
Settings 'string'
Default: '_map.txt'.
For example, if the name of the device under test is my_design, the
coder adds the postfix _map.txt to form the name my_design_map.txt.
3-39
HDLSimCmd property
Settings 'string'
Default: 'vsim -novopt work.%s\n'.
The implicit argument is the top-level module or entity name.
3-40
HDLSimInit property
Settings 'string'
The default string is
['onbreak resume\n',...
'onerror resume\n']
3-41
HDLSimFilePostfix property
Purpose Specify postfix string appended to file name for generated Mentor
Graphics ModelSim simulation scripts
Settings 'string'
Default: _sim.do.
For example, if the name of your test bench file is my_design, the coder
adds the postfix _sim.do to form the name my_design_tb_sim.do.
3-42
HDLSimTerm property
Settings 'string'
Default: 'run -all\n'.
3-43
HDLSimViewWaveCmd property
Settings 'string'
Default: 'add wave sim:%s\n'
The implicit argument adds the signal paths for the DUT top-level
input, output, and output reference signals.
3-44
HDLLintCmd property
Settings 'string'
Default: ''
Specify the HDL lint tool command in the Tcl script. The command
string must contain %s, which is a placeholder for the HDL file name.
Dependencies If HDLLintCmd is set to the default value, '', and you set HDLLintCmd to
one of the supported third-party tools, the coder automatically inserts a
tool-specific default command in the Tcl script.
Usage If you set HDLLintTool to Custom, you must use %s as a placeholder for
the HDL file name in the generated Tcl script. Specify HDLLintCmd
using the following format:
3-45
HDLLintInit property
Settings 'string'
Default: ''
Specify the HDL lint script initialization string.
Dependencies If HDLLintInit is set to the default value, '', and you set HDLLintCmd
to one of the supported third-party tools, the coder automatically inserts
a tool-specific default initialization string in the Tcl script.
3-46
HDLLintTerm property
Settings 'string'
Default: ''
Specify the HDL lint script termination string.
Dependencies If HDLLintTerm is set to the default value, '', and you set HDLLintCmd
to one of the supported third-party tools, the coder automatically inserts
a tool-specific default termination string in the Tcl script.
3-47
HDLLintTool property
Purpose Select HDL lint tool for which the coder generates scripts
Settings 'string'
Default: 'None'.
HDLLintTool enables or disables generation of scripts for third-party
HDL lint tools. By default, the coder does not generate a lint script.
To generate a script for one of the supported lint tools, set HDLLintTool
to one of the following strings:
Dependencies If you set HDLLintTool to one of the supported third-party tools, you can
generate a Tcl script without setting HDLLintInit, HDLLintCmd, and
HDLLintTerm to nondefault values. If the HDLLintInit, HDLLintCmd,
and HDLLintTerm have default values, the coder automatically writes
tool-specific default initialization, command, and termination strings
to the Tcl script.
See Also
Properties HDLLintCmdHDLLintInitHDLLintTerm
3-48
HDLLintTool property
3-49
HDLSynthCmd property
Settings 'string'
Default: none.
Your choice of synthesis tool (see HDLSynthTool) sets the synthesis
command string. The default string is a format string passed to
fprintf to write the command section of the synthesis script. The
implicit argument is the top-level module or entity name. The content
of the string is specific to the selected synthesis tool.
3-50
HDLSynthFilePostfix property
Purpose Specify postfix string appended to file name for generated synthesis
scripts
Settings 'string'
Default: The value of HDLSynthFilePostfix normally defaults to
a string that corresponds to the synthesis tool that HDLSynthTool
specifies.
For example, if the value of HDLSynthTool is 'Synplify',
HDLSynthFilePostfix defaults to the string '_synplify.tcl'. Then,
if the name of the device under test is my_design, the coder adds
the postfix _synplify.tcl to form the synthesis script file name
my_design_synplify.tcl.
3-51
HDLSynthInit property
Settings 'string'
Default: none
Your choice of synthesis tool (see HDLSynthTool) sets the synthesis
initialization string. The default string is a format string passed to
fprintf to write the initialization section of the synthesis script. The
default string is a synthesis project creation command. The implicit
argument is the top-level module or entity name. The content of the
string is specific to the selected synthesis tool.
3-52
HDLSynthTerm property
Settings 'string'
Default: none
Your choice of synthesis tool (see HDLSynthTool) sets the synthesis
termination string. The default string is a format string passed to
fprintf to write the termination and clean up section of the synthesis
script. This section does not take arguments. The content of the string
is specific to the selected synthesis tool.
3-53
HDLSynthTool property
Purpose Select synthesis tool for which the coder generates scripts
Settings 'string'
Default: 'None'.
HDLSynthTool enables or disables generation of scripts for third-party
synthesis tools. By default, the coder does not generate a synthesis
script. To generate a script for one of the supported synthesis tools, set
HDLSynthTool to one of the following strings:
3-54
HDLSynthTool property
3-55
HierarchicalDistPipelining property
Settings 'on'
Enable retiming across a subsystem hierarchy. The coder applies
retiming hierarchically down, until it reaches a subsystem where
DistributedPipelining is off.
'off' (default)
Distribute pipelining only within a subsystem.
3-56
HighlightAncestors property
3-57
HighlightColor property
Settings 'string'
Default: 'cyan'.
Specify the color as one of the following color string values:
• 'cyan'
• 'yellow'
• 'magenta'
• 'red'
• 'green'
• 'blue'
• 'white'
• 'black'
3-58
HoldInputDataBetweenSamples property
Purpose Specify how long subrate signal values are held in valid state
Usage In most cases, the default ('on') is the best setting for this property.
Notes This setting matches the behavior of a Simulink simulation, in which
subrate signals are held valid through each base-rate clock period.
In some cases (for example modeling memory or memory interfaces),
it is desirable to set HoldInputDataBetweenSamples to 'off'. In this
way, you can obtain diagnostic information about when data is in an
invalid ('X') state.
3-59
HoldTime property
Purpose Specify hold time for input signals and forced reset input signals
Settings ns
Default: 2
Specify the number of nanoseconds during which the model’s data input
signals and forced reset input signals are held past the clock rising edge.
The hold time is expressed as a positive integer.
This option applies to reset input signals only if forced resets are
enabled.
Usage The hold time is the amount of time that reset input signals and input
Notes data are held past the clock rising edge. The following figures show the
application of a hold time (thold) for reset and data input signals when
the signals are forced to active high and active low.
Clock
Reset Input
Active High
thold
Reset Input
Active Low
thold
3-60
HoldTime property
Clock
Data Input
thold
Note A reset signal is always asserted for two cycles plus thold.
3-61
IgnoreDataChecking property
Settings N
Default: 0.
N must be a positive integer.
When N > 0, the test bench suppresses output data checking for the first
N output samples after the clock enable output (ce_out) is asserted.
3-62
IgnoreDataChecking property
3-63
InitializeBlockRAM property
Purpose Enable or suppress generation of initial signal value for RAM blocks
Usage This property applies to RAM blocks in the HDL Operations block
Notes library:
3-64
InitializeTestBenchInputs property
Purpose Specify initial value driven on test bench inputs before data is asserted
to DUT
Settings 'on'
Initial value driven on test bench inputs is'0'.
'off' (default)
Initial value driven on test bench inputs is 'X' (unknown).
3-65
InlineConfigurations property
Usage VHDL configurations can be either inline with the rest of the VHDL
Notes code for an entity or external in separate VHDL source files. By default,
the coder includes configurations for a model within the generated
VHDL code. If you are creating your own VHDL configuration files, you
should suppress the generation of inline configurations.
3-66
InlineMATLABBlockCode property
Settings 'on'
Inline HDL code for MATLAB Function blocks to avoid instantiation
of code for custom blocks.
'off' (default)
Instantiate HDL code for MATLAB Function blocks and do not inline.
mdl = 'my_custom_block_model';
hdlset_param(mdl,'InlineMATLABBlockCode','on');
mdl = 'my_custom_block_model';
hdlset_param(mdl,'InlineMATLABBlockCode','off');
3-67
InputType property
3-68
InstanceGenerateLabel property
Settings 'string'
Default: '_gen'
Specify a postfix string to append to instance section labels in VHDL
GENERATE statements.
3-69
InstancePostfix property
Settings 'string'
Default: '' (no postfix appended)
Specify a string to be appended to component instance names in
generated code.
3-70
InstancePrefix property
Settings 'string'
Default: 'u_'
Specify a string to be prefixed to component instance names in
generated code.
3-71
LoopUnrolling property
Purpose Specify whether VHDL FOR and GENERATE loops are unrolled and
omitted from generated VHDL code
Settings 'on'
Selected
Unroll and omit FOR and GENERATE loops from the generated VHDL code.
In Verilog code, loops are always unrolled.
If you are using an electronic design automation (EDA) tool that does
not support GENERATE loops, you can enable this option to omit loops
from your generated VHDL code.
'off' (default)
Cleared (default)
Include FOR and GENERATE loops in the generated VHDL code.
Usage The setting of this option does not affect results obtained from
Notes simulation or synthesis of generated VHDL code.
3-72
MaskParameterAsGeneric property
Purpose Generate reusable HDL code for subsystems with identical mask
parameters that differ only in value
Settings 'on'
Generate one HDL file for multiple masked subsystems with different
values for tunable mask parameters. The coder automatically detects
atomic subsystems with tunable mask parameters that are sharable.
Inside the subsystem, you can use the mask parameter only in the
following blocks and parameters:
'off' (default)
Generate a separate HDL file for each masked subsystem.
3-73
MaxComputationLatency property
Purpose Specify the maximum number of time steps for which your DUT inputs
are guaranteed to be stable
Settings 1 (default)
DUT input data can change every cycle.
N, where N is an integer greater than 1
DUT input data can change every N cycles.
3-74
MaxOversampling property
Settings 0 (default)
Do not set a limit on the maximum sample rate.
1
Do not allow oversampling.
N, where N is an integer greater than 1
Allow oversampling up to N times the original model sample rate.
3-75
RAMArchitecture property
Purpose Select RAM architecture with or without clock enable for all RAMs
in DUT subsystem
3-76
MinimizeClockEnables property
Settings 'on'
Omit generation of clock enable logic for single-rate designs, wherever
possible (see “Usage Notes” on page 3-77). The following VHDL code
example does not define or examine a clock enable signal. When the
clock signal (clk) goes high, the current signal value is output.
'off' (default)
Generate clock enable logic. The following VHDL code extract
represents a register with a clock enable (enb)
Usage In some cases, the coder emits clock enables even when
Notes MinimizeClockEnables is 'on'. These cases are:
3-77
MinimizeClockEnables property
• Multirate models.
• The coder emits clock enables for the following blocks:
- commseqgen2/PN Sequence Generator
- dspsigops/NCO
Note HDL support for the NCO block will be removed in a future
release. Use the NCO HDL Optimized block instead.
- dspsrcs4/Sine Wave
- hdldemolib/HDL FFT
- built-in/DiscreteFir
- dspmlti4/CIC Decimation
- dspmlti4/CIC Interpolation
- dspmlti4/FIR Decimation
- dspmlti4/FIR Interpolation
- dspadpt3/LMS Filter
- dsparch4/Biquad Filter
- dsparch4/Digital Filter
3-78
MinimizeIntermediateSignals property
Purpose Specify whether to optimize HDL code for debuggability or code coverage
Settings 'on'
Optimize for code coverage by minimizing intermediate signals. For
example, suppose that the generated code with this setting off is:
3-79
ModulePrefix property
Settings 'string'
Default: ''
Specify a prefix for every module or entity name in the generated HDL
code. The coder also applies this prefix to generated script file names.
Usage You can specify the module name prefix to avoid name collisions if you
Notes plan to instantiate the generated HDL code multiple times in a larger
system.
For example, suppose you have a DUT, myDut, containing an internal
module, myUnit. You can prefix the modules within your design with
the string, unit1_, by entering the following command:
In the generated code, your HDL module names are unit1_myDut and
unit1_myUnit, with corresponding HDL file names. Generated script
file names also have the unit1_ prefix.
3-80
MulticyclePathInfo property
Purpose Generate text file that reports multicycle path constraint information
for use with synthesis tools
Settings 'on'
Selected
Generate a multicycle path information file.
'off' (default)
Do not generate a multicycle path information file.
Usage The file name for the multicycle path information file derives from the
Notes name of the DUT and the postfix string '_constraints', as follows:
DUTname_constraints.txt
For example, if the DUT name is symmetric_fir, the name of the
multicycle path information file is symmetric_fir_constraints.txt.
3-81
MultifileTestBench property
Purpose Divide generated test bench into helper functions, data, and HDL test
bench code files
Settings 'on'
Write separate files for test bench code, helper functions, and test
bench data. The file names are derived from the name of the DUT, the
TestBenchPostfix property, and the TestBenchDataPostfix property
as follows:
DUTname_TestBenchPostfix_TestBenchDataPostfix
For example, if the DUT name is symmetric_fir, and the target
language is VHDL, the default test bench file names are:
'off' (default)
Write a single test bench file containing the HDL test bench code and
helper functions and test bench data.
3-82
OptimizationReport property
Settings 'on'
Create and display an HTML optimization report.
'off' (default)
Do not create an HTML optimization report.
3-83
OptimizeTimingController property
3-84
OutputGenerateLabel property
Purpose Specify string that labels output assignment block for VHDL GENERATE
statements
Settings 'string'
Default: 'outputgen'
Specify a postfix string to append to output assignment block labels
in VHDL GENERATE statements.
3-85
OutputType property
3-86
Oversampling property
Settings N
Default: 1.
N must be an integer greater than or equal to 0.
Oversampling specifies N, the oversampling factor of a global
oversampling clock. The oversampling factor expresses the global
oversampling clock rate as a multiple of your model’s base rate.
When you specify an oversampling factor greater than 1, the coder
generates the global oversampling clock and derives the required timing
signals from the clock signal. By default, the coder does not generate a
global oversampling clock.
Generation of the global oversampling clock affects only generated HDL
code. The clock does not affect the simulation behavior of your model.
If you want to generate a global oversampling clock:
3-87
PackagePostfix property
Settings 'string'
Default: '_pkg'
The coder applies this option only if a package file is required for the
design.
3-88
PipelinePostfix property
Settings 'string'
Default: '_pipe'
When you specify a generation of input and/or output pipeline registers
for selected blocks, the coder appends the string specified by the
PipelinePostfix property when generating code for such pipeline
registers.
For example, suppose you specify a pipelined output implementation for
a Product block in a model, as in the following code:
hdlset_param('sfir_fixed/symmetric_fir/Product','OutputPipeline', 2)
makehdl(gcs,'PipelinePostfix','testpipe');
The following excerpt from generated VHDL code shows process the
PROCESS code, with postfixed identifiers, that implements two pipeline
stages:
3-89
PipelinePostfix property
3-90
PreserveDesignDelays property
Settings 'on'
Prevent distributed pipelining from moving design delays, such as:
'off' (default)
Allow distributed pipelining to move design delays.
3-91
RAMMappingThreshold property
Purpose Specify the minimum RAM size required for mapping to RAMs instead
of registers
Settings N
Default: 256.
N must be an integer greater than or equal to 0.
RAMMappingThreshold defines the minimum RAM size required for
mapping to RAM instead of registers. This threshold applies to:
• Delay blocks
• Persistent variables in MATLAB Function blocks
Example To change the RAM mapping threshold for a model, use the
hdlset_param function. For example:
That command sets the threshold for the sfir_fixed model to 1024 bits.
3-92
RequirementComments property
See Also “Create and Use Code Generation Reports”, “Generate Code with
Annotations or Comments”, Traceability
3-93
ReservedWordPostfix property
Settings 'string'
Default: '_rsvd'.
The reserved word postfix is applied identifiers (for entities, signals,
constants, or other model elements) that conflict with VHDL or Verilog
reserved words. For example, if your generating model contains a signal
named mod, the coder adds the postfix _rsvd to form the name mod_rsvd.
3-94
ResetAssertedLevel property
'active-low'
Active-low
Specify that the reset input signal must be driven low (0) to reset
registers in the model. For example, the following code fragment checks
whether reset is active low before populating the delay_pipeline
register:
Delay_Pipeline_Process : PROCESS (clk, reset)
BEGIN
IF reset = '0' THEN
delay_pipeline(0 TO 50) <= (OTHERS => (OTHERS => '0'));
.
.
.
3-95
ResetAssertedLevel property
3-96
ResetInputPort property
Settings 'string'
Default: 'reset'.
The string specifies the name for the model’s reset input port. If you
override the default with (for example) the string 'chip_reset' for the
generating system myfilter, the generated entity declaration might
look as follows:
ENTITY myfilter IS
PORT( clk : IN std_logic;
clk_enable : IN std_logic;
chip_reset : IN std_logic;
myfilter_in : IN std_logic_vector (15 DOWNTO 0);
myfilter_out : OUT std_logic_vector (15 DOWNTO 0);
);
END myfilter;
Usage If the reset asserted level is set to active high, the reset input signal is
Notes asserted active high (1) and the input value must be high (1) for the
entity’s registers to be reset. If the reset asserted level is set to active
low, the reset input signal is asserted active low (0) and the input value
must be low (0) for the entity’s registers to be reset.
3-97
ResetInputPort property
3-98
ResetLength property
Purpose Define length of time (in clock cycles) during which reset is asserted
Settings N
Default: 2.
N must be an integer greater than or equal to 0.
Resetlength defines N, the number of clock cycles during which reset is
asserted. The following figure illustrates the default case, in which the
reset signal (active-high) is asserted for 2 clock cycles.
3-99
ResetType property
'sync'
Synchronous
Use synchronous reset logic. Code for a synchronous reset follows. The
following process block, generated by a Unit Delay block, checks for a
clock event, the rising edge, before performing a reset:
3-100
ResetType property
3-101
ResourceReport property
Settings 'on'
Create and display an HTML resource utilization report (bill of
materials).
'off' (default)
Do not create an HTML resource utilization report.
3-102
SafeZeroConcat property
3-103
ScalarizePorts property
Purpose Flatten vector ports into structure of scalar ports in VHDL code
Settings 'on'
When generating code for a vector port, generate a structure of scalar
ports
'off' (default)
Do not generate a structure of scalar ports for a vector port.
Usage The ScalarizePorts property lets you control how the coder generates
Notes VHDL code for vector ports.
For example, consider the subsystem vsum in the following figure.
PACKAGE simplevectorsum_pkg IS
TYPE vector_of_std_logic_vector16 IS ARRAY (NATURAL RANGE <>)
OF std_logic_vector(15 DOWNTO 0);
TYPE vector_of_signed16 IS ARRAY (NATURAL RANGE <>) OF signed(15 DOWNTO 0);
END simplevectorsum_pkg;
.
.
.
ENTITY vsum IS
3-104
ScalarizePorts property
Under VHDL typing rules two types declared in this manner are not
compatible across design units. This may cause problems if you need to
interface two or more generated VHDL code modules.
You can flatten such a vector port into a structure of scalar ports
by enabling ScalarizePorts in your makehdl command, as in the
following example.
makehdl(gcs,'ScalarizePorts','on')
ENTITY vsum IS
PORT( In1_0 : IN std_logic_vector(15 DOWNTO 0); -- int16
In1_1 : IN std_logic_vector(15 DOWNTO 0); -- int16
In1_2 : IN std_logic_vector(15 DOWNTO 0); -- int16
In1_3 : IN std_logic_vector(15 DOWNTO 0); -- int16
In1_4 : IN std_logic_vector(15 DOWNTO 0); -- int16
In1_5 : IN std_logic_vector(15 DOWNTO 0); -- int16
In1_6 : IN std_logic_vector(15 DOWNTO 0); -- int16
In1_7 : IN std_logic_vector(15 DOWNTO 0); -- int16
In1_8 : IN std_logic_vector(15 DOWNTO 0); -- int16
In1_9 : IN std_logic_vector(15 DOWNTO 0); -- int16
Out1 : OUT std_logic_vector(19 DOWNTO 0) -- sfix20
);
END vsum;
3-105
SimulatorFlags property
Settings 'string'
Default: ''
Specify options that are specific to your application and the simulator
you are using. For example, if you must use the 1076–1993 VHDL
compiler, specify the flag -93.
Usage The flags you specify with this option are added to the compilation
Notes command in generated compilation scripts. The simulation command
string is specified by the HDLCompileVHDLCmd or HDLCompileVerilogCmd
properties.
3-106
SplitArchFilePostfix property
Settings 'string'
Default: '_arch'.
This option applies only if you direct the coder to place the generated
VHDL entity and architecture code in separate files.
Usage The option applies only if you direct the coder to place the filter’s entity
Notes and architecture in separate files.
3-107
SplitEntityArch property
Settings 'on'
Selected
Write the generated VHDL code to a single file.
'off'(default)
Cleared (default)
Write the code for the generated VHDL entity and architecture to
separate files.
The names of the entity and architecture files derive from the base
file name (as specified by the generating model or subsystem name).
By default, postfix strings identifying the file as an entity (_entity)
or architecture (_arch ) are appended to the base file name. You can
override the default and specify your own postfix string.
For example, instead of all generated code residing in MyFIR.vhd,
you can specify that the code reside in MyFIR_entity.vhd and
MyFIR_arch.vhd.
3-108
SplitEntityFilePostfix property
Settings 'string'
Default: '_entity'
This option applies only if you direct the coder to place the generated
VHDL entity and architecture code in separate files.
3-109
SynthesisTool property
Usage To specify Altera Quartus II as the synthesis tool for a DUT subsystem,
myDUT:
See Also
Properties SynthesisToolDeviceNameSynthesisToolPackageNameSynthesisToolSpeedValue
3-110
SynthesisToolChipFamily property
Settings 'string'
Default: ''
Specify the target device chip family name for your model.
To find the chip family name for your target device:
hdlcoder.supportedDevices
2 Open the linked report and find your target device details.
See Also
Functions hdlcoder.supportedDevices
Properties SynthesisToolDeviceNameSynthesisToolPackageNameSynthesisToolSpeedValue
3-111
SynthesisToolDeviceName property
Settings 'string'
Default: ''
Specify the target device name for your model.
To find the name for your target device:
hdlcoder.supportedDevices
2 Open the linked report and find your target device details.
See Also
Functions hdlcoder.supportedDevices
Properties SynthesisToolChipFamilySynthesisToolPackageNameSynthesisToolSpeedValue
3-112
SynthesisToolPackageName property
Settings 'string'
Default: ''
Specify the target device package name for your model.
To find the package name for your target device:
hdlcoder.supportedDevices
2 Open the linked report and find your target device details.
See Also
Functions hdlcoder.supportedDevices
Properties SynthesisToolChipFamilySynthesisToolDeviceNameSynthesisToolSpeedValue
3-113
SynthesisToolSpeedValue property
Settings 'string'
Default: ''
Specify the target device speed value for your model.
To find the speed value for your target device:
hdlcoder.supportedDevices
2 Open the linked report and find your target device details.
See Also
Functions hdlcoder.supportedDevices
Properties SynthesisToolChipFamilySynthesisToolDeviceNameSynthesisToolPackageName
3-114
TargetDirectory property
Purpose Identify folder into which the coder writes generated output files
Settings 'string'
Default: 'hdlsrc'
Specify a subfolder under the current working folder into which the
coder writes generated files. The string can specify a complete path
name.
If the target folder does not exist, the coder creates it.
3-115
TargetLanguage property
3-116
TestBenchClockEnableDelay property
Purpose Define elapsed time in clock cycles between deassertion of reset and
assertion of clock enable
3-117
TestBenchDataPostFix property
Purpose Specify suffix added to test bench data file name when generating
multifile test bench
Settings 'string'
Default: '_data'.
The coder applies TestBenchDataPostFix only when generating a
multi-file test bench (i.e. when MultifileTestBench is 'on').
For example, if the name of your DUT is my_test, and
TestBenchPostFix has the default value _tb, the coder adds the postfix
_data to form the test bench data file name my_test_tb_data.
3-118
TestBenchPostFix property
Settings 'string'
Default: '_tb'.
For example, if the name of your DUT is my_test, the coder adds the
postfix _tb to form the name my_test_tb.
3-119
TimingControllerArch property
Settings 'resettable'
Generate a reset for the timing controller. If you select this option, the
ClockInputs property value must be 'Single'.
'default' (default)
Do not generate a reset for the timing controller.
See Also
Properties ClockInputs
3-120
TimingControllerPostfix property
Purpose Specify suffix appended to DUT name to form timing controller name
Settings 'string'
Default: '_tc'.
A timing controller code file is generated if required by the design, for
example:
3-121
TestBenchReferencePostFix property
Settings 'string'
Default: '_ref'.
Reference signal data is represented as arrays in the generated test
bench code. The string specified by TestBenchReferencePostFix is
appended to the generated signal names.
3-122
Traceability property
Settings 'on'
Create and display an HTML code generation report.
'off' (default)
Do not create an HTML code generation report.
See Also “Create and Use Code Generation Reports”, “Generate Code with
Annotations or Comments”, RequirementComments
3-123
TriggerAsClock property
Settings 'on'
For triggered subsystems, use the trigger input signal as a clock in
the generated HDL code.
'off' (default)
For triggered subsystems, do not use the trigger input signal as a clock
in the generated HDL code.
makehdl ('sfir_fixed/symmetric_sfir','TriggerAsClock','on')
3-124
UseAggregatesForConst property
Settings 'on'
Selected
Specify that constants, including constants that are less than 32 bits,
be represented by aggregates. The following VHDL code show a scalar
less than 32 bits represented as an aggregate:
'off' (default)
Cleared(default)
Specify that the coder represent constants less than 32 bits as scalars
and constants greater than or equal to 32 bits as aggregates. The
following VHDL code was generated by default for a value less than
32 bits:
GainFactor_gainparam <= to_signed(16384, 16);
3-125
UseFileIOInTestBench property
Purpose Specify whether to use data files for reading and writing test bench
stimulus and reference data
Settings 'on'
Selected
Create and use data files for reading and writing test bench stimulus
and reference data.
'off' (default)
Cleared(default)
Generated test bench contains stimulus and reference data as constants.
3-126
UserComment property
Purpose Specify comment line in header of generated HDL and test bench files
Settings 'string'
The comment is generated in each of the generated code and test bench
files. The code generator adds leading comment characters for the
target language. When newlines or line feeds are included in the string,
the code generator emits single-line comments for each newline.
For example, the following makehdl command adds two comment lines
to the header in a generated VHDL file.
makehdl(gcb,'UserComment','This is a comment line.\nThis is a second line.')
3-127
UseRisingEdge property
Settings 'on'
Selected
Generated code uses the VHDL rising_edge or falling_edge function
to detect clock transitions.
For example, the following code, generated from a Unit Delay block,
uses rising_edge to detect positive clock transitions:
'off' (default)
Cleared(default)
Generated code uses the 'event syntax.
For example, the following code, generated from a Unit Delay block,
uses clk'event AND clk = '1' to detect positive clock transitions:
3-128
UseRisingEdge property
3-129
UseVerilogTimescale property
3-130
VectorPrefix property
Settings 'string'
Default: 'vector_of_'
Specify a string to be prefixed to vector names in generated code.
3-131
Verbosity property
Purpose Specify level of detail for messages displayed during code generation
Settings Default: 1
0
When Verbosity is set to 0, code generation progress messages are not
displayed as code generation proceeds. When Verbosity is set to 1,
more detailed progress messages are displayed.
3-132
VerilogFileExtension property
Settings 'string'
The default file type extension for generated Verilog files is .v.
3-133
VHDLArchitectureName property
Settings 'string'
The default architecture name is 'rtl'.
3-134
VHDLFileExtension property
Settings 'string'
The default file type extension for generated VHDL files is .vhd.
3-135
VHDLLibraryName property
Settings 'string'
The default target library name is 'work'.
3-136
4
• Set ExplorationMode to
hdlcoder.OptimizationConfig.ExplorationMode.BestFrequency.
• Set ResumptionPoint to the default, ''.
• Set ExplorationMode to
hdlcoder.OptimizationConfig.ExplorationMode.TargetFrequency.
• Set TargetFrequency to your target clock frequency.
• Set ResumptionPoint to the default, ''
4-2
hdlcoder.OptimizationConfig
4-3
hdlcoder.OptimizationConfig
model = 'sfir_fixed';
dutSubsys = 'symmetric_fir';
open_system(model);
hdlset_param(model,'HDLSubsystem',[model,'/',dutSubsys]);
hdlset_param(model,'GenerateHDLTestBench','on');
4-4
hdlcoder.OptimizationConfig
oc = hdlcoder.OptimizationConfig;
oc.IterationLimit = 10;
hdlcoder.optimizeDesign(model,oc)
Iteration 0
Generate and synthesize HDL code ...
(CP ns) 16.26 (Constraint ns) 5.85 (Elapsed s) 143.66 Iteration 1
Generate and synthesize HDL code ...
(CP ns) 16.26 (Constraint ns) 5.85 (Elapsed s) 278.72 Iteration 2
Generate and synthesize HDL code ...
(CP ns) 10.25 (Constraint ns) 12.73 (Elapsed s) 427.22 Iteration 3
Generate and synthesize HDL code ...
(CP ns) 9.55 (Constraint ns) 9.73 (Elapsed s) 584.37 Iteration 4
Generate and synthesize HDL code ...
(CP ns) 9.55 (Constraint ns) 9.38 (Elapsed s) 741.04 Iteration 5
Generate and synthesize HDL code ...
4-5
hdlcoder.OptimizationConfig
Then coder stops after five iterations because the fourth and fifth
iterations had the same critical path, which indicates that the coder
has found the minimum critical path. The design’s maximum clock
frequency after optimization is 1 / 9.55 ns, or 104.71 MHz.
model = 'sfir_fixed';
dutSubsys = 'symmetric_fir';
open_system(model);
hdlset_param(model,'HDLSubsystem',[model,'/',dutSubsys]);
hdlset_param(model,'GenerateHDLTestBench','off');
4-6
hdlcoder.OptimizationConfig
oc = hdlcoder.OptimizationConfig;
oc.ExplorationMode = ...
hdlcoder.OptimizationConfig.ExplorationMode.TargetFrequency;
oc.TargetFrequency = 50;
oc.IterationLimit = 10; =
hdlcoder.optimizeDesign(model,oc)
Iteration 0
Generate and synthesize HDL code ...
(CP ns) 16.26 (Constraint ns) 20.00 (Elapsed s) 134.02 Iteration 1
Generate and synthesize HDL code ...
Exiting because constraint (20.00 ns) has been met (16.26 ns).
Summary report: summary.html
Achieved Critical Path (CP) Latency : 16.26 ns Elapsed : 134.02 s
4-7
hdlcoder.OptimizationConfig
Then coder stops after one iteration because it has achieved the target
clock frequency. The critical path is 16.26 ns, a clock frequency of
61.50 GHz.
model = 'sfir_fixed';
dutSubsys = 'symmetric_fir';
open_system(model);
hdlset_param(model,'HDLSubsystem',[model,'/',dutSubsys]);
Set your synthesis tool and target device options to the same values
as in the interrupted run.
hdlset_param(model,'GenerateHDLTestBench','on');
oc = hdlcoder.OptimizationConfig;
4-8
hdlcoder.OptimizationConfig
oc.ResumptionPoint = 'Iter5-07-Jan-2014-17-04-29';
hdlcoder.optimizeDesign(model,oc)
Then coder stops after one additional iteration because it has achieved
the target clock frequency. The critical path is 9.55 ns, or a clock
frequency of 104.71 MHz.
4-9
hdlcoder.OptimizationConfig
4-10
5
5-2
codegen
Set the test bench name. In this example, the test bench function name
is mlhdlc_dti_tb.
hdlcfg.TestBenchName = 'mlhdlc_dti_tb';
hdlcfg.TargetLanguage = 'Verilog';
Generate HDL code from your MATLAB design. In this example, the
MATLAB design function name is mlhdlc_dti.
fixptcfg = coder.config('fixpt');
Set the test bench name. In this example, the test bench function name
is mlhdlc_dti_tb.
fixptcfg.TestBenchName = 'mlhdlc_dti_tb';
hdlcfg = coder.config('hdl');
5-3
codegen
Related • “Generate HDL Code from MATLAB Code Using the Command
Examples Line Interface”
5-4
coder.config
fixptcfg = coder.config('fixpt');
Set the test bench name. In this example, the test bench function name
is mlhdlc_dti_tb.
fixptcfg.TestBenchName = 'mlhdlc_dti_tb';
hdlcfg = coder.config('hdl');
5-5
coder.config
Related • “Generate HDL Code from MATLAB Code Using the Command
Examples Line Interface”
5-6
coder.FixptConfig.addFunctionReplacement
Syntax fxptcfg.addFunctionReplacement(floatFn,fixedFn)
fxpCfg = coder.config('fixpt');
fxpCfg.TestBenchName = 'myTestbenchName';
fxpCfg.addFunctionReplacement('min', 'fi_min');
codegen -float2fixed fxpCfg designName
fxpCfg.addFunctionReplacement('min', 'fi_min');
5-7
coder.FixptConfig.addFunctionReplacement
Alternatives You can specify function replacements in the HDL Workflow Advisor.
See “Function Replacements”.
5-8
6
Properties TestBenchName
Test bench function name, specified as a string. You must specify
a test bench.
Values: '' (default) | string
FixPtFileNameSuffix
Suffix for fixed-point file names.
Values: '_fixpt' | string
ProposeFractionLengthsForDefaultWordLength
Propose fixed-point types based on DefaultWordLength.
Values: true (default) | false
DefaultWordLength
Default fixed-point word length.
Values: 14 (default) | positive integer
ProposeWordLengthsForDefaultFractionLength
Propose fixed-point types based on DefaultFractionLength.
Values: false (default) | true
DefaultFractionLength
6-2
coder.FixptConfig
Methods
addFunctionReplacement Replace floating-point function
with fixed-point function during
fixed-point conversion
fixptcfg = coder.config('fixpt');
6-3
coder.FixptConfig
Set the test bench name. In this example, the test bench function name
is mlhdlc_dti_tb.
fixptcfg.TestBenchName = 'mlhdlc_dti_tb';
hdlcfg = coder.config('hdl');
Alternatives You can also generate HDL code from MATLAB code using the HDL
Workflow Advisor. For more information, see “HDL Code Generation
from a MATLAB Algorithm”.
Related • “Generate HDL Code from MATLAB Code Using the Command
Examples Line Interface”
6-4
coder.HdlConfig
Properties Basic
GenerateHDLTestBench
Generate an HDL test bench, specified as a logical.
Values: false (default) | true
HDLCodingStandard
HDL coding standard to follow and check when generating code,
specified as a string. Generates a compliance report showing
errors, warnings, and messages.
Values: 'None' (default) | 'Industry'
HDLLintTool
HDL lint tool script to generate, specified as a string.
Values: 'None' (default) | 'AscentLint' | 'Leda' | 'SpyGlass'
|'Custom'
HDLLintInit
HDL lint script initialization string.
Value: string
HDLLintCmd
HDL lint script command.
6-5
coder.HdlConfig
Value: string
HDLLintTerm
HDL lint script termination string.
Value: string
InitializeBlockRAM
Specify whether to initialize all block RAM to '0' for simulation.
Values: true (default) | false
InlineConfigurations
Specify whether to include inline configurations in generated
VHDL code.
When true, include VHDL configurations in files that instantiate
a component.
When false, suppress the generation of configurations and
require user-supplied external configurations. Set to false if you
are creating your own VHDL configuration files.
Values: true (default) | false
ClockEdge
Specify active clock edge.
Values: 'Rising' (default) | 'Falling'
SimulateGeneratedCode
Simulate generated code, specified as a logical.
Values: false (default) | true
6-6
coder.HdlConfig
PartitionFunctions
Generate instantiable HDL code modules from functions.
Values: false (default) | true
SimulationIterationLimit
Maximum number of simulation iterations during test bench
generation, specified as an integer. This property affects only test
bench generation, not simulation during fixed-point conversion.
Values: unlimited (default) | positive integer
SimulationTool
Simulation tool name, specified as a string.
Values: 'ModelSim' (default) | 'ISIM'
SynthesisTool
Synthesis tool name, specified as a string.
Values: 'Xilinx ISE' (default) | 'Altera Quartus II'
SynthesisToolChipFamily
Synthesis target chip family name, specified as a string.
Values: 'Virtex4' (default) | string
SynthesisToolDeviceName
Synthesis target device name, specified as a string.
Values: 'xc4vsx35' (default) | string
SynthesisToolPackageName
Synthesis target package name, specified as a string.
Values: 'ff668' (default) | string
SynthesisToolSpeedValue
Synthesis target speed, specified as a string.
6-7
coder.HdlConfig
Description
DistributedPipeliningPriority
Value
Numerical Integrity Prioritize numerical integrity
(default) when distributing pipeline
registers.
This option uses a conservative
retiming algorithm that does
not move registers across a
component if the functional
6-8
coder.HdlConfig
Description
DistributedPipeliningPriority
Value
Cosimulation
GenerateCosimTestBench
Generate a cosimulation test bench or not, specified as a logical.
6-9
coder.HdlConfig
6-10
coder.HdlConfig
Values: 2 (default)
CosimRunMode
HDL simulator run mode during simulation, specified as a string.
When in Batch mode, you do not see the HDL simulator GUI, and
the HDL simulator automatically shuts down after simulation.
Values: Batch (default) | GUI
CosimTool
HDL simulator for the generated cosim test bench, specified as a
string.
Values: ModelSim (default) | Incisive
FPGA-in-the-loop
GenerateFILTestBench
Generate a FIL test bench or not, specified as a logical.
Values: false (default) | true
SimulateFILTestBench
Simulate generated cosimulation test bench, specified as a
logical. This option is ignored if GenerateCosimTestBench is
false.
Values: false (default) | true
FILBoardName
FPGA board name, specified as a string. You must override the
default value and specify a valid board name.
Values: 'Choose a board' (default) | string
FILBoardIPAddress
IP address of the FPGA board, specified as a string. You must
enter a valid IP address.
Values: 192.168.0.2 (default) | string
6-11
coder.HdlConfig
FILBoardMACAddress
MAC address of the FPGA board, specified as a string. You must
enter a valid MAC address.
Values: 00-0A-35-02-21-8A (default) | string
FILAdditionalFiles
List of additional source files to include, specified as a string.
Separate file names with a semi-colon (";").
Values: '' (default) | string
FILLogOutputs
Log and plot outputs of the reference design function and FPGA.
Values: false (default) | true
Set the test bench name. In this example, the test bench function name
is mlhdlc_dti_tb.
hdlcfg.TestBenchName = 'mlhdlc_dti_tb';
hdlcfg.TargetLanguage = 'Verilog';
Generate HDL code from your MATLAB design. In this example, the
MATLAB design function name is mlhdlc_dti.
6-12
coder.HdlConfig
fixptcfg = coder.config('fixpt');
fixptcfg.TestBenchName = 'mlhdlc_sfir_tb';
Instruct MATLAB to generate a cosim test bench and a FIL test bench.
Specify FPGA board name.
hdlcfg.GenerateCosimTestBench = true;
hdlcfg.FILBoardName = 'Xilinx Virtex-5 XUPV5-LX110T development board
hdlcfg.GenerateFILTestBench = true;
Perform code generation, Cosim test bench generation, and FIL test
bench generation.
Alternatives You can also generate HDL code from MATLAB code using the HDL
Workflow Advisor. For more information, see “HDL Code Generation
from a MATLAB Algorithm”.
Related • “Generate HDL Code from MATLAB Code Using the Command
Examples Line Interface”
6-13