DSP Builder for Intel® FPGAs (Advanced Blockset): Handbook

ID 683337
Date 6/11/2024
Document Table of Contents

14.4.25. Divide

The Divide block divides the first input, a by the second input, b, to calculate the quotient, i.e. q = a/b. You can configure the divide block as a floating-point divider, fixed-point divider, or integer divider.

Floating-Point Divider

DSP Builder instantiates a floating-point divider if inputs a and b are both floating-point with matching formats. You can configure the block to perform a correctly rounded, round-to-nearest tie-breaks to even division as specified by the IEEE-754 standard by selecting correct from Floating-Point Rounding under Parameters.

You can adjust the resource utilization of this block by choosing different rounding modes. Selecting faithful from Floating-Point Rounding produces a last-bit accurate result, which often consumes fewer multipliers. Selecting native further lowers the resource utilization for a slightly lower accuracy. All floating-point architectures flush subnormals to zero on both the input and the output of the block.

Fixed-Point Divider

DSP Builder instantiates a fixed-point divider if you provide fixed-point types on the inputs of the block, and you turn off Integer Divider. The maximum input bit-width in fixed-point mode is 32 bits. The output of the block is one of the two closest fixed-point values to the mathematical result of dividing a by b.

Integer Divider

DSP Builder instantiates an integer divider if the divider block has integer inputs, both signed or both unsigned inputs, matching bit-widths, and you turn on Integer Divider. The output datatype matches the input datatype. The integer division rounds to zero. For example: 6/7 = 0 and -6/7 = 0.

Divide Block Parameters

Figure 116. Parameters for the Divide Block
Table 198.  Parameters for the Divide Block
Parameter Description
Output data type mode Determines how the block sets its output data type:
  • Inherit via internal rule:
    • For floating-point input data types, the output data type is the same. You may not mix different floating-point formats on the Divide block inputs.
    • For fixed-point input data types, and Integer division is off, if inputs are signed: output bitwidth equals the sum of input bitwidths + 1, if inputs are unsigned: output bitwidth equals sum of input bitwidths. The output fraction width is equal to the sum of the a-input fraction width, and the b-input integer bitwidth.
    • For integer (signed or unsigned) input types, and Integer division is on, the output type matches the input type.
  • Specify via dialog: you can set the output type of the block explicitly using additional fields that are available when you select this option. You may not select Specify via dialog for floating-point inputs. You can only use this option for fixed-point dividers (not integer) to trim bits off the least significant end of the default (inherited) output data type.
Output data type Specifies the output data type. For example, fixdt(1,16,15)
Output scaling value Specifies the output scaling value. For example, 2^-15.
Floating-point rounding This option only has an effect for floating-point inputs:
  • Correct: the result is correctly rounded IEEE-754, round-to-nearest tie breaks to even.
  • Faithful: the result is one of the two floating-point values closest to the mathematical result of the division operation.
  • Native: the accuracy may be compromised further to exploit hardware-specific features that can reduce resource utilization.
Table 199.  Data-Type Inheritance for Fixed-Point InputsThe table shows an example where input a is sfix16_en10 and input b is sfix12_en7. The output q is then sfix29_en15. The number of integer bits is the sum of the number of a integer bits and the number of b fraction bits plus 1. The number of fraction bits is the sum of the number of a fraction bits plus the number of b integer bits.
Port Fixed-Point Data Type Integer Bits Fraction Bits
a sfix16_en10 6 10
b sfix12_en7 5 7
q (Inherit via internal rule) sfix29_en15 6 + 7 + 1 = 14 10 + 5 = 15

If you select Specify via dialog for the Output data type mode, the block restricts the allowed data types to types that trim off bits from the least significant part of the quotient (based on default type propagation): sfix29_en15, sfix28_en14, sfix27_en13, etc.

Figure 117. Allowed Output Formats For the inputs in 0
Table 200.  Port Interface for the Divide Block
Signal Direction Type Description Vector Data Support Complex Data Support
a Input Any fixed- or floating-point type. Numerator Yes No
b Input Any fixed- or floating-point type. Denominator Yes No
q Output Any fixed- or floating-point type. Result Yes No