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 <cerrno>
#include <cstdint>
#include <universal/number/fixpnt/core.hpp>
#include <universal/number/fixpnt/math/sqrt.hpp>

Classes

struct  sw::universal::cordic::detail::config< nbits, rbits, guard >
struct  sw::universal::cordic::detail::tan_config< nbits, rbits, guard >
struct  sw::universal::cordic::detail::hyperbolic_config< nbits, rbits, guard >
struct  sw::universal::cordic::detail::linear_config< nbits, rbits, arithmetic, guard >
struct  sw::universal::cordic::detail::generator< fixpnt< nbits, rbits, arithmetic, bt > >
struct  sw::universal::cordic::detail::tables< Work >
struct  sw::universal::cordic::detail::reduction< Red >
struct  sw::universal::cordic::detail::linear_tables< Work >
struct  sw::universal::cordic::detail::hyperbolic_tables< Work >
struct  sw::universal::cordic::detail::ln2_reduction< Red >
struct  sw::universal::cordic::detail::vectored< Vec >
struct  sw::universal::cordic::detail::magnitude< Fixed >
struct  sw::universal::cordic::detail::split< Work >
struct  sw::universal::cordic::detail::ln2_reduced< H >

Namespaces

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

Macros

#define SW_UNIVERSAL_CORDIC_AUTO_GUARD

Enumerations

enum class  sw::universal::cordic::coordinates : int { sw::universal::cordic::hyperbolic = -1 , sw::universal::cordic::linear = 0 , sw::universal::cordic::circular = 1 }

Functions

constexpr unsigned sw::universal::cordic::detail::clog2 (unsigned v) noexcept
constexpr unsigned sw::universal::cordic::detail::hyperbolic_steps (unsigned R) noexcept
template<typename G>
G sw::universal::cordic::detail::atan_inverse (unsigned m)
template<typename G>
G sw::universal::cordic::detail::atan_pow2 (unsigned i)
template<typename G>
G sw::universal::cordic::detail::pi_over_4 ()
template<typename G>
G sw::universal::cordic::detail::atanh_pow2 (unsigned i)
template<typename G>
G sw::universal::cordic::detail::ln2_series ()
template<typename Work>
const tables< Work > & sw::universal::cordic::detail::tables_of ()
template<typename Red>
const reduction< Red > & sw::universal::cordic::detail::reduction_of ()
template<typename Work>
const linear_tables< Work > & sw::universal::cordic::detail::linear_tables_of ()
template<typename Work>
const hyperbolic_tables< Work > & sw::universal::cordic::detail::hyperbolic_tables_of ()
template<typename Red>
const ln2_reduction< Red > & sw::universal::cordic::detail::ln2_reduction_of ()
template<coordinates m, typename Work>
void sw::universal::cordic::detail::step (Work &x, Work &y, Work &z, unsigned i, const Work &alpha, bool up)
template<coordinates m, typename Work, std::size_t N>
void sw::universal::cordic::detail::rotate (Work &x, Work &y, Work &z, unsigned n, const std::array< Work, N > &A)
template<coordinates m, typename Work, std::size_t N>
void sw::universal::cordic::detail::vector (Work &x, Work &y, Work &z, unsigned n, const std::array< Work, N > &A)
template<typename Work>
void sw::universal::cordic::detail::rotate_hyperbolic (Work &x, Work &y, Work &z, unsigned n, const hyperbolic_tables< Work > &T)
template<typename Work>
void sw::universal::cordic::detail::vector_hyperbolic (Work &x, Work &y, Work &z, unsigned n, const hyperbolic_tables< Work > &T)
template<unsigned W, typename bt>
void sw::universal::cordic::detail::round_shift (blockbinary< W, bt, BinaryNumberType::Signed > &raw, unsigned shift)
template<typename Target, bool saturate = (Target::arithmetic == Saturate), unsigned W, typename bt>
Target sw::universal::cordic::detail::fit (const blockbinary< W, bt, BinaryNumberType::Signed > &rawIn, unsigned shift)
template<typename Vec, unsigned IN, typename bt>
vectored< Vec > sw::universal::cordic::detail::vector_raw (const blockbinary< IN, bt, BinaryNumberType::Signed > &rx, const blockbinary< IN, bt, BinaryNumberType::Signed > &ry, unsigned n)
template<typename Fixed>
blockbinary< Fixed::nbits+2u, typename Fixed::BlockType, BinaryNumberType::Signed > sw::universal::cordic::detail::widen (const Fixed &f)
constexpr unsigned sw::universal::cordic::detail::clamp_iterations (unsigned n, unsigned maxN) noexcept
template<unsigned W, typename bt>
unsigned sw::universal::cordic::detail::msb_of (const blockbinary< W, bt, BinaryNumberType::Signed > &a)
template<typename Lin, typename M>
Lin sw::universal::cordic::detail::normalized (const M &a)
template<typename Target, bool saturate = (Target::arithmetic == Saturate), typename Lin>
Target sw::universal::cordic::detail::scaled_fit (Lin v, int E, bool negative)
template<typename Rot, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
void sw::universal::cordic::detail::circular_sincos (const fixpnt< nbits, rbits, arithmetic, bt > &theta, unsigned n, Rot &S, Rot &C)
template<unsigned W, typename bt>
int sw::universal::cordic::detail::clamped_int (blockbinary< W, bt, BinaryNumberType::Signed > v, int limit)
template<typename Cfg, typename H, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
ln2_reduced< H > sw::universal::cordic::detail::reduce_ln2 (const fixpnt< nbits, rbits, arithmetic, bt > &z, bool absolute, int limit)
template<typename H>
H sw::universal::cordic::detail::times_ln2 (int e, unsigned halve=0)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
void sw::universal::cordic::sincos (const fixpnt< nbits, rbits, arithmetic, bt > &theta, fixpnt< nbits, rbits, arithmetic, bt > &s, fixpnt< nbits, rbits, arithmetic, bt > &c, unsigned iterations=detail::config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::sin (const fixpnt< nbits, rbits, arithmetic, bt > &theta, unsigned iterations=detail::config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::cos (const fixpnt< nbits, rbits, arithmetic, bt > &theta, unsigned iterations=detail::config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
void sw::universal::cordic::polar (const fixpnt< nbits, rbits, arithmetic, bt > &x, const fixpnt< nbits, rbits, arithmetic, bt > &y, fixpnt< nbits, rbits, arithmetic, bt > &r, fixpnt< nbits, rbits, arithmetic, bt > &theta, unsigned iterations=detail::config< nbits, rbits, guard >::vecIterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::atan2 (const fixpnt< nbits, rbits, arithmetic, bt > &y, const fixpnt< nbits, rbits, arithmetic, bt > &x, unsigned iterations=detail::config< nbits, rbits, guard >::vecIterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::atan (const fixpnt< nbits, rbits, arithmetic, bt > &x, unsigned iterations=detail::config< nbits, rbits, guard >::vecIterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::hypot (const fixpnt< nbits, rbits, arithmetic, bt > &x, const fixpnt< nbits, rbits, arithmetic, bt > &y, unsigned iterations=detail::config< nbits, rbits, guard >::vecIterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::mul (const fixpnt< nbits, rbits, arithmetic, bt > &x, const fixpnt< nbits, rbits, arithmetic, bt > &z, unsigned iterations=detail::linear_config< nbits, rbits, arithmetic, guard >::mulR)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::div (const fixpnt< nbits, rbits, arithmetic, bt > &y, const fixpnt< nbits, rbits, arithmetic, bt > &x, unsigned iterations=detail::linear_config< nbits, rbits, arithmetic, guard >::divR)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::tan (const fixpnt< nbits, rbits, arithmetic, bt > &theta, unsigned iterations=detail::tan_config< nbits, rbits, guard >::R)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::exp (const fixpnt< nbits, rbits, arithmetic, bt > &z, unsigned iterations=detail::hyperbolic_config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
void sw::universal::cordic::sinhcosh (const fixpnt< nbits, rbits, arithmetic, bt > &z, fixpnt< nbits, rbits, arithmetic, bt > &s, fixpnt< nbits, rbits, arithmetic, bt > &c, unsigned iterations=detail::hyperbolic_config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::sinh (const fixpnt< nbits, rbits, arithmetic, bt > &z, unsigned iterations=detail::hyperbolic_config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::cosh (const fixpnt< nbits, rbits, arithmetic, bt > &z, unsigned iterations=detail::hyperbolic_config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::tanh (const fixpnt< nbits, rbits, arithmetic, bt > &z, unsigned iterations=detail::hyperbolic_config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::atanh (const fixpnt< nbits, rbits, arithmetic, bt > &t, unsigned iterations=detail::hyperbolic_config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::log (const fixpnt< nbits, rbits, arithmetic, bt > &w, unsigned iterations=detail::hyperbolic_config< nbits, rbits, guard >::iterations)
template<unsigned guard = auto_guard, unsigned nbits, unsigned rbits, bool arithmetic, typename bt>
fixpnt< nbits, rbits, arithmetic, bt > sw::universal::cordic::sqrt (const fixpnt< nbits, rbits, arithmetic, bt > &w, unsigned iterations=detail::hyperbolic_config< nbits, rbits, guard >::iterations)

Variables

template<typename Fixed, unsigned guard = auto_guard>
constexpr unsigned sw::universal::cordic::default_iterations = detail::config<Fixed::nbits, Fixed::rbits, guard>::iterations
template<typename Fixed, unsigned guard = auto_guard>
constexpr unsigned sw::universal::cordic::guard_bits = detail::config<Fixed::nbits, Fixed::rbits, guard>::g
template<typename Fixed, unsigned guard = auto_guard>
constexpr unsigned sw::universal::cordic::default_vector_iterations = detail::config<Fixed::nbits, Fixed::rbits, guard>::vecIterations
template<typename Fixed, unsigned guard = auto_guard>
constexpr unsigned sw::universal::cordic::vector_guard_bits = detail::config<Fixed::nbits, Fixed::rbits, guard>::vecG
template<typename Fixed, unsigned guard = auto_guard>
constexpr unsigned sw::universal::cordic::hyperbolic_iterations = detail::hyperbolic_config<Fixed::nbits, Fixed::rbits, guard>::iterations
template<typename Fixed, unsigned guard = auto_guard>
constexpr unsigned sw::universal::cordic::hyperbolic_guard_bits = detail::hyperbolic_config<Fixed::nbits, Fixed::rbits, guard>::g

Macro Definition Documentation

◆ SW_UNIVERSAL_CORDIC_AUTO_GUARD

#define SW_UNIVERSAL_CORDIC_AUTO_GUARD