Main Content

coder.HdlConfig

HDL codegen configuration object

Description

A coder.HdlConfig object contains the configuration parameters that the HDL codegen function requires to generate HDL code. To pass this object to the codegen function, use the -config option.

Creation

Description

example

hdlcfg = coder.config("hdl") creates a coder.HdlConfig object for HDL code generation.

Properties

expand all

Basic

Enable adaptive pipelining to insert pipeline registers to the blocks in your design, reduce the area usage, and maximize the achievable clock frequency on the target FPGA device.

When you specify this parameter, specify the Synthesis Tool in the Select Code Generation Target task. If your design has multipliers, specify the Synthesis Tool and the Target Frequency (MHz) for adaptive pipeline insertion.

Data Types: logical

Minimum bit width for shared adders, specified as a positive integer.

If ShareAdders is true and ResourceSharing is greater than 1, share adders only if adder bit width is greater than or equal to AdderSharingMinimumBitwidth.

Data Types: int32

Specify active clock edge.

Data Types: char | string

Enable to distribute pipeline registers. When enabled, HDL Coder™ moves registers within your design to reduce critical path.

Data Types: logical

DistributedPipeliningPriority ValueDescription
NumericalIntegrity (default)

Prioritize numerical integrity when distributing pipeline registers.

This option uses a conservative retiming algorithm that does not move registers across a component if the functional equivalence to the original design is unknown.

Performance

Prioritize performance over numerical integrity.

Use this option if your design requires a higher clock frequency and the MATLAB® behavior does not need to strictly match the generated code behavior.

This option uses a more aggressive retiming algorithm that moves registers across a component even if the modified design’s functional equivalence to the original design is unknown.

Data Types: char | string

Generate an HDL test bench.

Data Types: logical

HDL coding standard to follow when generating code. Generates a compliance report showing errors, warnings, and messages.

Data Types: char | string

HDL coding standard rules and report customizations, specified by using HDL Coding Standard Customization Properties. For more information, see HDL Coding Standard Customization Properties. If you want to customize the coding standard rules and report, you must set HDLCodingStandard to "Industry".

HDL lint tool script to generate.

Data Types: char | string

HDL lint script initialization name, specified as a string scalar or character vector.

Data Types: char | string

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 as a string scalar or character vector by using this format:

custom_lint_tool_command -option1 -option2 %s

Data Types: char | string

HDL lint script termination name.

Data Types: char | string

Specify whether to initialize block RAM to 0 for simulation.

Data Types: logical

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.

Data Types: logical

Specify the number of input pipeline register stages. When DistributedPipelining is enabled, these registers can be distributed through the design.

Data Types: int32

Specify whether to generate instantiable HDL code modules from functions.

Data Types: logical

Loop optimization in generated code. See Optimize MATLAB Loops.

LoopOptimization ValueDescription
LoopNoneDo not optimize loops in generated code.
StreamLoopsStream loops.
UnrollLoopsUnroll loops.

Data Types: char | string

Specify whether to omit generation of clock enable logic.

When false (default), generate clock enable logic.

When true, omit generation of clock enable logic wherever possible.

Data Types: logical

Specify maximum input bit width for hardware multipliers. If a multiplier input bit width is greater than this threshold, HDL Coder splits the multiplier into smaller multipliers.

To improve your hardware mapping results, set this threshold to the input bit width of the digital signal processor (DSP) or multiplier hardware on your target device.

Data Types: int32

Minimum bit width for shared multipliers, specified as a positive integer.

If ShareMultipliers is true and ResourceSharing is greater than 1, share multipliers only if multiplier bit width is greater than or equal to MultiplierSharingMinimumBitwidth.

Data Types: int32

Specify the number of output pipeline register stages. When DistributedPipelining is enabled, these registers can be distributed through the design.

Data Types: int32

Enable to insert a register at each DUT input. Distributed pipelining does not move these registers.

Data Types: logical

Enable to insert a register at each DUT output. Distributed pipelining does not move these registers.

Data Types: logical

Prevent distributed pipelining from moving design delays or allow distributed pipelining to move design delays, specified as a logical.

Persistent variables and dsp.Delay System objects are design delays.

Data Types: logical

Specify whether to share adders. If true, share adders when ResourceSharing is greater than 1 and adder bit width is greater than or equal to AdderSharingMinimumBitwidth.

Data Types: logical

Specify whether to share multipliers. If true, share multipliers when ResourceSharing is greater than 1 and multiplier bit width is greater than or equal to MultiplierSharingMinimumBitwidth.

Data Types: logical

Specify whether to simulate generated code.

Data Types: logical

Maximum number of simulation iterations during test bench generation. This property affects only test bench generation, not simulation during fixed-point conversion. When the value is -1 (default), no maximum number of simulation iterations is set.

Data Types: int32

Specify the simulation tool name.

Data Types: char | string

Specify the synthesis tool name.

Data Types: char | string

Specify the synthesis target chip family name.

Data Types: char | string

Specify the synthesis target device name.

Data Types: char | string

Specify the synthesis target package name.

Data Types: char | string

Specify the synthesis target speed.

Data Types: char | string

Specify whether to synthesize generated code.

Data Types: logical

Specify the test bench for SystemC code generation.

Data Types: char | string

Specify the target frequency, in MHz, of the clock wired to the clock input of the generated HDL design. This frequency is the same as the output clock frequency of the clock module. Adaptive pipelining takes into account the target frequency that you set to improve the frequency of your design.

Data Types: double

Specify the target language of the generated code.

Data Types: char | string

Specify the test bench function name. You must specify a test bench.

Data Types: char | string

Specify the timing controller architecture.

TimingControllerArch ValueDescription

default

Do not generate a reset for the timing controller.

resettable

Generate a reset for the timing controller.

Data Types: char | string

Postfix to append to the design name to form the name of the timing controller.

Data Types: char | string

Specify whether to create and use data files for reading and writing test bench input and output data.

Data Types: logical

Specify the target library name for generated VHDL code.

Data Types: char | string

Cosimulation

Specify whether to generate a cosimulation test bench.

Data Types: logical

Specify whether to simulate a generated cosimulation test bench. This option is ignored if GenerateCosimTestBench is false.

Data Types: logical

Time (in clock cycles) between deassertion of reset and assertion of clock enable.

Data Types: int32

The number of nanoseconds the clock is high.

Data Types: int32

The number of nanoseconds the clock is low.

Data Types: int32

The hold time for input signals and forced reset signals, specified in nanoseconds.

Data Types: int32

Specify whether to log and plot outputs of the reference design function and HDL simulator.

Data Types: logical

Specify the time (in clock cycles) between assertion and deassertion of reset.

Data Types: int32

Specify the HDL simulator run mode during simulation. When in Batch mode, you do not see the HDL simulator UI. The HDL simulator shuts down after simulation.

Data Types: char | string

Specify the HDL simulator for the generated cosim test bench.

Data Types: char | string

FPGA-in-the-loop

Specify whether to generate a FIL test bench.

Data Types: logical

Specify whether to simulate a generated cosimulation test bench. This option is ignored if GenerateCosimTestBench is false.

Data Types: logical

Specify the FPGA board name. You must override the default value and specify a valid board name.

Data Types: char | string

Specify the IP address of the FPGA board. You must enter a valid IP address.

Data Types: char | string

Specify the MAC address of the FPGA board. You must enter a valid MAC address.

Data Types: char | string

Specify a list of additional source files to include. Separate file names by using a semicolon (;).

Data Types: char | string

Specify whether to log and plot outputs of the reference design function and FPGA.

Data Types: logical

Examples

collapse all

Create a coder.HdlConfig object hdlcfg.

hdlcfg = coder.config("hdl"); % Create a default "hdl" config

Set the test bench name. In this example, the test bench function name is mlhdlc_dti_tb.

hdlcfg.TestBenchName = "mlhdlc_dti_tb";

Set the target language to Verilog®.

hdlcfg.TargetLanguage = "Verilog";

Generate HDL code from your MATLAB design. In this example, the MATLAB design function name is mlhdlc_dti.

codegen -config hdlcfg mlhdlc_dti

Create a coder.FixptConfig object that has default settings and provide a test bench name.

fixptcfg = coder.config("fixpt"); 
fixptcfg.TestBenchName = "mlhdlc_sfir_tb";

Create a coder.HdlConfig object that has default settings and set enable rate.

hdlcfg = coder.config("hdl"); % Create a default "hdl" config
hdlcfg.EnableRate = "DUTBaseRate";

Instruct MATLAB to generate a cosim test bench and a FIL test bench. Specify an 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.

codegen -float2fixed fixptcfg -config hdlcfg mlhdlc_sfir

Alternatives

You can also generate HDL code from MATLAB code using the HDL Workflow Advisor. For more information, see Basic HDL Code Generation and FPGA Synthesis from MATLAB.

Version History

Introduced in R2014b