Native Floating-Point Parameters
You can access the floating-point parameters in the HDL Code Generation > Floating Point pane in the Configuration Parameters dialog box. Use these parameters to specify the latency strategy, whether to handle denormal numbers in your design, and how to perform mantissa multiplication. To specify these settings, Use Floating Point must be selected.
Latency Strategy
Specify whether you want the design to map to minimum or maximum latency with native floating-point libraries.
Settings
Default:
MAX
The options are:
MIN
Maps to minimum latency for the native floating-point libraries.
MAX
Maps to maximum latency for the native floating-point libraries.
ZERO
Does not use any latency for the native floating-point libraries.
Dependency
To specify this parameter, select Use Floating Point.
Command-Line Information
To specify the latency strategy:
Create a floating-point target configuration object for
Native Floating Point
as the floating-point library.fpconfig = hdlcoder.createFloatingPointTargetConfig('NativeFloatingPoint');
Specify the
LatencyStrategy
property of theLibrarySettings
attribute of the floating-point target configuration object.fpconfig.LibrarySettings.LatencyStrategy = 'MIN';
Set the floating-point target configuration on the model and then generate HDL code. This example shows how to set the configuration on the
sfir_single
model and generate HDL code for thesymmetric_fir
subsystem:hdlset_param('sfir_single','FloatingPointTargetConfig',fpconfig) makehdl('sfir_single/symmetric_fir')
See also
Handle Denormals
Specify whether you want to handle denormal numbers in your design. Denormal numbers are nonzero numbers that are smaller than the smallest normal number.
Settings
Default:
Auto
-
Auto
Controls the insertion of additional logic to handle the denormal numbers based on a floating-point data type used in your design. This option inserts a denormal logic if your design uses the half-precision data types. While using single or double data types, denormal logic is not added in your design.
-
On
Inserts additional logic to handle the denormal numbers in your design.
-
Off
Does not add additional logic to handle the denormal numbers in your design. If the input is a denormal value, HDL Coder™ treats the value as zero before performing computation.
Dependency
To specify this parameter, select Use Floating Point.
Command-Line Information
To specify the latency strategy:
Create a floating-point target configuration object for
Native Floating Point
as the floating-point library.fpconfig = hdlcoder.createFloatingPointTargetConfig('NativeFloatingPoint');
Specify the
HandleDenormals
property of theLibrarySettings
attribute of the floating-point target configuration object.fpconfig.LibrarySettings.HandleDenormals = 'on';
Set the floating-point target configuration on the model and then generate HDL code. This example shows how to set the configuration on the
sfir_single
model and generate HDL code for thesymmetric_fir
subsystem:hdlset_param('sfir_single','FloatingPointTargetConfig',fpconfig) makehdl('sfir_single/symmetric_fir')
Considerations
Insertion of an denormal logic in your design provides an ability to handle the denormal numbers with an overhead of increasing hardware resources. Hence, you can enable or disable the Handle Denormals option based on your requirements.
For some of the floating-point blocks, HDL Coder generates the code that has denormal logic enabled by default. These blocks are:
Add
Subtract
Data Type Conversion
These blocks can handle the denormal numbers with minimal impact on the hardware resources. The generated code for these blocks is not affected by Handle Denormals settings.
See also
Mantissa Multiplier Strategy
Specify how you want HDL Coder to implement the mantissa multiplication operation when you have Product blocks in your design.
Settings
Default: Auto
The options are:
Auto
This default option automatically determines how to implement the mantissa multiplication depending on the Synthesis tool that you specify.
If you do not specify a Synthesis tool, this setting selects the
Full Multiplier
implementation by default.If you specify
Altera Quartus II
as the Synthesis tool, this setting selects theFull Multiplier
implementation.If you specify
Xilinx Vivado
orXilinx ISE
as the Synthesis tool, this setting selects thePart Multiplier Part AddShift
implementation.
Full Multiplier
Specify this option to use only multipliers for implementing the mantissa multiplication. The multipliers can utilize DSP units on the target device.
Part Multiplier Part AddShift
Specify this option to split the implementation into two parts. One part is implemented with multipliers. The other part is implemented with a combination of adders and shifters. The multipliers can utilize the DSP units on the target device. The combination of adders and shifters does not utilize the DSP.
No Multiplier Full AddShift
Select this option to use a combination of adders and multipliers to implement the mantissa multiplication. This option does not utilize DSP units on the target device. You can also use this option if your target device does not contain DSP units.
Dependency
To specify this parameter, select Use Floating Point.
Command-Line Information
To specify the latency strategy:
Create a floating-point target configuration object for
Native Floating Point
as the floating-point library.fpconfig = hdlcoder.createFloatingPointTargetConfig('NativeFloatingPoint');
Specify the
MantissaMultiplyStrategy
property of theLibrarySettings
attribute of the floating-point target configuration object.fpconfig.LibrarySettings.MantissaMultiplyStrategy = 'PartMultiplierPartAddShift';
Set the floating-point target configuration on the model and then generate HDL code. This example shows how to set the configuration on the
sfir_single
model and generate HDL code for thesymmetric_fir
subsystem:hdlset_param('sfir_single','FloatingPointTargetConfig',fpconfig) makehdl('sfir_single/symmetric_fir')