Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
cordic.hpp File Reference
#include <array>
#include <cmath>
#include <cstdint>
#include <type_traits>
#include <universal/number/dfixpnt/core.hpp>

Classes

struct  sw::universal::cordic::decimal_detail::config< ndigits, radix, guard >
struct  sw::universal::cordic::decimal_detail::bt_of< W, typename >
struct  sw::universal::cordic::decimal_detail::bt_of< W, std::void_t< typename W::BlockType > >
struct  sw::universal::cordic::decimal_detail::decimal_register< N, R >
struct  sw::universal::cordic::decimal_detail::tables< Work >
struct  sw::universal::cordic::decimal_detail::reduction< Red >
struct  sw::universal::cordic::decimal_detail::digits< M >
struct  sw::universal::cordic::decimal_detail::vectored< Vec >

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal
namespace  sw::universal::cordic
namespace  sw::universal::cordic::decimal_detail

Macros

#define SW_UNIVERSAL_CORDIC_AUTO_GUARD

Typedefs

template<unsigned N, unsigned R, typename bt>
using sw::universal::cordic::decimal_detail::datapath = dfixpnt<N, R, DecimalEncoding::BCD, Modulo, bt>
template<typename W>
using sw::universal::cordic::decimal_detail::bt_of_t = typename bt_of<W>::type
template<typename Work>
using sw::universal::cordic::decimal_detail::generator = datapath<Work::radix + 8u + 4u, Work::radix + 8u, bt_of_t<Work>>

Functions

constexpr unsigned sw::universal::cordic::decimal_detail::digits_of (unsigned v) noexcept
template<unsigned N, unsigned R>
decimal_register< N, R > sw::universal::cordic::decimal_detail::shifted_right (const decimal_register< N, R > &v, unsigned j)
template<typename D>
D sw::universal::cordic::decimal_detail::shifted_right (const D &v, unsigned j)
template<typename D>
D sw::universal::cordic::decimal_detail::pow10_negative (unsigned j)
template<typename To, bool saturate, typename From>
To sw::universal::cordic::decimal_detail::round_digits (const From &v, unsigned shift)
template<typename D, typename Src>
D sw::universal::cordic::decimal_detail::placed (const Src &v, unsigned shift)
template<typename G>
G sw::universal::cordic::decimal_detail::atan_inverse (int m)
template<typename G>
G sw::universal::cordic::decimal_detail::atan_pow10 (unsigned j)
template<typename G>
G sw::universal::cordic::decimal_detail::pi_over_4 ()
template<typename G>
G sw::universal::cordic::decimal_detail::inverse_sqrt (const G &P)
template<typename Work>
const tables< Work > & sw::universal::cordic::decimal_detail::tables_of ()
template<typename Red>
const reduction< Red > & sw::universal::cordic::decimal_detail::reduction_of ()
template<typename Work>
void sw::universal::cordic::decimal_detail::step (Work &x, Work &y, Work &z, unsigned j, const Work &alpha, bool up)
constexpr unsigned sw::universal::cordic::decimal_detail::rotations_at (unsigned j) noexcept
template<typename Work>
void sw::universal::cordic::decimal_detail::rotate (Work &x, Work &y, Work &z, unsigned n, const tables< Work > &T)
template<typename Work>
void sw::universal::cordic::decimal_detail::vector (Work &x, Work &y, Work &z, unsigned n, const tables< Work > &T)
constexpr unsigned sw::universal::cordic::decimal_detail::clamp_iterations (unsigned n, unsigned maxN) noexcept
template<unsigned M, typename Fixed>
digits< M > sw::universal::cordic::decimal_detail::magnitude_of (const Fixed &f)
template<typename Vec, unsigned M>
vectored< Vec > sw::universal::cordic::decimal_detail::vector_magnitudes (const digits< M > &ax, const digits< M > &ay, unsigned n)
template<unsigned guard = auto_guard, unsigned ndigits, unsigned radix, DecimalEncoding encoding, bool arithmetic, typename bt>
void sw::universal::cordic::sincos (const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &theta, dfixpnt< ndigits, radix, encoding, arithmetic, bt > &s, dfixpnt< ndigits, radix, encoding, arithmetic, bt > &c, unsigned iterations=decimal_detail::config< ndigits, radix, guard >::rot_iterations)
template<unsigned guard = auto_guard, unsigned ndigits, unsigned radix, DecimalEncoding encoding, bool arithmetic, typename bt>
dfixpnt< ndigits, radix, encoding, arithmetic, bt > sw::universal::cordic::sin (const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &theta, unsigned iterations=decimal_detail::config< ndigits, radix, guard >::rot_iterations)
template<unsigned guard = auto_guard, unsigned ndigits, unsigned radix, DecimalEncoding encoding, bool arithmetic, typename bt>
dfixpnt< ndigits, radix, encoding, arithmetic, bt > sw::universal::cordic::cos (const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &theta, unsigned iterations=decimal_detail::config< ndigits, radix, guard >::rot_iterations)
template<unsigned guard = auto_guard, unsigned ndigits, unsigned radix, DecimalEncoding encoding, bool arithmetic, typename bt>
void sw::universal::cordic::polar (const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &x, const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &y, dfixpnt< ndigits, radix, encoding, arithmetic, bt > &r, dfixpnt< ndigits, radix, encoding, arithmetic, bt > &theta, unsigned iterations=decimal_detail::config< ndigits, radix, guard >::vec_iterations)
template<unsigned guard = auto_guard, unsigned ndigits, unsigned radix, DecimalEncoding encoding, bool arithmetic, typename bt>
dfixpnt< ndigits, radix, encoding, arithmetic, bt > sw::universal::cordic::atan2 (const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &y, const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &x, unsigned iterations=decimal_detail::config< ndigits, radix, guard >::vec_iterations)
template<unsigned guard = auto_guard, unsigned ndigits, unsigned radix, DecimalEncoding encoding, bool arithmetic, typename bt>
dfixpnt< ndigits, radix, encoding, arithmetic, bt > sw::universal::cordic::atan (const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &x, unsigned iterations=decimal_detail::config< ndigits, radix, guard >::vec_iterations)
template<unsigned guard = auto_guard, unsigned ndigits, unsigned radix, DecimalEncoding encoding, bool arithmetic, typename bt>
dfixpnt< ndigits, radix, encoding, arithmetic, bt > sw::universal::cordic::hypot (const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &x, const dfixpnt< ndigits, radix, encoding, arithmetic, bt > &y, unsigned iterations=decimal_detail::config< ndigits, radix, guard >::vec_iterations)

Variables

constexpr unsigned sw::universal::cordic::auto_guard = 0xFFFF'FFFFu
template<typename Fixed, unsigned guard = auto_guard>
constexpr unsigned sw::universal::cordic::decimal_rotation_iterations = decimal_detail::config<Fixed::ndigits, Fixed::radix, guard>::rot_iterations
template<typename Fixed, unsigned guard = auto_guard>
constexpr unsigned sw::universal::cordic::decimal_vectoring_iterations = decimal_detail::config<Fixed::ndigits, Fixed::radix, guard>::vec_iterations
template<typename Fixed, unsigned guard = auto_guard>
constexpr unsigned sw::universal::cordic::decimal_guard_digits = decimal_detail::config<Fixed::ndigits, Fixed::radix, guard>::g

Macro Definition Documentation

◆ SW_UNIVERSAL_CORDIC_AUTO_GUARD

#define SW_UNIVERSAL_CORDIC_AUTO_GUARD