Main Content

Fixed-Point Math Operations in MATLAB and Simulink

CORDIC-based and other embedded-optimized math operations for efficient C/C++ and HDL code

The Fixed-Point Designer™ library of blocks provide hardware-efficient implementations of common math and matrix operations using algorithms such as CORDIC. Generate HDL code for designs that incorporate these blocks using HDL Coder™. The Fixed-Point Designer library of functions include CORDIC-based and other hardware-efficient implementations of math operations such as division, exponential operations, and trigonometric functions. Use coder to generate C/C++ code for designs that incorporate these functions.

CORDIC (COordinate Rotation DIgital Computer) based algorithms are some of the most hardware efficient algorithms because they require only iterative shift-add operations. The CORDIC algorithm eliminates the need for explicit multipliers, and is suitable for calculating a variety of functions.

For CORDIC-based implementations of matrix operations, including linear system solvers and matrix decompositions in MATLAB® and Simulink®, see Fixed-Point Matrix Operations in MATLAB and Fixed-Point Matrix Operations in Simulink.

Functions

expand all

cordicsigmoidCORDIC-based approximation of sigmoid activation (Since R2023b)
ceilDivRound the result of division toward positive infinity (Since R2021a)
fixDivRound the result of division toward zero (Since R2021a)
floorDivRound the result of division toward negative infinity (Since R2021a)
nearestDivRound the result of division toward the nearest integer (Since R2021a)
modByConstantModulus after division by a constant denominator (Since R2021a)
fixed.cordicDivideCORDIC-based fixed-point divide (Since R2020b)
fixed.cordicReciprocalCORDIC-based fixed-point reciprocal (Since R2021b)
cordicsqrtCORDIC-based approximation of square root
cordicabsCORDIC-based absolute value
cordicangleCORDIC-based phase angle
cordiccexpCORDIC-based approximation of complex exponential
cordicacosCORDIC-based approximation of inverse cosine
cordicasinCORDIC-based approximation of inverse sine
cordicatan2CORDIC-based four quadrant inverse tangent
cordiccosCORDIC-based approximation of cosine
cordicsinCORDIC-based approximation of sine
cordicsincosCORDIC-based approximation of sine and cosine
cordicsinhcoshCORDIC-based approximation of hyperbolic sine and cosine (Since R2023b)
cordictanhCORDIC-based hyperbolic tangent
cordiccart2polCORDIC-based transformation of Cartesian coordinates to polar
cordicpol2cartCORDIC-based approximation of polar-to-Cartesian conversion
cordicrotateCORDIC-based approximation of rotation of input

Blocks

expand all

CORDIC Sigmoid HDL OptimizedCompute CORDIC-based sigmoid activation and generate optimized HDL code (Since R2024a)
Complex Divide HDL OptimizedDivide one input by another using CORDIC algorithm and generate optimized HDL code (Since R2021a)
Real Divide HDL OptimizedDivide one real input by another using CORDIC algorithm and generate optimized HDL code (Since R2021a)
Divide by Constant HDL OptimizedDivide input by a constant and round to integer and generate optimized HDL code (Since R2021a)
Divide by Constant and RoundDivide input by a constant and round to integer (Since R2021a)
Modulo by Constant HDL OptimizedPerform mod operation with a constant denominator and generate optimized HDL code (Since R2021a)
Modulo by ConstantPerform modulo operation with a constant denominator (Since R2021a)
Normalized Reciprocal HDL OptimizedComputes normalized reciprocal using CORDIC algorithm and generates optimized HDL code
Real Reciprocal HDL OptimizedCompute reciprocal using CORDIC algorithm and generate optimized HDL code (Since R2021a)
CORDIC Square Root HDL OptimizedCORDIC-based approximation of square root (Since R2024a)
Complex to Magnitude-AngleCompute magnitude and phase angle of complex signal using CORDIC algorithm
Magnitude-Angle to ComplexConvert magnitude and/or a phase angle signal to complex signal
Hyperbolic Tangent HDL OptimizedComputes CORDIC-based hyperbolic tangent and generates optimized HDL code
Trigonometric FunctionSpecified trigonometric function on input
Euler to NED Transformation HDL OptimizedComputes Euler to North-East-Down transformation using pipelined or burst architecture and generates optimized HDL code (Since R2022b)

Topics

Featured Examples