Main Content

Real Reciprocal HDL Optimized

Compute reciprocal using CORDIC algorithm and generate optimized HDL code

Since R2021a

  • 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 scalar.

Examples

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 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. 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

Data type of 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 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)

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 = 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 hyperbolic 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 Customizable Pipelining 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.

See Customizable Pipelining for more information. See How to Interface with the Real Reciprocal 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 behavior of the Real Reciprocal HDL Optimized block 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.

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–334.

[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–386. 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–325. https://doi.org/10.2307/2975781.

Extended Capabilities

expand all

Version History

Introduced in R2021a

expand all