# Real Divide HDL Optimized

Divide one real input by another and generate optimized HDL code

Since R2021a

Libraries:
Fixed-Point Designer HDL Support / Math Operations

## Description

The Real Divide HDL Optimized block outputs the result of dividing the real scalar num by the real scalar den, such that y = num/den.

## Limitations

Data type override is not supported for the Real Divide HDL Optimized block.

## Ports

### Input

expand all

Numerator, specified as a real-valued scalar, vector, or matrix. num and den must have the same dimensions.

Slope-bias representation is not supported for fixed-point data types.

Data Types: `single` | `double` | `fixed point`

Denominator, specified as a real-valued scalar, vector, or matrix. num and den must have the same dimensions.

Slope-bias representation is not supported for fixed-point data types.

Data Types: `single` | `double` | `fixed point`

Whether input is valid, specified as a Boolean scalar. This control signal indicates when the data from the num and den input ports are valid. When this value is `1` (`true`), the block captures the values at the input ports num and den. When this value is `0` (`false`), the block ignores the input samples.

Data Types: `Boolean`

### Output

expand all

Output computed by dividing num by den, such that y = num/den, returned as a real scalar.

#### Tips

The data type at the output port y is specified by the Output datatype parameter.

Data Types: `single` | `double` | `fixed point`

Since R2024b

Whether the value at the y output port is the result of a division by zero operation, returned as a Boolean scalar. When the value of this signal is `1` (`true`), the corresponding output value at the y port is the result of division by zero. When the value of this signal is `0` (`false`), the corresponding output value at the y port is the result of division by a nonzero value.

See Division by Zero Behavior for a description of the default divide by zero behavior.

#### Dependencies

To enable this port, select the Show divide by zero port parameter.

Data Types: `Boolean`

Whether the output data is valid, returned as a Boolean scalar. When the value of this control signal is `1` (`true`), the block has successfully computed the output at port y. When this value is `0` (`false`), the output data is not valid.

Data Types: `Boolean`

## Parameters

expand all

Data type of the output y, specified as `fixdt(1,18,10)`, `single`, `double`, `fixdt(1,16,0)`, or as a user-specified data type expression. The type can be specified directly or expressed as a data type object, such as `Simulink.NumericType`.

In R2024b: Unsigned data types are supported for this parameter.

#### Programmatic Use

To set the block parameter value programmatically, use the `set_param` function.

To get the block parameter value programmatically, use the `get_param` function.

 Parameter: `OutputType` Values: `fixdt(1,18,10)` (default) | `single` | `double` | `fixdt(1,16,0)` | `` Data Types: `char` | `string`

Example: `set_param(gcb,"OutputType","fixdt(1,16,0)")`

Since R2024b

Select this parameter to show the divideByZero port.

#### Programmatic Use

To set the block parameter value programmatically, use the `set_param` function.

To get the block parameter value programmatically, use the `get_param` function.

 Parameter: `dbzPort` Values: `0` (false) (default) | `1` (true) Data Types: `logical`

Example: `set_param(gcb,"dbzPort",1)`

Since R2024b

Automatically select the CORDIC maximum shift value based on input word length. When this parameter is selected, the default CORDIC `maximumShiftValue` is equal to `wl - 1`, where ```wl = max(num.WordLength + ~issigned(num), den.WordLength + ~issigned(den))```.

#### Programmatic Use

To set the block parameter value programmatically, use the `set_param` function.

To get the block parameter value programmatically, use the `get_param` function.

 Parameter: `autoMaximumShiftVal` Values: `on` (default) | `off` Data Types: `char` | `string`

Example: `set_param(gcb,"autoMaximumShiftVal","off")`

Since R2024b

Maximum shift value of hyperbolic vectoring CORDIC, specified as a positive integer-valued scalar. The default value for this parameter is ```wl - 1```, where ```wl = max(num.WordLength + ~issigned(num), den.WordLength + ~issigned(den))```.

#### Dependencies

To enable this parameter, clear the Automatically select CORDIC maximum shift value based on input word length parameter.

#### Programmatic Use

To set the block parameter value programmatically, use the `set_param` function.

To get the block parameter value programmatically, use the `get_param` function.

 Parameter: `maximumShiftValue` Values: `10` (default) | positive integer-valued scalar Data Types: `char` | `string`

Example: `set_param(gcb,"maximumShiftValue","10")`

Since R2024b

Number of CORDIC iterations to perform per pipeline stage, specified as a positive integer-valued scalar.

See Customizable Pipelining for more information. See How to Interface with the Real Divide HDL Optimized Block and Hardware Resource Utilization for more information and examples showing how this parameter impacts latency and hardware resource utilization.

#### Programmatic Use

To set the block parameter value programmatically, use the `set_param` function.

To get the block parameter value programmatically, use the `get_param` function.

 Parameter: `nIterPerReg` Values: `1` (default) | positive integer-valued scalar Data Types: `char` | `string`

Example: `set_param(gcb,"nIterPerReg","2")`

## Tips

The blocks Divide by Constant HDL Optimized, Real Divide HDL Optimized, and Complex Divide HDL Optimized all perform the division operation and generate optimized HDL code.

• Real Divide HDL Optimized and Complex Divide HDL Optimized are based on a CORIDC algorithm. These blocks accept a wide variety of inputs, but will result in greater latency.

• Divide by Constant HDL Optimized accepts only real inputs and a constant divisor. Use of this block consumes DSP slices, but will complete the division operation in fewer cycles and at a higher clock rate.

expand all

## Version History

Introduced in R2021a

expand all