# Divide

Implement control-signal-based division operation

Since R2020b

## 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")`

### Latency Considerations

You can simulate the Divide block with latency. This block is a masked subsystem that contains the `LumpLatency` MATLAB Function block. The subsystem uses this MATLAB Function block to compute the latency based on the input and output data types. The software calculates the latency of the block using the word length and fractional length of fixed-point input and output.

The block supports three latency modes. You can specify a custom latency value by setting the Latency Strategy parameter to `Custom`.

To view the function that computes the latency of the block, open the `LumpLatency` block in the masked subsystem. To view inside the mask, click the ⇩ icon on the block. For more information, see Lump Latency for Divide Block.

## Limitations

• The block does not support floating-point data types, such as `half`, `single`, and `double`.

## Ports

### Input

expand all

Dividend input to calculate the division.

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

Divisor input to calculate the division.

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

Input control signal that indicates whether the input signal is valid.

Data Types: `Boolean`

### Output

expand all

Output signal that is the division of the dividend and divisor input signals.

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

Output control signal that indicates whether output signal is valid.

Data Types: `Boolean`

## Parameters

expand all

Specify whether to map the blocks in your design to minimum, maximum, custom, or zero latency. For more information, see LatencyStrategy.

#### Programmatic Use

 Block Parameter: `latencyMode` Type: character vector Values: `'Max'` | `'Min'` | `'Custom'` | `'Zero'` Default: `'Max'`

When you set Latency strategy to `Custom`, use this parameter to 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`

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)` | ```''``` Default: ```'Inherit: Inherit via internal rule'```

## Tips

The block supports HDL code generation using HDL Coder™. HDL Coder supports additional configuration options that affect HDL implementation and synthesized logic. For more information, see HDL Block Properties.

expand all

## Version History

Introduced in R2020b