Handle Denormals
Specify whether to handle denormal numbers
Since R2020b
Model Configuration Pane: Floating Point
Description
Specify whether you want to handle denormal numbers in your design. Denormal numbers are nonzero numbers that are smaller than the smallest normal number.
Dependencies
To specify this parameter, select Use Floating Point.
Settings
Auto
(default) | On
| Off
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.
Tips
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')
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.
Recommended Settings
No recommended settings.
Programmatic Use
Parameter:
HandleDenormals property of LibrarySettings
attribute of hdlcoder.FloatingPointTargetConfig object |
Type: character vector |
Values:
'Auto' | 'on' |
'off' |
Default:
'Auto' |
Version History
Introduced in R2020b