Main Content

Real Reciprocal HDL Optimized

R2026b

Compute reciprocal and generate optimized HDL code

  • Real Reciprocal HDL Optimized block

Libraries:
Fixed-Point Designer HDL Support / Math Operations

Description

The Real Reciprocal HDL Optimized block computes 1/u, where u is a real-valued input.

Limitations

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

Ports

Input

expand all

Value to take the reciprocal of, specified as a real-valued scalar, vector, or matrix.

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 u input port is valid. When this value is 1 (true), the block captures the value at the u input port. When this value is 0 (false), the block ignores the input samples.

Data Types: Boolean

Output

expand all

Reciprocal, returned as a real scalar, vector, or matrix of the same dimension as input u and with the data type 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, vector, or matrix of the same dimension as input u. 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 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

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Main

Since R2026b

Algorithm to use for approximation of reciprocal, specified as CORDIC or Lookup Table. For more information, see CORDIC Versus Lookup Table Approximation Methods.

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: ApproximationMethod
Values: CORDIC (default) | Lookup Table
Data Types: char | string

Example: set_param(gcb,"ApproximationMethod","CORDIC")

Data type of output at port y, specified as fixdt(1,18,10), single, double, fixdt(1,16,0), or 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.

Tips

  • Click the Show data type assistant button to open the Data Type Assistant, an interactive graphical tool that simplifies the task of specifying the data type for this block. For more information, see Specify Data Types Using Data Type Assistant.

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 type expression>
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)

Pipeline Configurations

Pipeline configuration parameters are enabled when the Approximation method parameter is set to CORDIC.

Since R2024b

Option to 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 = u.WordLength + ~issigned(u).

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 linear vectoring CORDIC, specified as a positive integer-valued scalar. The default value for this parameter is wl - 1, where wl = u.WordLength + ~issigned(u).

Dependencies

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

Tips

See How to Interface with the Real Reciprocal HDL Optimized Block for more information.

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.

For more information on how this parameter impacts latency and hardware resource utilization, see How to Interface with the Real Reciprocal HDL Optimized Block, Latency, and Effect of nIterPerReg on Latency and Hardware Resource Utilization. Use the Data Type Agent for Reciprocal HDL Optimized Blocks to generate an interactive visualization showing the effects of this parameter on pipelining allocation and latency.

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 behavior of the Real Reciprocal HDL Optimized block with Approximation method set to CORDIC is equivalent to the fixed.cordicReciprocal function. When the input to the function is a real number with a binary-point scaled fixed-point data type, the function and block provide bit-exact results.

  • The behavior of the Real Reciprocal HDL Optimized block with Approximation method set to Lookup Table is equivalent to the embblk.lookupTableReciprocal function. When the input to the function is a real number with a binary-point scaled fixed-point data type, the function and block provide bit-exact results.

Algorithms

expand all

References

[1] Volder, Jack E. “The CORDIC Trigonometric Computing Technique.” IRE Transactions on Electronic Computers EC-8, no. 3 (Sept. 1959): 330–34.

[2] Andraka, Ray. “A Survey of CORDIC Algorithm for FPGA Based Computers.” In Proceedings of the 1998 ACM/SIGDA Sixth International Symposium on Field Programmable Gate Arrays, 191–200. https://dl.acm.org/doi/10.1145/275107.275139.

[3] Walther, J.S. “A Unified Algorithm for Elementary Functions.” In Proceedings of the May 18-20, 1971 Spring Joint Computer Conference, 379–86. https://dl.acm.org/doi/10.1145/1478786.1478840.

[4] Schelin, Charles W. “Calculator Function Approximation.” The American Mathematical Monthly, no. 5 (May 1983): 317–25. https://doi.org/10.2307/2975781.

Extended Capabilities

expand all

Version History

Introduced in R2021a

expand all