Main Content

Divide

Compute division operation and simulate with latency

Since R2020b

  • HDL Math Divide Block

Libraries:
HDL Coder

Description

The Divide block performs the division operation on the input data signals. The block has control signals that indicate whether the input and output data are valid. You can also specify the number of iterations of the algorithm and the latency strategy.

To use this block in your Simulink® model, open the HDLMathLib library by entering this command in the MATLAB® Command Window:

open_system("HDLMathLib")
You can simulate the block with latency. For more information, see Latency Considerations.

Examples

Ports

Input

expand all

Dividend input to calculate the division, specified as a scalar or vector.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point

Divisor input to calculate the division, specified as a scalar or vector.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point

Input control signal that indicates whether the input signal is valid, specified as a scalar.

Data Types: Boolean

Output

expand all

Output signal that is the division of the dividend and divisor input signals, returned as a scalar or vector.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point

Output control signal that indicates whether output signal is valid, returned as a scalar.

Data Types: Boolean

Parameters

expand all

Specify whether to use minimum, maximum, custom, or zero latency. For more information, see Latency Strategy.

To use custom latency for the block, set the Latency strategy to Custom and enter the latency value in the Custom latency field.

You can also control the number of pipeline stages for the iterative algorithm. To customize the latency for iterative algorithm, set the Latency strategy to Custom(PerIteration) and enter the iterations per pipeline value in the IterationsPerPipeline field. (since R2025a)

Programmatic Use

Block Parameter: latencyMode
Type: character vector
Values: 'Max' | 'Min' | 'Custom' | 'Custom(PerIteration)' | 'Zero'
Default: 'Max'

Specify the custom latency value. The latency must be a nonnegative integer in the range [0, L], where L is the maximum latency value of Divide block. For more information, see CustomLatency.

Dependency

To use this parameter, set Latency strategy to Custom.

Programmatic Use

Block Parameter: customLatencyValue
Type: Integer
Values: 0 to Max latency
Default: 0

Since R2025a

Specify the iterations to use per each pipeline stage in the algorithm.

Dependency

To enable this parameter, set Latency strategy to Custom(PerIteration).

Programmatic Use

Block Parameter: iterationsPerPipelineValue
Type: Integer
Values: Positive integer
Default: 1

Specify the output data type. The data type can be inherited or specified directly.

Programmatic Use

Block Parameter: OutDataTypeStr
Type: character vector
Values: 'Inherit: Inherit via internal rule' | 'Inherit: Inherit via back propagation' | 'Inherit: Same as first input' | 'Inherit: Keep MSB' | 'Inherit: Match Scaling' | 'int8' | 'uint8' | int16 | 'uint16' | 'int32' | 'uint32' | 'int64' | 'uint64' | fixdt(1,16,0) | '<data type expression>'
Default: 'Inherit: Inherit via internal rule'

Specify the rounding mode for fixed-point operations. For more information, see Rounding Modes.

Programmatic Use

Block Parameter: RndMeth
Type: character vector
Values: 'Zero' | 'Ceiling' | 'Convergent' | 'Floor' | 'Nearest' | 'ROund' | 'Simplest'
Default: 'Zero'

Algorithms

expand all

Extended Capabilities

expand all

Version History

Introduced in R2020b

expand all