Update repo
This commit is contained in:
1 parent
749dab5721
commit
ce65a0f59a
14950 files changed
+4408250
-1
No files matched your search
@@ -0,0 +1,107 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: C28x_FPU_FastRTS.h
|
||||
//
|
||||
// TITLE: Prototypes and Definitions for the C28x Fast RTS Library
|
||||
//
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// These prototypes are for functions not found in the standard
|
||||
// RTS library.
|
||||
//
|
||||
// For standard functions, include the appropriate header file as
|
||||
// usual. For example: math.h
|
||||
//
|
||||
//#############################################################################
|
||||
//!
|
||||
//! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
//! All rights reserved not granted herein.
|
||||
//! Limited License.
|
||||
//!
|
||||
//! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
//! non-exclusive license under copyrights and patents it now or hereafter
|
||||
//! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
//! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
//! foregoing patent license, such license is granted solely to the extent that
|
||||
//! any such patent is necessary to Utilize the software alone. The patent
|
||||
//! license shall not apply to any combinations which include this software,
|
||||
//! other than combinations with devices manufactured by or for TI
|
||||
//! ("TI Devices").
|
||||
//! No hardware patent is licensed hereunder.
|
||||
//!
|
||||
//! Redistributions must preserve existing copyright notices and reproduce this
|
||||
//! license (including the above copyright notice and the disclaimer and
|
||||
//! (if applicable) source code license limitations below) in the documentation
|
||||
//! and/or other materials provided with the distribution.
|
||||
//!
|
||||
//! Redistribution and use in binary form, without modification, are permitted
|
||||
//! provided that the following conditions are met:
|
||||
//!
|
||||
//! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
//! permitted with respect to any software provided in binary form.
|
||||
//! * Any redistribution and use are licensed by TI for use only
|
||||
//! with TI Devices.
|
||||
//! * Nothing shall obligate TI to provide you with source code for the
|
||||
//! software licensed and provided to you in object code.
|
||||
//!
|
||||
//! If software source code is provided to you, modification and redistribution
|
||||
//! of the source code are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * any redistribution and use of the source code, including any resulting
|
||||
//! derivative works, are licensed by TI for use only with TI Devices.
|
||||
//! * any redistribution and use of any object code compiled from the source
|
||||
//! code and any resulting derivative works, are licensed by TI for use
|
||||
//! only with TI Devices.
|
||||
//!
|
||||
//! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
//! suppliers may be used to endorse or promote products derived from this
|
||||
//! software without specific prior written permission.
|
||||
//#############################################################################
|
||||
|
||||
#ifndef C28X_FPU_FAST_RTS_H
|
||||
#define C28X_FPU_FAST_RTS_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Standard C28x Data Types
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef DSP28_DATA_TYPES
|
||||
#define DSP28_DATA_TYPES
|
||||
typedef int int16;
|
||||
typedef long int32;
|
||||
typedef long long int64;
|
||||
typedef unsigned int Uint16;
|
||||
typedef unsigned long Uint32;
|
||||
typedef unsigned long long Uint64;
|
||||
typedef float float32;
|
||||
typedef long double float64;
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Function Prototypes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
float32 isqrtf(float32 X);
|
||||
void sincos(float32 radian, float32* PtrSin, float32* PtrCos);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* extern "C" */
|
||||
|
||||
#endif // - end of C28X_FPU_FAST_RTS_H
|
||||
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
@@ -0,0 +1,419 @@
|
||||
#ifndef _FASTRTS_H_
|
||||
#define _FASTRTS_H_
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file fastrts_.h
|
||||
//!
|
||||
//! \brief Fast RTS Definitions and Types
|
||||
//! \author Vishal Coelho
|
||||
//! \date Dec 25, 2015
|
||||
//
|
||||
// Group: C2000
|
||||
// Target Device: C28x+FPU32/FPU64
|
||||
//
|
||||
//#############################################################################
|
||||
//!
|
||||
//! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
//! All rights reserved not granted herein.
|
||||
//! Limited License.
|
||||
//!
|
||||
//! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
//! non-exclusive license under copyrights and patents it now or hereafter
|
||||
//! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
//! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
//! foregoing patent license, such license is granted solely to the extent that
|
||||
//! any such patent is necessary to Utilize the software alone. The patent
|
||||
//! license shall not apply to any combinations which include this software,
|
||||
//! other than combinations with devices manufactured by or for TI
|
||||
//! ("TI Devices").
|
||||
//! No hardware patent is licensed hereunder.
|
||||
//!
|
||||
//! Redistributions must preserve existing copyright notices and reproduce this
|
||||
//! license (including the above copyright notice and the disclaimer and
|
||||
//! (if applicable) source code license limitations below) in the documentation
|
||||
//! and/or other materials provided with the distribution.
|
||||
//!
|
||||
//! Redistribution and use in binary form, without modification, are permitted
|
||||
//! provided that the following conditions are met:
|
||||
//!
|
||||
//! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
//! permitted with respect to any software provided in binary form.
|
||||
//! * Any redistribution and use are licensed by TI for use only
|
||||
//! with TI Devices.
|
||||
//! * Nothing shall obligate TI to provide you with source code for the
|
||||
//! software licensed and provided to you in object code.
|
||||
//!
|
||||
//! If software source code is provided to you, modification and redistribution
|
||||
//! of the source code are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * any redistribution and use of the source code, including any resulting
|
||||
//! derivative works, are licensed by TI for use only with TI Devices.
|
||||
//! * any redistribution and use of any object code compiled from the source
|
||||
//! code and any resulting derivative works, are licensed by TI for use
|
||||
//! only with TI Devices.
|
||||
//!
|
||||
//! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
//! suppliers may be used to endorse or promote products derived from this
|
||||
//! software without specific prior written permission.
|
||||
//#############################################################################
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// the includes
|
||||
//*****************************************************************************
|
||||
#include <stdint.h>
|
||||
|
||||
//!
|
||||
//! \defgroup FASTRTS_F64 Fast RTS Definitions and Types
|
||||
//!
|
||||
//! \ingroup FASTRTS_F64
|
||||
//@{
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//defines
|
||||
//*****************************************************************************
|
||||
//! FAST RTS Library Version
|
||||
#define LIBRARY_VERSION "2.05.00.00"
|
||||
|
||||
#define COMPILER_FPU64_SUPPORT 0U
|
||||
#define CONVERT_F32_TO_F64 0U
|
||||
|
||||
//! Determines if 0/0 results in a result of infinity
|
||||
#define ZERO_BY_ZERO_EQ_INF 1U
|
||||
//! Determines if 0/0 results in a result of zero
|
||||
#define ZERO_BY_ZERO_EQ_ZER0 (!ZERO_O_ZERO_EQ_INF)
|
||||
|
||||
//! This line prevents conflicts with the data types and macros declared in
|
||||
//! FPU DSP library
|
||||
#ifndef _RTS_IN_USE_
|
||||
#define _RTS_IN_USE_
|
||||
|
||||
//*****************************************************************************
|
||||
// typedefs
|
||||
//*****************************************************************************
|
||||
// c2000 types for IEEE754 (same as defined in <device>/inc/hw_types.h)
|
||||
#ifndef C2000_IEEE754_TYPES
|
||||
#define C2000_IEEE754_TYPES
|
||||
#ifdef __TI_EABI__
|
||||
typedef float float32_t;
|
||||
typedef double float64_t;
|
||||
#else // TI COFF
|
||||
typedef float float32_t;
|
||||
typedef long double float64_t;
|
||||
#endif // __TI_EABI__
|
||||
#endif // C2000_IEEE754_TYPES
|
||||
|
||||
#if defined(__TMS320C28XX_FPU64__)
|
||||
//! \brief 64-bit Double Precision Float
|
||||
//! The union of a double precision value, an unsigned long long and a signed
|
||||
//! long long allows for manipulation of the hex representation of the floating
|
||||
//! point value as well as signed and unsigned arithmetic to determine error
|
||||
//! metrics.
|
||||
//! This data type is only defined if the compiler option --float_support is
|
||||
//! set to fpu64
|
||||
//!
|
||||
typedef union
|
||||
{
|
||||
uint64_t ui64; //!< Unsigned long long representation
|
||||
int64_t i64; //!< Signed long long represntaion
|
||||
float64_t f64; //!< Double precision (64-bit) representation
|
||||
}float64u_t;
|
||||
#endif //defined(__TMS320C28XX_FPU64__)
|
||||
|
||||
#if (defined(__TMS320C28XX_FPU32__) || defined(__TMS320C28XX_FPU64__))
|
||||
//! \brief 32-bit Double Precision Float
|
||||
//! The union of a double precision value, an unsigned long and a signed
|
||||
//! long allows for manipulation of the hex representation of the floating
|
||||
//! point value as well as signed and unsigned arithmetic to determine error
|
||||
//! metrics.
|
||||
//! This data type is only defined if the compiler option --float_support is
|
||||
//! set to fpu32
|
||||
//!
|
||||
typedef union
|
||||
{
|
||||
uint32_t ui32; //!< Unsigned long representation
|
||||
int32_t i32; //!< Signed long represntaion
|
||||
float f32; //!< Single precision (32-bit) representation
|
||||
}float32u_t;
|
||||
#endif //defined(__TMS320C28XX_FPU32__)
|
||||
|
||||
//! \brief a function pointer with a void pointer argument returning nothing
|
||||
//!
|
||||
typedef void (*v_pfn_v)(void *);
|
||||
|
||||
#if !(defined(__TMS320C28XX_FPU32__) || defined(__TMS320C28XX_FPU64__))
|
||||
#error "--float_support=fpu64 option must be set to build the FPU64 \
|
||||
version of the library. --float_support=fpu32 must be set to build the \
|
||||
FPU32 version of the DSP library"
|
||||
#endif // (defined(__TMS320C28XX_FPU32__) || defined(__TMS320C28XX_FPU64__))
|
||||
|
||||
#endif // _RTS_IN_USE
|
||||
|
||||
//*****************************************************************************
|
||||
//globals
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
// the function prototypes
|
||||
//*****************************************************************************
|
||||
#if defined(__TMS320C28XX_FPU64__)
|
||||
void run_sin(float64u_t *pdest, float64u_t *psrc);
|
||||
void run_cos(float64u_t *pdest, float64u_t *psrc);
|
||||
void run_isqrt(float64u_t *pdest, float64u_t *psrc);
|
||||
void run_sqrt(float64u_t *pdest, float64u_t *psrc);
|
||||
void run_div(float64u_t *pdest, float64u_t *psrc1, float64u_t *psrc2);
|
||||
void run_sincos(float64u_t *pangle, float64u_t *psin, float64u_t *pcos);
|
||||
void run_atan(float64u_t *pdest, float64u_t *psrc);
|
||||
void run_atan2(float64u_t *pdest, float64u_t *psrc1, float64u_t *psrc2);
|
||||
#endif //__TMS320C28XX_FPU64__
|
||||
|
||||
#if defined(FOR_DOXYGEN_USE_ONLY)
|
||||
#if defined(__TMS320C28XX_FPU64__)
|
||||
//! \brief Double Precision Floating Point Sine and Cosine (radians)
|
||||
//!
|
||||
//! Returns both the sine and cosine of a floating-point argument X (in
|
||||
//! radians) using table look-up and Taylor series expansion between the
|
||||
//! look-up table entries.
|
||||
//!
|
||||
//! \param[in] X double precision floating point argument
|
||||
//! \param[out] PtrSin pointer to the sine of the argument
|
||||
//! \param[out] PtrCin pointer to the cosine of the argument
|
||||
//! \return none
|
||||
//!
|
||||
//! \note This is not a standard C Math function; it requires the
|
||||
//! "fastrts.h" header instead of "math.h"
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 73 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
#ifdef __TI_EABI__
|
||||
void sincos(float64u_t radian, float64u_t* PtrSin, float64u_t* PtrCos);
|
||||
#else
|
||||
void sincosl(float64u_t radian, float64u_t* PtrSin, float64u_t* PtrCos);
|
||||
#endif
|
||||
|
||||
//! \brief Single-Precision Floating-Point 1.0/Square Root
|
||||
//! \param[in] X double precision floating point argument
|
||||
//! \return 1.0 /square root of a floating-point argument X using a Newton-
|
||||
//! Raphson algorithm.
|
||||
//!
|
||||
//! \attention
|
||||
//! -# isqrt(FLT_MAX) and isqrt(FLT_MIN) set the LUF flag.
|
||||
//! -# isqrt(-FLT_MIN) will set both the LUF and LVF flags.
|
||||
//! -# isqrt(0.0) sets the LVF flag.
|
||||
//! -# If X is negative, isqrt(X) will set LVF and return 0.0.
|
||||
//! -# This square root routine computes \f$\sqrt{x}\f$ by first estimating
|
||||
//! \f$\frac{1}{\sqrt{x}}\f$, performing a few iterations of Newton-Raphson
|
||||
//! approximation to improve the precision of \f$\frac{1}{\sqrt{x}}\f$, and
|
||||
//! then finally multiplying that estimate by x; it essentially computes
|
||||
//! \f$\sqrt{x}\f$ as \f$\frac{1}{\sqrt{x}} \times x\f$. If
|
||||
//! \f$\frac{1}{\sqrt{x}}\f$ is not perfectly representable in the floating
|
||||
//! point format it can lead to inaccuracies in the final result. The user is
|
||||
//! encouraged to use the standard runtime support library division routine if
|
||||
//! accuracy takes priority over speed.
|
||||
//!
|
||||
//! \note
|
||||
//! -# This function is not included in the standard RTS library. It is
|
||||
//! typically computed as \e 1.0L/sqrt(X) . To use this function
|
||||
//! you must modify your code to instead call isqrt(X).
|
||||
//! -# When migrating from an IQmath project, you can modify the IQmath
|
||||
//! header file to use isqrt(X) when configured for FLOAT_MATH.
|
||||
//! -# This is not a standard C Math function; it requires the
|
||||
//! "fastrts.h" header instead of "math.h"
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 59 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
#ifdef __TI_EABI__
|
||||
float64u_t isqrt(float64u_t X);
|
||||
#else
|
||||
float64u_t isqrtl(float64u_t X);
|
||||
#endif
|
||||
|
||||
|
||||
//! \brief Single-Precision Floating-Point ATAN (radians)
|
||||
//! \param[in] X double precision floating point argument
|
||||
//! \return the arc tangent of a floating-point argument X. The return value
|
||||
//! is an angle in the range \f$[-{\pi}, {\pi}]\f$ radians.
|
||||
//!
|
||||
//! \note This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 78 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
#ifdef __TI_EABI__
|
||||
float64u_t atan (float64u_t X);
|
||||
#else
|
||||
float64u_t atanl (float64u_t X);
|
||||
#endif
|
||||
|
||||
|
||||
//! \brief Single-Precision Floating-Point ATAN2 (radians)
|
||||
//! \param[in] Y first double precision floating point argument
|
||||
//! \param[in] X second double precision floating point argument
|
||||
//! \return the 4-quadrant arctangent of floating-point arguments X/Y. The
|
||||
//! return value is an angle in the range \f$[-{\pi}, {\pi}]\f$
|
||||
//!
|
||||
//! \note This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 81 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
#ifdef __TI_EABI__
|
||||
float64u_t atan2 (float64u_t Y, float64u_t X);
|
||||
#else
|
||||
float64u_t atan2l (float64u_t Y, float64u_t X);
|
||||
#endif
|
||||
|
||||
|
||||
//! \brief Single-Precision Floating-Point Cosine (radians)
|
||||
//! \param[in] X double precision floating point argument
|
||||
//! \return the cosine of a floating-point argument X (in radians) using table
|
||||
//! look-up and Taylor series expansion between the look-up table entries.
|
||||
//!
|
||||
//! \note This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 63 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
#ifdef __TI_EABI__
|
||||
float64u_t cos (float64u_t X);
|
||||
#else
|
||||
float64u_t cosl (float64u_t X);
|
||||
#endif
|
||||
|
||||
|
||||
//! \brief Single-Precision Floating-Point Division
|
||||
//!
|
||||
//! Replaces the single-precision division operation from the standard RTS
|
||||
//! library. This function uses a Newton-Raphson algorithm.
|
||||
//!
|
||||
//! In C code, an expression of the type \code Z = Y/X \endcode will
|
||||
//! invoke FS$$DIV
|
||||
//!
|
||||
//! \param[in] X double precision floating point numerator
|
||||
//! \param[in] Y double precision floating point denominator
|
||||
//! \return the quotient
|
||||
//!
|
||||
//! \attention
|
||||
//! -# This division routine computes y/x by first estimating (1/x), performing
|
||||
//! a few iterations of Newton-Raphson approximation to improve the precision
|
||||
//! of 1/x, and then finally multiplying that estimate by y; it essentially
|
||||
//! computes y/x as (1/x)*y. If 1/x is not perfectly representable in the
|
||||
//! floating point format it can lead to inaccuracies in the final result. The
|
||||
//! user is encouraged to use the standard runtime support library division
|
||||
//! routine if accuracy takes priority over speed.
|
||||
//! -# These are the special cases for division
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Special Cases for Division</caption>
|
||||
//! <tr><th> Case <th> Result <th> Flags
|
||||
//! <tr><td> (0.0/0.0) <td> = +infinity <td>
|
||||
//! <tr><td> (+DBL_MAX/+DBL_MAX) <td> = 0.0 <td> LUF = 1
|
||||
//! <tr><td> (-DBL_MAX/+DBL_MAX) <td> = -0.0 <td> LUF = 1
|
||||
//! <tr><td> (+DBL_MAX/-DBL_MAX) <td> = 0.0 <td> LUF = 1
|
||||
//! <tr><td> (-DBL_MAX/-DBL_MAX) <td> = -0.0 <td> LUF = 1
|
||||
//! <tr><td> (+DBL_MIN/+DBL_MAX) <td> = 0.0 <td> LUF = 1
|
||||
//! <tr><td> (-DBL_MIN/+DBL_MAX) <td> = -0.0 <td> LUF = 1
|
||||
//! <tr><td> (+DBL_MIN/-DBL_MAX) <td> = 0.0 <td> LUF = 1
|
||||
//! <tr><td> (-DBL_MIN/-DBL_MAX) <td> = -0.0 <td> LUF = 1
|
||||
//! </table>
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 51 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
#ifdef __TI_EABI__
|
||||
float64u_t __c28xabi_div (float64u_t X, float64u_t Y);
|
||||
#else
|
||||
float64u_t FD$$DIV (float64u_t X, float64u_t Y);
|
||||
#endif
|
||||
|
||||
|
||||
//! \brief Single-Precision Floating-Point Sine (radians)
|
||||
//! \param[in] X double precision floating point argument
|
||||
//! \return the sine of a floating-point argument X (in radians) using table
|
||||
//! look-up and Taylor series expansion between the look-up table entries.
|
||||
//!
|
||||
//! \note This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 63 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
#ifdef __TI_EABI__
|
||||
float64u_t sin (float64u_t X);
|
||||
#else
|
||||
float64u_t sinl (float64u_t X);
|
||||
#endif
|
||||
|
||||
|
||||
//! \brief Single-Precision Floating-Point Square Root
|
||||
//! \param[in] X double precision floating point argument
|
||||
//! \return the square root of a floating-point argument X using a Newton-
|
||||
//! Raphson algorithm.
|
||||
//!
|
||||
//! \note This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//!
|
||||
//! \attention
|
||||
//! -# sqrt(FLT_MAX) and sqrt(FLT_MIN) set the LUF flag.
|
||||
//! -# sqrt(-FLT_MIN) will set both the LUF and LVF flags.
|
||||
//! -# sqrt(0.0) sets the LVF flag.
|
||||
//! -# If X is negative, sqrt(X) will set LVF and return 0.0.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 63 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
#ifdef __TI_EABI__
|
||||
float64u_t sqrt (float64u_t X);
|
||||
#else
|
||||
float64u_t sqrtl (float64u_t X);
|
||||
#endif
|
||||
|
||||
#endif //__TMS320C28XX_FPU64__
|
||||
#endif //FOR_DOXYGEN_USE_ONLY
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // extern "C"
|
||||
//@} // ingroup
|
||||
|
||||
#endif // end of _FASTRTS_H_definition
|
||||
|
||||
// End of File
|
||||
@@ -0,0 +1,453 @@
|
||||
#ifndef _C28X_FPU_FAST_RTS_H_
|
||||
#define _C28X_FPU_FAST_RTS_H_
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file C28x_FPU_FastRTS.h
|
||||
//!
|
||||
//! \brief Prototypes and Definitions for the Single Precision C28x Fast RTS
|
||||
//! Library
|
||||
//!
|
||||
//! These prototypes are for functions not found in the standard
|
||||
//! RTS library.
|
||||
//!
|
||||
//! For standard functions, include the appropriate header file as
|
||||
//! usual. For example: math.h
|
||||
//
|
||||
// Group: C2000
|
||||
// Target Device: C28x+FPU32/FPU64
|
||||
//
|
||||
//#############################################################################
|
||||
//!
|
||||
//! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
//! All rights reserved not granted herein.
|
||||
//! Limited License.
|
||||
//!
|
||||
//! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
//! non-exclusive license under copyrights and patents it now or hereafter
|
||||
//! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
//! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
//! foregoing patent license, such license is granted solely to the extent that
|
||||
//! any such patent is necessary to Utilize the software alone. The patent
|
||||
//! license shall not apply to any combinations which include this software,
|
||||
//! other than combinations with devices manufactured by or for TI
|
||||
//! ("TI Devices").
|
||||
//! No hardware patent is licensed hereunder.
|
||||
//!
|
||||
//! Redistributions must preserve existing copyright notices and reproduce this
|
||||
//! license (including the above copyright notice and the disclaimer and
|
||||
//! (if applicable) source code license limitations below) in the documentation
|
||||
//! and/or other materials provided with the distribution.
|
||||
//!
|
||||
//! Redistribution and use in binary form, without modification, are permitted
|
||||
//! provided that the following conditions are met:
|
||||
//!
|
||||
//! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
//! permitted with respect to any software provided in binary form.
|
||||
//! * Any redistribution and use are licensed by TI for use only
|
||||
//! with TI Devices.
|
||||
//! * Nothing shall obligate TI to provide you with source code for the
|
||||
//! software licensed and provided to you in object code.
|
||||
//!
|
||||
//! If software source code is provided to you, modification and redistribution
|
||||
//! of the source code are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * any redistribution and use of the source code, including any resulting
|
||||
//! derivative works, are licensed by TI for use only with TI Devices.
|
||||
//! * any redistribution and use of any object code compiled from the source
|
||||
//! code and any resulting derivative works, are licensed by TI for use
|
||||
//! only with TI Devices.
|
||||
//!
|
||||
//! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
//! suppliers may be used to endorse or promote products derived from this
|
||||
//! software without specific prior written permission.
|
||||
//#############################################################################
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// the includes
|
||||
//*****************************************************************************
|
||||
#include <stdint.h>
|
||||
|
||||
//!
|
||||
//! \defgroup FASTRTS_F32 Fast RTS (FPU32) Library Definitions and Types
|
||||
//!
|
||||
//! \ingroup FASTRTS_F32
|
||||
//@{
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
// defines
|
||||
//*****************************************************************************
|
||||
#ifndef __TI_EABI__
|
||||
#define sincos sincosf
|
||||
#define isqrt isqrtf
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
// typedefs
|
||||
//*****************************************************************************
|
||||
// c2000 types for IEEE754 (same as defined in <device>/inc/hw_types.h)
|
||||
#ifndef C2000_IEEE754_TYPES
|
||||
#define C2000_IEEE754_TYPES
|
||||
#ifdef __TI_EABI__
|
||||
typedef float float32_t;
|
||||
typedef double float64_t;
|
||||
#else // TI COFF
|
||||
typedef float float32_t;
|
||||
typedef long double float64_t;
|
||||
#endif // __TI_EABI__
|
||||
#endif // C2000_IEEE754_TYPES
|
||||
|
||||
//*****************************************************************************
|
||||
// the function prototypes
|
||||
//*****************************************************************************
|
||||
|
||||
//! \brief Single Precision Floating Point Sine and Cosine (radians)
|
||||
//!
|
||||
//! Returns both the sine and cosine of a floating-point argument X (in
|
||||
//! radians) using table look-up and Taylor series expansion between the
|
||||
//! look-up table entries.
|
||||
//!
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! \param[out] PtrSin pointer to the sine of the argument
|
||||
//! \param[out] PtrCin pointer to the cosine of the argument
|
||||
//! \return none
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is not a standard C Math function; it requires the
|
||||
//! "C28x_FPU_FastRTS.h" header instead of "math.h"
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 44 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
void sincosf(float32_t radian, float32_t* PtrSin, float32_t* PtrCos);
|
||||
|
||||
//! \brief Single-Precision Floating-Point 1.0/Square Root
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! \return 1.0 /square root of a floating-point argument X using a Newton-
|
||||
//! Raphson algorithm.
|
||||
//!
|
||||
//! \attention
|
||||
//! -# isqrt(FLT_MAX) and isqrt(FLT_MIN) set the LUF flag.
|
||||
//! -# isqrt(-FLT_MIN) will set both the LUF and LVF flags.
|
||||
//! -# isqrt(0.0) sets the LVF flag.
|
||||
//! -# If X is negative, isqrt(X) will set LVF and return 0.0.
|
||||
//!
|
||||
//! \note
|
||||
//! -# This function is not included in the standard RTS library. It is
|
||||
//! typically computed as \e 1.0L/sqrt(X) . To use this function
|
||||
//! you must modify your code to instead call isqrt(X).
|
||||
//! -# When migrating from an IQmath project, you can modify the IQmath
|
||||
//! header file to use isqrt(X) when configured for FLOAT_MATH.
|
||||
//! -# This is not a standard C Math function; it requires the
|
||||
//! "C28x_FPU_FastRTS.h" header instead of "math.h"
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 26 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t isqrtf(float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point ASIN (radians)
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! must be in the range \f$[-{\1}, {\1}]\f$
|
||||
//! \return the arc tangent of a floating-point argument X. The return value
|
||||
//! is an angle in the range \f$[-{\pi}, {\pi}]\f$ radians.
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 55 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t asinf (float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point ACOS (radians)
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! must be in the range \f$[-{\1}, {\1}]\f$
|
||||
//! \return the arc tangent of a floating-point argument X. The return value
|
||||
//! is an angle in the range \f$[-{\pi}, {\pi}]\f$ radians.
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 60 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t acosf (float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point ATAN (radians)
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! \return the arc tangent of a floating-point argument X. The return value
|
||||
//! is an angle in the range \f$[-{\pi}, {\pi}]\f$ radians.
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 49 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t atanf (float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point ATAN2 (radians)
|
||||
//! \param[in] Y first single precision floating point argument
|
||||
//! \param[in] X second single precision floating point argument
|
||||
//! \return the 4-quadrant arctangent of floating-point arguments X/Y. The
|
||||
//! return value is an angle in the range \f$[-{\pi}, {\pi}]\f$
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 50 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t atan2f (float32_t Y, float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point Cosine (radians)
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! \return the cosine of a floating-point argument X (in radians) using table
|
||||
//! look-up and Taylor series expansion between the look-up table entries.
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 38 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t cosf (float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point Division
|
||||
//!
|
||||
//! Replaces the single-precision division operation from the standard RTS
|
||||
//! library. This function uses a Newton-Raphson algorithm.
|
||||
//!
|
||||
//! In C code, an expression of the type \code Z = Y/X \endcode will
|
||||
//! invoke FS$$DIV
|
||||
//!
|
||||
//! \param[in] X single precision floating point numerator
|
||||
//! \param[in] Y single precision floating point denominator
|
||||
//! \return the quotient
|
||||
//!
|
||||
//! \attention
|
||||
//! -# This division routine computes y/x by first estimating (1/x), performing
|
||||
//! a few iterations of Newton-Raphson approximation to improve the precision
|
||||
//! of 1/x, and then finally multiplying that estimate by y; it essentially
|
||||
//! computes y/x as (1/x)*y. If 1/x is not perfectly representable in the
|
||||
//! floating point format it can lead to inaccuracies in the final result. The
|
||||
//! user is encouraged to use the standard runtime support library division
|
||||
//! routine if accuracy takes priority over speed.
|
||||
//! -# These are the special cases for division
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Special Cases for Division</caption>
|
||||
//! <tr><th> Case <th> Result <th> Flags
|
||||
//! <tr><td> (0.0/0.0) <td> = +infinity <td>
|
||||
//! <tr><td> (+FLT_MAX/+FLT_MAX) <td> = 0.0 <td> LUF = 1
|
||||
//! <tr><td> (-FLT_MAX/+FLT_MAX) <td> = -0.0 <td> LUF = 1
|
||||
//! <tr><td> (+FLT_MAX/-FLT_MAX) <td> = 0.0 <td> LUF = 1
|
||||
//! <tr><td> (-FLT_MAX/-FLT_MAX) <td> = -0.0 <td> LUF = 1
|
||||
//! <tr><td> (+FLT_MIN/+FLT_MAX) <td> = 0.0 <td> LUF = 1
|
||||
//! <tr><td> (-FLT_MIN/+FLT_MAX) <td> = -0.0 <td> LUF = 1
|
||||
//! <tr><td> (+FLT_MIN/-FLT_MAX) <td> = 0.0 <td> LUF = 1
|
||||
//! <tr><td> (-FLT_MIN/-FLT_MAX) <td> = -0.0 <td> LUF = 1
|
||||
//! </table>
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 25 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t FS$$DIV (float32_t X, float32_t Y);
|
||||
|
||||
//! \brief Single-Precision Floating-Point Sine (radians)
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! \return the sine of a floating-point argument X (in radians) using table
|
||||
//! look-up and Taylor series expansion between the look-up table entries.
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 38 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t sinf (float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point Square Root
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! \return the square root of a floating-point argument X using a Newton-
|
||||
//! Raphson algorithm.
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! \attention
|
||||
//! -# sqrt(FLT_MAX) and sqrt(FLT_MIN) set the LUF flag.
|
||||
//! -# sqrt(-FLT_MIN) will set both the LUF and LVF flags.
|
||||
//! -# sqrt(0.0) sets the LVF flag.
|
||||
//! -# If X is negative, sqrt(X) will set LVF and return 0.0.
|
||||
//! -# This square root routine computes \f$\sqrt{x}\f$ by first estimating
|
||||
//! \f$\frac{1}{\sqrt{x}}\f$, performing a few iterations of Newton-Raphson
|
||||
//! approximation to improve the precision of \f$\frac{1}{\sqrt{x}}\f$, and
|
||||
//! then finally multiplying that estimate by x; it essentially computes
|
||||
//! \f$\sqrt{x}\f$ as \f$\frac{1}{\sqrt{x}} \times x\f$. If
|
||||
//! \f$\frac{1}{\sqrt{x}}\f$ is not perfectly representable in the floating
|
||||
//! point format it can lead to inaccuracies in the final result. The user is
|
||||
//! encouraged to use the standard runtime support library division routine if
|
||||
//! accuracy takes priority over speed.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 29 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t sqrtf (float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point Exponent
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! \return the exponent of a floating-point argument X using table
|
||||
//! look-up and Taylor series expansion of the fractional part of the argument.
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# the input domain is limited to +-log(FLT_MAX) (< +-89)
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 61 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t expf (float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point Natural Logarithm
|
||||
//! \param[in] X single precision floating point argument
|
||||
//! \return the natural logarithm of a floating-point argument X
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# the input must be greater than or equal to 1
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 51 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t logf (float32_t X);
|
||||
|
||||
//! \brief Single-Precision Floating-Point Power Function
|
||||
//! \param[in] X single precision floating point base argument
|
||||
//! \param[in] Y single precision floating point exponent argument
|
||||
//! \return X^Y
|
||||
//!
|
||||
//! \note
|
||||
//! -# This is a standard C math function and requires "math.h" to be
|
||||
//! included
|
||||
//! -# the input X must be greater than or equal to 1
|
||||
//! -# For COFF executables float and double are both single precision
|
||||
//! 32-bit floating point types, therefore, the double and float variant of
|
||||
//! this function may be used interchangeably.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 109 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
float32_t powf(float32_t X, float32_t Y);
|
||||
|
||||
//! \brief Fast memory copy function
|
||||
//! \param[in] Dst Destination address pointer
|
||||
//! \param[in] Src Source address pointer
|
||||
//! \param[in] num_words Number of 16-bit words
|
||||
//! \return void
|
||||
//!
|
||||
//
|
||||
void memcpy_fastrts(void *dst,void *src, uint16_t num_words);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // extern "C"
|
||||
//@} // ingroup
|
||||
|
||||
#endif // - end of _C28X_FPU_FAST_RTS_H_
|
||||
|
||||
// End of File
|
||||
@@ -0,0 +1,297 @@
|
||||
#ifndef _CORDIC_H_
|
||||
#define _CORDIC_H_
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file cordic.h
|
||||
//!
|
||||
//! \brief COordinate Rotation DIgital Computer (CORDIC)
|
||||
//! \author Vishal Coelho
|
||||
//! \date Nov 14, 2016
|
||||
//
|
||||
// Group: C2000
|
||||
// Target Device: C28x+FPU32/FPU64
|
||||
//
|
||||
//#############################################################################
|
||||
//!
|
||||
//! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
//! All rights reserved not granted herein.
|
||||
//! Limited License.
|
||||
//!
|
||||
//! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
//! non-exclusive license under copyrights and patents it now or hereafter
|
||||
//! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
//! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
//! foregoing patent license, such license is granted solely to the extent that
|
||||
//! any such patent is necessary to Utilize the software alone. The patent
|
||||
//! license shall not apply to any combinations which include this software,
|
||||
//! other than combinations with devices manufactured by or for TI
|
||||
//! ("TI Devices").
|
||||
//! No hardware patent is licensed hereunder.
|
||||
//!
|
||||
//! Redistributions must preserve existing copyright notices and reproduce this
|
||||
//! license (including the above copyright notice and the disclaimer and
|
||||
//! (if applicable) source code license limitations below) in the documentation
|
||||
//! and/or other materials provided with the distribution.
|
||||
//!
|
||||
//! Redistribution and use in binary form, without modification, are permitted
|
||||
//! provided that the following conditions are met:
|
||||
//!
|
||||
//! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
//! permitted with respect to any software provided in binary form.
|
||||
//! * Any redistribution and use are licensed by TI for use only
|
||||
//! with TI Devices.
|
||||
//! * Nothing shall obligate TI to provide you with source code for the
|
||||
//! software licensed and provided to you in object code.
|
||||
//!
|
||||
//! If software source code is provided to you, modification and redistribution
|
||||
//! of the source code are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * any redistribution and use of the source code, including any resulting
|
||||
//! derivative works, are licensed by TI for use only with TI Devices.
|
||||
//! * any redistribution and use of any object code compiled from the source
|
||||
//! code and any resulting derivative works, are licensed by TI for use
|
||||
//! only with TI Devices.
|
||||
//!
|
||||
//! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
//! suppliers may be used to endorse or promote products derived from this
|
||||
//! software without specific prior written permission.
|
||||
//#############################################################################
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// the includes
|
||||
//*****************************************************************************
|
||||
#include <stdint.h>
|
||||
|
||||
//!
|
||||
//! \defgroup CORDIC_F64 COordinate Rotation DIgital Computer (CORDIC)
|
||||
//! Definitions and Types
|
||||
//!
|
||||
//! \ingroup CORDIC_F64
|
||||
//@{
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//defines
|
||||
//*****************************************************************************
|
||||
// Maximum number of CORDIC iterations possible
|
||||
#define MAX_CORDIC_ITERATIONS (64U)
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// typedefs
|
||||
//*****************************************************************************
|
||||
//! CORDIC structure
|
||||
//!
|
||||
typedef struct _CORDIC_F64_
|
||||
{
|
||||
int64_t *x_i; //!< pointer to x coordinate
|
||||
int64_t *y_i; //!< pointer to y coordinate
|
||||
int64_t *z_i; //!< pointer to mode dependent angle (or angular
|
||||
//! error)
|
||||
uint16_t N; //!< number of CORDIC iterations (max = 64)
|
||||
const int64_t *atanTable; //!< Pointer to the atan(2^-i) table
|
||||
void (*runKernel)(void *); //!< CORDIC kernel
|
||||
}CORDIC_F64;
|
||||
|
||||
|
||||
//! Handle to a CORDIC object
|
||||
//!
|
||||
typedef CORDIC_F64 *CORDIC_F64_Handle;
|
||||
|
||||
//*****************************************************************************
|
||||
//globals
|
||||
//*****************************************************************************
|
||||
//! \brief CORDIC Arctangent table
|
||||
//!
|
||||
extern const long long CORDIC_F64_atanTable[];
|
||||
|
||||
//! \brief CORDIC Scale Factor
|
||||
//!
|
||||
extern const long long CORDIC_F64_scaleFactor;
|
||||
|
||||
//*****************************************************************************
|
||||
// 'static inline' functions
|
||||
//*****************************************************************************
|
||||
//! \brief Set the x_i pointer of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \param[in] x_i, pointer to x_i
|
||||
//!
|
||||
static inline void CORDIC_F64_setx_i(CORDIC_F64_Handle hc, int64_t *x_i)
|
||||
{
|
||||
hc->x_i = x_i;
|
||||
}
|
||||
|
||||
//! \brief Get the x_i pointer of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \return x_i, pointer to x_i
|
||||
//!
|
||||
static inline int64_t * CORDIC_F64_getx_i(CORDIC_F64_Handle hc)
|
||||
{
|
||||
return(hc->x_i);
|
||||
}
|
||||
|
||||
//! \brief Set the y_i pointer of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \param[in] y_i, pointer to y_i
|
||||
//!
|
||||
static inline void CORDIC_F64_sety_i(CORDIC_F64_Handle hc, int64_t *y_i)
|
||||
{
|
||||
hc->y_i = y_i;
|
||||
}
|
||||
|
||||
//! \brief Get the y_i pointer of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \return y_i, pointer to y_i
|
||||
//!
|
||||
static inline int64_t * CORDIC_F64_gety_i(CORDIC_F64_Handle hc)
|
||||
{
|
||||
return(hc->y_i);
|
||||
}
|
||||
|
||||
//! \brief Set the z_i pointer of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \param[in] z_i, pointer to z_i
|
||||
//!
|
||||
static inline void CORDIC_F64_setz_i(CORDIC_F64_Handle hc, int64_t *z_i)
|
||||
{
|
||||
hc->z_i = z_i;
|
||||
}
|
||||
|
||||
//! \brief Get the z_i pointer of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \return z_i, pointer to z_i
|
||||
//!
|
||||
static inline int64_t * CORDIC_F64_getz_i(CORDIC_F64_Handle hc)
|
||||
{
|
||||
return(hc->z_i);
|
||||
}
|
||||
|
||||
//! \brief Set the N parameter of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \param[in] N, number of CORDIC iterations
|
||||
//!
|
||||
static inline void CORDIC_F64_setN(CORDIC_F64_Handle hc, const uint16_t N)
|
||||
{
|
||||
hc->N = N;
|
||||
}
|
||||
|
||||
//! \brief Get the N parameter of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \return N, value
|
||||
//!
|
||||
static inline uint16_t CORDIC_F64_getN(CORDIC_F64_Handle hc)
|
||||
{
|
||||
return(hc->N);
|
||||
}
|
||||
|
||||
//! \brief Set the atanTable pointer parameter of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \param[in] p_at, pointer to the arctangent CORDIC table
|
||||
//!
|
||||
static inline void CORDIC_F64_setAtanTblPtr(CORDIC_F64_Handle hc,
|
||||
const int64_t *p_at)
|
||||
{
|
||||
hc->atanTable = p_at;
|
||||
}
|
||||
|
||||
//! \brief Get the address of the atanTable pointer parameter of the
|
||||
//! CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \return p_at, address of the arctangent CORDIC table
|
||||
//!
|
||||
static inline const int64_t * CORDIC_F64_getAtanTblPtr(CORDIC_F64_Handle hc)
|
||||
{
|
||||
return(hc->atanTable);
|
||||
}
|
||||
|
||||
//! \brief Set the runKernel function pointer parameter of the CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \param[in] pfn, pointer to the kernel function
|
||||
//!
|
||||
static inline void CORDIC_F64_setRunKernelPtr(CORDIC_F64_Handle hc,
|
||||
const v_pfn_v pfn)
|
||||
{
|
||||
hc->runKernel = pfn;
|
||||
}
|
||||
|
||||
//! \brief Get the address of the runKernel function parameter of the
|
||||
//! CORDIC object
|
||||
//! \param[in] hc , handle to the CORDIC object
|
||||
//! \return pfn, pointer to the kernel function
|
||||
//!
|
||||
static inline v_pfn_v CORDIC_F64_getRunKernelPtr(CORDIC_F64_Handle hc)
|
||||
{
|
||||
return(hc->runKernel);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// the function prototypes
|
||||
//*****************************************************************************
|
||||
//! \brief CORDIC Rotation Mode
|
||||
//! \param[in] hC , handle to the CORDIC object
|
||||
//! \return none
|
||||
//!
|
||||
//! \note TODO
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> TODO <td> TODO
|
||||
//! </table>
|
||||
//
|
||||
extern void CORDIC_F64_rotationKernel(CORDIC_F64_Handle hC);
|
||||
|
||||
//! \brief CORDIC Sine
|
||||
//! \param[in] hC , handle to the CORDIC object
|
||||
//! \param[in] theta, argument angle in radians [-2pi, 2pi]
|
||||
//! \return Sine of the angle
|
||||
//!
|
||||
//! This function sets the object's x_i to a predetermined scale factor,
|
||||
//! y_i to 0 and z_i to IQ61(theta) before calling the rotation kernel
|
||||
//!
|
||||
//! \note
|
||||
//! -# The object kernel pointer must be set to the rotation kernel prior to
|
||||
//! calling this function
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> TODO <td> TODO
|
||||
//! </table>
|
||||
//
|
||||
extern float64u_t CORDIC_F64_sin(CORDIC_F64_Handle hC, float64u_t theta);
|
||||
|
||||
//! \brief CORDIC Cosine
|
||||
//! \param[in] hC , handle to the CORDIC object
|
||||
//! \param[in] theta, argument angle in radians [-2pi, 2pi]
|
||||
//! \return Cosine of the angle
|
||||
//!
|
||||
//! This function sets the object's x_i to a predetermined scale factor,
|
||||
//! y_i to 0 and z_i to IQ61(theta) before calling the rotation kernel
|
||||
//!
|
||||
//! \note
|
||||
//! -# The object kernel pointer must be set to the rotation kernel prior to
|
||||
//! calling this function
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> TODO <td> TODO
|
||||
//! </table>
|
||||
//
|
||||
extern float64u_t CORDIC_F64_cos(CORDIC_F64_Handle hC, float64u_t theta);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // extern "C"
|
||||
//@} // ingroup
|
||||
|
||||
#endif // end of _CORDIC_H_ definition
|
||||
|
||||
// End of File
|
||||
@@ -0,0 +1,665 @@
|
||||
#ifndef _FID_H_
|
||||
#define _FID_H_
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file fid.h
|
||||
//!
|
||||
//! \brief Fast Integer Division
|
||||
//! \author Vishal Coelho
|
||||
//! \date Dec 25, 2015
|
||||
//
|
||||
//#############################################################################
|
||||
//!
|
||||
//! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
//! All rights reserved not granted herein.
|
||||
//! Limited License.
|
||||
//!
|
||||
//! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
//! non-exclusive license under copyrights and patents it now or hereafter
|
||||
//! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
//! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
//! foregoing patent license, such license is granted solely to the extent that
|
||||
//! any such patent is necessary to Utilize the software alone. The patent
|
||||
//! license shall not apply to any combinations which include this software,
|
||||
//! other than combinations with devices manufactured by or for TI
|
||||
//! ("TI Devices").
|
||||
//! No hardware patent is licensed hereunder.
|
||||
//!
|
||||
//! Redistributions must preserve existing copyright notices and reproduce this
|
||||
//! license (including the above copyright notice and the disclaimer and
|
||||
//! (if applicable) source code license limitations below) in the documentation
|
||||
//! and/or other materials provided with the distribution.
|
||||
//!
|
||||
//! Redistribution and use in binary form, without modification, are permitted
|
||||
//! provided that the following conditions are met:
|
||||
//!
|
||||
//! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
//! permitted with respect to any software provided in binary form.
|
||||
//! * Any redistribution and use are licensed by TI for use only
|
||||
//! with TI Devices.
|
||||
//! * Nothing shall obligate TI to provide you with source code for the
|
||||
//! software licensed and provided to you in object code.
|
||||
//!
|
||||
//! If software source code is provided to you, modification and redistribution
|
||||
//! of the source code are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * any redistribution and use of the source code, including any resulting
|
||||
//! derivative works, are licensed by TI for use only with TI Devices.
|
||||
//! * any redistribution and use of any object code compiled from the source
|
||||
//! code and any resulting derivative works, are licensed by TI for use
|
||||
//! only with TI Devices.
|
||||
//!
|
||||
//! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
//! suppliers may be used to endorse or promote products derived from this
|
||||
//! software without specific prior written permission.
|
||||
//#############################################################################
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// the includes
|
||||
//*****************************************************************************
|
||||
#include <stdint.h>
|
||||
|
||||
//!
|
||||
//! \defgroup FID_F64 Fast Integer Division Definitions and Types
|
||||
//!
|
||||
//! \ingroup FID_F64
|
||||
//@{
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//defines
|
||||
//*****************************************************************************
|
||||
#define SIGNED_DIV_TRUNCATED (1)
|
||||
#define SIGNED_DIV_MODULO (0)
|
||||
#define SIGNED_DIV_EUCLIDEAN (0)
|
||||
|
||||
#if SIGNED_DIV_TRUNCATED == 1
|
||||
#define FID_i32byi32 FID_i32byi32_t
|
||||
#define FID_i64byi32 FID_i64byi32_t
|
||||
#define FID_i64byi64 FID_i64byi64_t
|
||||
#define FID_i16byi16 FID_i16byi16_t
|
||||
#define FID_i32byi16 FID_i32byi16_t
|
||||
#elif SIGNED_DIV_MODULO == 1
|
||||
#define FID_i32byi32 FID_i32byi32_m
|
||||
#define FID_i64byi32 FID_i64byi32_m
|
||||
#define FID_i64byi64 FID_i64byi64_m
|
||||
#define FID_i16byi16 FID_i16byi16_m
|
||||
#define FID_i32byi16 FID_i32byi16_m
|
||||
#elif SIGNED_DIV_EUCLIDEAN == 1
|
||||
#define FID_i32byi32 FID_i32byi32_e
|
||||
#define FID_i64byi32 FID_i64byi32_e
|
||||
#define FID_i64byi64 FID_i64byi64_e
|
||||
#define FID_i16byi16 FID_i16byi16_e
|
||||
#define FID_i32byi16 FID_i32byi16_e
|
||||
#else
|
||||
#error "Pick one of the signed division methods: truncated, modulo or \
|
||||
euclidean or use a specific signed operation"
|
||||
#endif //SIGNED_DIV_TRUNCATED
|
||||
//*****************************************************************************
|
||||
// typedefs
|
||||
//*****************************************************************************
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//globals
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
// the function prototypes
|
||||
//*****************************************************************************
|
||||
//! \brief Division: ui32/ui32
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 23 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_ui32byui32(uint32_t *p_num_rem, uint32_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i32/i32 (Truncated)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = trunc(\frac{dividend}{divisor}) \f]
|
||||
//! \f[ R = dividend - divisor \times trunc(\frac{dividend}{divisor}) \f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 24 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i32byi32_t(int32_t *p_num_rem, int32_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i32/i32 (Modulo or Floored)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = {\lfloor}\frac{dividend}{divisor}{\rfloor} \f]
|
||||
//! \f[ R = dividend - divisor \times {\lfloor}\frac{dividend}{divisor}{\rfloor} \f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 24 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i32byi32_m(int32_t *p_num_rem, int32_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i32/i32 (Euclidean)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = sgn(n){\lfloor}\frac{dividend}{|divisor|}{\rfloor} \f]
|
||||
//! \f[ R = dividend-|divisor|{\times}{\lfloor}\frac{dividend}{|divisor|}{\rfloor}\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 24 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i32byi32_e(int32_t *p_num_rem, int32_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i32/ui32 (Truncated)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = trunc(\frac{dividend}{divisor}) \f]
|
||||
//! \f[ R = dividend - divisor \times trunc(\frac{dividend}{divisor}) \f]
|
||||
//!
|
||||
//! \note
|
||||
//! -# please note that the divisor is unsigned, so you can
|
||||
//! use the full 32-bit unsigned range for the denominator. When
|
||||
//! calling the function be sure to cast the pointer to this
|
||||
//! unsigned denominator as a signed pointer (int32_t *)
|
||||
//! -# For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 24 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i32byui32(int32_t *p_num_rem, int32_t *p_den_quo);
|
||||
|
||||
//! \brief Division: ui64/ui32
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//! \return none
|
||||
//!
|
||||
//! \note
|
||||
//! -# Since the memory location that holds the divisor must also hold the
|
||||
//! quotient it must be 64-bits wide. The same is true of the memory location
|
||||
//! that holds the 64-bit dividend and subsequently the 32-bit remainder
|
||||
//! -# For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 35 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_ui64byui32(uint64_t *p_num_rem, uint64_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i64/i32 (Truncated)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = trunc(\frac{dividend}{divisor}) \f]
|
||||
//! \f[ R = dividend - divisor \times trunc(\frac{dividend}{divisor})\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 36 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i64byi32_t(int64_t *p_num_rem, int64_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i64/i32 (Modulo or Floored)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = {\lfloor}\frac{dividend}{divisor}{\rfloor} \f]
|
||||
//! \f[ R = dividend - divisor \times {\lfloor}\frac{dividend}{divisor}{\rfloor}\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 36 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i64byi32_m(int64_t *p_num_rem, int64_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i64/i32 (Euclidean)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = sgn(n){\lfloor}\frac{dividend}{|divisor|}{\rfloor} \f]
|
||||
//! \f[ R = dividend-|divisor|{\times}{\lfloor}\frac{dividend}{|divisor|}{\rfloor} \f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 36 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i64byi32_e(int64_t *p_num_rem, int64_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i64/ui32 (Truncated)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = trunc(\frac{dividend}{divisor}) \f]
|
||||
//! \f[ R = dividend - divisor \times trunc(\frac{dividend}{divisor})\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note
|
||||
//! -# please note that the divisor is unsigned, so you can
|
||||
//! use the full 32-bit unsigned range for the denominator. This
|
||||
//! variable will also hold the 33-bit signed remainder, which must then be
|
||||
//! sign-extended to 64-bits (standard integer size). The divisor (remainder)
|
||||
//! variable needs to be of signed 64-bit integer type.
|
||||
//! -# For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 38 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i64byui32(int64_t *p_num_rem, int64_t *p_den_quo);
|
||||
|
||||
|
||||
//! \brief Division: ui64/ui64
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 51 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_ui64byui64(uint64_t *p_num_rem, uint64_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i64/i64 (Truncated)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = trunc(\frac{dividend}{divisor}) \f]
|
||||
//! \f[ R = dividend - divisor \times trunc(\frac{dividend}{divisor})\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 51 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i64byi64_t(int64_t *p_num_rem, int64_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i64/i64 (Modulo or Floored)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = {\lfloor}\frac{dividend}{divisor}{\rfloor} \f]
|
||||
//! \f[ R = dividend - divisor \times {\lfloor}\frac{dividend}{divisor}{\rfloor}\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 51 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i64byi64_m(int64_t *p_num_rem, int64_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i64/i64 (Euclidean)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = sgn(n){\lfloor}\frac{dividend}{|divisor|}{\rfloor} \f]
|
||||
//! \f[ R = dividend-|divisor|{\times}{\lfloor}\frac{dividend}{|divisor|}{\rfloor}\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 51 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i64byi64_e(int64_t *p_num_rem, int64_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i64/ui64 (Truncated)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = trunc(\frac{dividend}{divisor}) \f]
|
||||
//! \f[ R = dividend - divisor \times trunc(\frac{dividend}{divisor}) \f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 52 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i64byui64(int64_t *p_num_rem, int64_t *p_den_quo);
|
||||
|
||||
//! \brief Division: ui16/ui16
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 24 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_ui16byui16(uint16_t *p_num_rem, uint16_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i16/i16 (Truncated)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = trunc(\frac{dividend}{divisor}) \f]
|
||||
//! \f[ R = dividend - divisor \times trunc(\frac{dividend}{divisor}) \f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 26 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i16byi16_t(int16_t *p_num_rem, int16_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i16/i16 (Modulo or Floored)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = {\lfloor}\frac{dividend}{divisor}{\rfloor} \f]
|
||||
//! \f[ R = dividend - divisor \times {\lfloor}\frac{dividend}{divisor}{\rfloor}\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 26 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i16byi16_m(int16_t *p_num_rem, int16_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i16/i16 (Euclidean)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = sgn(n){\lfloor}\frac{dividend}{|divisor|}{\rfloor} \f]
|
||||
//! \f[ R = dividend-|divisor|{\times}{\lfloor}\frac{dividend}{|divisor|}{\rfloor}\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 26 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i16byi16_e(int16_t *p_num_rem, int16_t *p_den_quo);
|
||||
|
||||
//! \brief Division: ui32/ui16
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note
|
||||
//! -# while the divisor (denominator) is unsigned 16-bits, the quotient
|
||||
//! is larger than 16-bit and occupies the same memory location. Therefore
|
||||
//! the divisor must occupy a 32-bit location
|
||||
//! -# For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 26 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_ui32byui16(uint32_t *p_num_rem, uint32_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i32/i16 (Truncated)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = trunc(\frac{dividend}{divisor}) \f]
|
||||
//! \f[ R = dividend - divisor \times trunc(\frac{dividend}{divisor})\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note
|
||||
//! -# while the divisor (denominator) is signed 16-bits, the quotient
|
||||
//! is larger than 16-bit and occupies the same memory location. Therefore
|
||||
//! the divisor must occupy a 32-bit location
|
||||
//! -# For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 28 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i32byi16_t(int32_t *p_num_rem, int32_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i32/i16 (Modulo or Floored)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = {\lfloor}\frac{dividend}{divisor}{\rfloor} \f]
|
||||
//! \f[ R = dividend - divisor \times {\lfloor}\frac{dividend}{divisor}{\rfloor}\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note
|
||||
//! -# while the divisor (denominator) is signed 16-bits, the quotient
|
||||
//! is larger than 16-bit and occupies the same memory location. Therefore
|
||||
//! the divisor must occupy a 32-bit location
|
||||
//! -# For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 28 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i32byi16_m(int32_t *p_num_rem, int32_t *p_den_quo);
|
||||
|
||||
//! \brief Division: i16/i16 (Euclidean)
|
||||
//! \param[out] p_num_rem, pointer to the dividend and subsequently remainder
|
||||
//! \param[out] p_den_quo, pointer to the divisor and subsequently quotient
|
||||
//!
|
||||
//! \f[ Q = sgn(n){\lfloor}\frac{dividend}{|divisor|}{\rfloor} \f]
|
||||
//! \f[ R = dividend-|divisor|{\times}{\lfloor}\frac{dividend}{|divisor|}{\rfloor}\f]
|
||||
//!
|
||||
//! \return none
|
||||
//!
|
||||
//! \note
|
||||
//! -# while the divisor (denominator) is signed 16-bits, the quotient
|
||||
//! is larger than 16-bit and occupies the same memory location. Therefore
|
||||
//! the divisor must occupy a 32-bit location
|
||||
//! -# For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 28 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
extern void FID_i32byi16_e(int32_t *p_num_rem, int32_t *p_den_quo);
|
||||
|
||||
//! \brief Division: f64/f64
|
||||
//! \param[out] p_num, pointer to the dividend
|
||||
//! \param[out] p_den, pointer to the divisor
|
||||
//! \param[out] p_quo, pointer to the quotient
|
||||
//! \return none
|
||||
//!
|
||||
//! \note For best performance, make the arguments to the function global;
|
||||
//! local variables are pushed on to the stack and will cause pipeline stalls
|
||||
//! when multiple back-to-back stack accesses (read followed by write or
|
||||
//! vice versa) take place in the algorihtm.
|
||||
//!
|
||||
//! <table>
|
||||
//! <caption id="multi_row">Performance Data</caption>
|
||||
//! <tr><th>Cycles <th> Comment
|
||||
//! <tr><td> 36 <td> Cycle count includes the call and return
|
||||
//! </table>
|
||||
//
|
||||
#ifdef __TI_EABI__
|
||||
extern void FID_f64byf64(double *p_num, double *p_den, double *p_quo);
|
||||
#else
|
||||
extern void FID_f64byf64(long double *p_num, long double *p_den,
|
||||
long double *p_quo);
|
||||
#endif //__TI_EABI__
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // extern "C"
|
||||
//@} // ingroup
|
||||
|
||||
#endif // end of _FID_H_ definition
|
||||
|
||||
// End of File
|
||||
Reference in new issue
Block a user