makehdl

Generate HDL RTL code from model, subsystem, or model reference

Description

example

makehdl(dut) generates HDL code from the specified DUT model, subsystem, or model reference.

Note

Running this command can activate the Open at simulation start setting for blocks such as the Scope block and therefore invoke the block.

example

makehdl(dut,Name,Value) generates HDL code from the specified DUT model, subsystem, or model reference with options specified by one or more name-value pair arguments.

Examples

collapse all

This example shows how to generate VHDL for the symmetric FIR model.

Open the sfir_fixed model.

sfir_fixed

Generate HDL code for the current model with code generation options set to default values.

makehdl('sfir_fixed/symmetric_fir','TargetDirectory','C:\GenVHDL\hdlsrc')
### Generating HDL for 'sfir_fixed/symmetric_fir'.
### Starting HDL check.
### Begin VHDL Code Generation for 'sfir_fixed'.
### Working on sfir_fixed/symmetric_fir as C:\GenVHDL\hdlsrc\sfir_fixed\symmetric_fir.vhd.
### Creating HDL Code Generation Check Report file://C:\GenVHDL\hdlsrc\sfir_fixed\symmetric_fir_report.html
### HDL check for 'sfir_fixed' complete with 0 errors, 0 warnings, and 0 messages.
### HDL code generation complete.

The generated VHDL code is saved in the hdlsrc folder.

Generate Verilog® for the subsystem symmetric_fir within the model sfir_fixed.

Open the sfir_fixed model.

sfir_fixed;

The model opens in a new Simulink® window.

Generate Verilog for the symmetric_fir subsystem.

makehdl('sfir_fixed/symmetric_fir', 'TargetLanguage', 'Verilog', ...
               'TargetDirectory', 'C:/Generate_Verilog/hdlsrc')
### Generating HDL for 'sfir_fixed/symmetric_fir'.
### Starting HDL check.
### Begin Verilog Code Generation for 'sfir_fixed'.
### Working on sfir_fixed/symmetric_fir as C:\Generate_Verilog\hdlsrc\sfir_fixed\symmetric_fir.v.
### Creating HDL Code Generation Check Report file://C:\Generate_Verilog\hdlsrc\sfir_fixed\symmetric_fir_report.html
### HDL check for 'sfir_fixed' complete with 0 errors, 0 warnings, and 0 messages.
### HDL code generation complete.

The generated Verilog code for the symmetric_fir subsystem is saved in hdlsrc\sfir_fixed\symmetric_fir.v.

Close the model.

bdclose('sfir_fixed');

Check that the subsystem symmetric_fir is compatible with HDL code generation, then generate HDL.

Open the sfir_fixed model.

sfir_fixed

The model opens in a new Simulink® window.

Use the checkhdl function to check whether the symmetric_fir subsystem is compatible with HDL code generation.

hdlset_param('sfir_fixed','TargetDirectory','C:/HDL_Checks/hdlsrc');
checkhdl('sfir_fixed/symmetric_fir')
### Starting HDL check.
### Creating HDL Code Generation Check Report file://C:\HDL_Checks\hdlsrc\sfir_fixed\symmetric_fir_report.html
### HDL check for 'sfir_fixed' complete with 0 errors, 0 warnings, and 0 messages.

checkhdl completed successfully, which means that the model is compatible for HDL code generation. To generate code, use makehdl

makehdl('sfir_fixed/symmetric_fir')
### Generating HDL for 'sfir_fixed/symmetric_fir'.
### Using the config set for model <a href="matlab:configset.showParameterGroup('sfir_fixed', { 'HDL Code Generation' } )">sfir_fixed</a> for HDL code generation parameters.
### Starting HDL check.
### Begin VHDL Code Generation for 'sfir_fixed'.
### Working on sfir_fixed/symmetric_fir as C:\HDL_Checks\hdlsrc\sfir_fixed\symmetric_fir.vhd.
### Creating HDL Code Generation Check Report file://C:\HDL_Checks\hdlsrc\sfir_fixed\symmetric_fir_report.html
### HDL check for 'sfir_fixed' complete with 0 errors, 0 warnings, and 0 messages.
### HDL code generation complete.

The generated VHDL® code for the symmetric_fir subsystem is saved in hdlsrc\sfir_fixed\symmetric_fir.vhd.

Close the model.

bdclose('sfir_fixed');

Input Arguments

collapse all

Specified as subsystem name, top-level model name, or model reference name with full hierarchical path.

Example: 'top_level_name'

Example: 'top_level_name/subsysA/subsysB/codegen_subsys_name'

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'TargetLanguage','Verilog'

Target Options

collapse all

Specify the Subsystem in your model to generate HDL code for. For more information, see the Generate HDL for section in Target.

Specify whether to generate VHDL or Verilog code. For more information, see the Language section in Target.

Specify a path to write the generated files and HDL code into. For more information, see the Folder section in Target.

For more information, see Split entity and architecture in Split entity and architecture.

Code Generation Output Options

collapse all

Specify whether you want to generate HDL code, or only display the generated model, or generate HDL code and display the generated model. For more information, see the Generate HDL code section in Code Generation Output.

Specify whether to generate HDL code for the model. For more information, see the Generate HDL code section in Code Generation Output.

Specify whether to generate the validation model with HDL code. For more information, see the Generate validation model section in Code Generation Output.

Code Generation Report Options

collapse all

Specify whether the generated HDL code must conform to the Industry coding standard guidelines. For more information, see Choose Coding Standard and Report Options.

Specify the coding standards customization object to use with the Industry coding standard when generating HDL code. For more information, see hdlcoder.CodingStandard.

Specify whether to generate a traceability report that has hyperlinks for navigating from code-to-model and from model-to-code. For more information, see Generate traceability report.

Specify whether to generate a resource utilization report that displays the number of hardware resources that the generated HDL code uses. For more information, see Generate resource utilization report.

Specify whether to generate an optimization report that displays the effect of optimizations such as streaming, sharing, and distributed pipelining. For more information, see Generate optimization report.

Specify whether to generate a web view of the model in the Code Generation report to easily navigate between the code and model. For more information, see Generate model Web view.

Speed and Area Optimization

collapse all

Specify whether to enable delay balancing on the model. For more information, see Balance delays.

Specify whether to prioritize the distributed pipelining optimization for numerical integrity or performance. For more information, see the Distributed pipelining priority section in Distributed Pipelining.

Specify whether to apply the hierarchical distributed pipelining optimization on the model. For more information, see Distributed Pipelining.

Specify whether you want the code generator to distribute design delays in your model. For more information, see Preserve design delays.

Specify whether to insert pipeline registers at the clock rate or the data rate. For more information, see Clock Rate Pipelining.

For more information, see Minimize Clock Enables and Reset Signals.

Specify, in bits, the minimum RAM size required for mapping to RAMs instead of registers. For more information, see the RAM mapping threshold (bits) section in RAM Mapping.

Specify whether to map pipeline registers in the generated HDL code to block RAMs on the FPGA. For more information, see the Map pipeline delays to RAM section in RAM Mapping.

Specify whether to highlight feedback loops in your design. For more information, see Diagnostics for Optimizations.

Coding Style

collapse all

Specify comment lines in header of generated HDL and test bench files. For more information, see Comment in header.

For more information, see Represent constant values by aggregates in RTL Customizations for Constants and MATLAB Function Blocks.

For more information, see Use "rising_edge/falling_edge" style for registers in RTL Style.

For more information, see Loop unrolling in RTL Style.

For more information, see Use Verilog 'timescale directives in RTL Annotations.

For more information, see Inline VHDL configuration in RTL Annotations.

For more information, see Concatenate type safe zeros in RTL Annotations.

Specify whether you want to obfuscate the generated HDL code. For more information, see Generate obfuscated HDL code in RTL Annotations.

For more information, see Emit time/date stamp in header in RTL Annotations.

For more information, see Scalarize vector ports in RTL Style.

For more information, see Minimize intermediate signals in RTL Style.

For more information, see Include requirements in block comments in RTL Annotations.

For more information, see Inline MATLAB Function block code RTL Customizations for Constants and MATLAB Function Blocks.

For more information, see Generate parameterized HDL code from masked subsystem in RTL Style.

For more information, see Initialize all RAM blocks in RTL Customizations for RAMs.

For more information, see RAM Architecture in RTL Customizations for RAMs.

Clocks and Reset

collapse all

Specify the active clock edge for the generated HDL code. For more information, see the Clock edge section in Clock Settings and Timing Controller Postfix.

Specify whether to generate single or multiple clock inputs in the HDL code. For more information, see the Clock inputs section in Clock Settings and Timing Controller Postfix.

Frequency of global oversampling clock, specified as an integer multiple of the model’s base rate. For more information, see Oversampling factor.

Specify whether to use an active-high or active-low asserted level for the reset input signal. For more information, see the Reset asserted level section in Reset Settings.

Specify whether to use synchronous or asynchronous reset in the generated HDL code. For more information, see Reset Settings.

For more information, see Use trigger signal as clock.

For more information, see Timing controller architecture in Timing Controller Settings.

Test Bench

collapse all

When you use this property with makehdl, HDL Coder™ does not a Cosimulation block. To generate a Cosimulation block, use makehdltb. With the Cosimulation block, you can simulate the DUT in Simulink® with an HDL simulator.

For more information, see GenerateCoSimBlock.

When you use this property with makehdl, HDL Coder does not a Cosimulation model. To generate a Cosimulation model, use makehdltb. The model contains a Cosimulation block for the HDL simulator that you specify.

For more information, see GenerateCoSimModel.

For more information, see SimulatorFlags.

For more information, see TestBenchReferencePostFix.

Script Generation

collapse all

For more information, see EDAScriptGeneration.

For more information, see HDLCompileInit.

For more information, see HDLCompileTerm.

For more information, see HDLCompileFilePostfix.

Verilog compilation command, specified as a character vector. The SimulatorFlags name-value pair specifies the first argument, and the module name specifies the second argument.

For more information, see HDLCompileVerilogCmd.

VHDL compilation command, specified as a character vector. The SimulatorFlags name-value pair specifies the first argument, and the entity name specifies the second argument.

For more information, see HDLCompileVHDLCmd.

For more information, see HDLLintTool.

HDL lint initialization name, specified as a character vector. The default is derived from the HDLLintTool name-value pair.

For more information, see HDLLintInit.

HDL lint command, specified as a character vector. The default is derived from the HDLLintTool name-value pair.

For more information, see HDLLintCmd.

HDL lint termination, specified as a character vector. The default is derived from the HDLLintTool name-value pair.

For more information, see HDLLintTerm.

For more information, see HDLSynthTool.

HDL synthesis command, specified as a character vector. The default is derived from the HDLSynthTool name-value pair.

For more information, see HDLSynthCmd.

HDL synthesis script file name postfix, specified as a character vector. The default is derived from the HDLSynthTool name-value pair.

For more information, see HDLSynthFilePostfix.

Initialization for the HDL synthesis script, specified as a character vector. The default is derived from the HDLSynthTool name-value pair.

For more information, see HDLSynthInit.

Termination name for the HDL synthesis script. The default is derived from the HDLSynthTool name-value pair.

For more information, see HDLSynthTerm.

Generated Model

collapse all

For more information, see Prefix for generated model name.

Synthesis

collapse all

Specify the synthesis tool for targeting the generated HDL code as a character vector. For more information, see Tool and Device.

Specify the synthesis tool chip family for the target device as a character vector. For more information, see the Family section in Tool and Device.

Specify the synthesis tool device name for the target device as a character vector. For more information, see the Device section in Tool and Device.

Specify the synthesis tool package name for the target device as a character vector. For more information, see the Package section in Tool and Device.

Specify the synthesis tool speed value for the target device as a character vector. For more information, see the Speed section in Tool and Device.

Specify the synthesis tool speed value for the target device as a character vector. For more information, see the Speed section in Tool and Device.

Specify the target frequency in MHz as a character vector. For more information, see Target Frequency.

Specify whether to generate a multicycle path constraints text file. For more information, see Multicycle Path Constraints.

Specify whether to generate an enable-based multicycle path constraints file. For more information, see Enable-based constraints in Multicycle Path Constraints.

Port Names and Types

collapse all

Specify the clock enable input port name as a character vector. For more information, see Clock Enable Settings.

Clock enable output port name, specified as a character vector.

For more information, see Clock Enable output port.

Specify the clock input port name as a character vector. For more information, see Clock Settings and Timing Controller Postfix.

VHDL inputs can have 'std_logic_vector' or 'signed/unsigned' data type. Verilog inputs must be 'wire'.

For more information, see Input data type in Input and Output Port Data Types.

VHDL output can be 'Same as input data type', 'std_logic_vector' or 'signed/unsigned'. Verilog output must be 'wire'.

For more information, see Output data type in Input and Output Port Data Types.

Reset input port name, specified as a character vector.

For more information, see the Reset input port section in Reset Settings.

File and Variable Names

collapse all

Specify the file name extension for generated Verilog files. For more information, see Language-Specific Identifiers.

Specify the file name extension for generated VHDL files. For more information, see the VHDLFileExtension section in Language-Specific Identifiers.

For more information, see VHDL architecture name in VHDL Architecture and Library Name.

For more information, see VHDL library name in VHDL Architecture and Library Name.

For more information, see Split entity file postfix in Split entity and architecture.

For more information, see Split arch file postfix in Split entity and architecture.

Specify the postfix for the package file name as a character vector. For more information, see the Package Postfix section in Language-Specific Identifiers.

For more information, see Map file postfix.

For more information, see Block generate label in Generate Statement Labels.

Specify the postfix for clocked process names as a character vector. For more information, see the Clocked process postfix section in Clock Settings and Timing Controller Postfix.

For more information, see Complex imaginary part postfix in Complex Signals Postfix.

For more information, see Complex real part postfix in Complex Signals Postfix.

Specify the postfix as a character vector that resolves duplicate entity or module names. For more information, see the Entity conflict postfix section in Language-Specific Identifiers.

For more information, see Instance generate label in Generate Statement Labels.

For more information, see Instance postfix in Vector and Component Instances Labels.

For more information, see Instance prefix in Vector and Component Instances Labels..

For more information, see Output generate label in Generate Statement Labels.

For more information, see Pipeline postfix.

For more information, see Reserved word postfix in Language-Specific Identifiers.

For more information, see Timing controller postfix in Clock Settings and Timing Controller Postfix.

For more information, see Vector prefix in Vector and Component Instances Labels.

Prefix for internal clock enable and control flow enable signals, specified as a character vector. For more information, see Clock Enable Settings.

Specify a prefix for every module or entity name in the generated HDL code. HDL Coder also applies this prefix to generated script file names

For more information, see ModulePrefix in Language-Specific Identifiers.

Introduced in R2006b