Main Content

Simulation behavior for denormal numbers

Emulate hardware handling of denormal numbers

Model Configuration Pane: Math and Data Types

Description

The Simulation behavior for denormal numbers parameter specifies the desired behavior for denormal results from arithmetic operations. Denormal numbers are any non-zero numbers whose magnitude is smaller than the smallest normalized floating-point number (see realmin). Some hardware targets flush denormal results from arithmetic operations to zero. You can emulate this behavior by setting the parameter to Flush To Zero (FTZ).

Dependencies

This parameter requires a Fixed-Point Designer™ license only when both of these conditions are met:

  • The DenormalBehavior parameter is set to 'FlushToZero'.

  • The model is simulated in accelerator, rapid accelerator, SIL, or PIL mode. SIL and PIL simulations require an Embedded Coder® license.

When the DenormalBehavior parameter is set to 'GradualUnderflow' for all models in the model hierarchy, then no license is required.

Settings

Gradual Underflow (default) | Flush To Zero (FTZ)
Gradual Underflow

Denormal numbers are used in the results from arithmetic operations. This setting is supported by all simulation modes.

Flush To Zero (FTZ)

Emulates flush-to-zero behavior for denormal numbers. Denormal results from arithmetic operations are set to zero. Denormal inputs to arithmetic operations are treated as zero before performing the operation.

This setting is supported for accelerator, rapid accelerator, SIL, and PIL modes. This setting is not supported during normal mode simulation.

Tips

  • In a model reference hierarchy, you can simulate a top model using gradual underflow with any simulation mode.

  • Normal mode simulation does not support flush to zero. If you simulate the model in normal mode, gradual underflow is always used for that model.

    Flush-to-zero may be enabled for models referenced by a top model simulated in normal mode when the referenced models are simulated in accelerator, rapid accelerator, SIL, or PIL mode. Gradual underflow is used for the top model.

  • When you simulate a model reference hierarchy, the simulation mode of a parent model can override the simulation mode of Model blocks that the parent model contains. For more information, see Simulation Mode Override Behavior in Model Reference Hierarchy (Embedded Coder). Flush-to-zero behavior is supported throughout the model reference hierarchy when the top model is simulated in accelerator, rapid accelerator, SIL, or PIL mode.

  • When a top model is simulated in accelerator, rapid accelerator, SIL, or PIL mode, any Model blocks that the top model contains must use the same setting for the Simulation behavior for denormal numbers parameter. Models referenced by the top model can simulate flush-to-zero behavior only if the instance of the referenced model uses an accelerated simulation mode and has the Simulation behavior for denormal numbers parameter set to Flush to zero (FTZ).

Recommended Settings

ApplicationSetting
DebuggingMatch the behavior of your target hardware
TraceabilityMatch the behavior of your target hardware
EfficiencyNo impact
Safety precautionMatch the behavior of your target hardware

Programmatic Use

Parameter: DenormalBehavior
Value: 'GradualUnderflow' | 'FlushToZero'
Default: 'GradualUnderflow'

Version History

Introduced in R2019a

expand all