diff options
author | Ryan Marlow <ryan.marlow@ettus.com> | 2018-01-26 14:07:50 -0500 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-03-22 17:48:30 -0700 |
commit | d588005fd87dd2594adb29dbbdcf948bbb0ab0c1 (patch) | |
tree | 7307df1b7a62996c68f7d5bca430359218e9e3da /host/lib/rfnoc | |
parent | 93617aa25cc0ec62cbdbf9cdb41ec11fcc29f2b3 (diff) | |
download | uhd-d588005fd87dd2594adb29dbbdcf948bbb0ab0c1.tar.gz uhd-d588005fd87dd2594adb29dbbdcf948bbb0ab0c1.tar.bz2 uhd-d588005fd87dd2594adb29dbbdcf948bbb0ab0c1.zip |
DDC/DUC: switch CORDIC -> DDS for all relevant variable names
- Bump compat number for DDC/DUC to 2.0
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r-- | host/lib/rfnoc/ddc_block_ctrl_impl.cpp | 22 | ||||
-rw-r--r-- | host/lib/rfnoc/duc_block_ctrl_impl.cpp | 16 |
2 files changed, 16 insertions, 22 deletions
diff --git a/host/lib/rfnoc/ddc_block_ctrl_impl.cpp b/host/lib/rfnoc/ddc_block_ctrl_impl.cpp index 2919c163b..9247708ef 100644 --- a/host/lib/rfnoc/ddc_block_ctrl_impl.cpp +++ b/host/lib/rfnoc/ddc_block_ctrl_impl.cpp @@ -197,7 +197,7 @@ public: } private: - static constexpr size_t MAJOR_COMP = 1; + static constexpr size_t MAJOR_COMP = 2; static constexpr size_t MINOR_COMP = 0; static constexpr size_t RB_REG_COMPAT_NUM = 0; static constexpr size_t RB_REG_NUM_HALFBANDS = 1; @@ -207,18 +207,18 @@ private: const size_t _num_halfbands; const size_t _cic_max_decim; - //! Set the CORDIC frequency shift the signal to \p requested_freq + //! Set the DDS frequency shift the signal to \p requested_freq double set_freq(const double requested_freq, const size_t chan) { const double input_rate = get_arg<double>("input_rate"); double actual_freq; int32_t freq_word; get_freq_and_freq_word(requested_freq, input_rate, actual_freq, freq_word); - sr_write("CORDIC_FREQ", uint32_t(freq_word), chan); + sr_write("DDS_FREQ", uint32_t(freq_word), chan); return actual_freq; } - //! Return a range of valid frequencies the CORDIC can tune to + //! Return a range of valid frequencies the DDS can tune to uhd::meta_range_t get_freq_range(void) { const double input_rate = get_arg<double>("input_rate"); @@ -286,19 +286,17 @@ private: // Calculate algorithmic gain of CIC for a given decimation. // For Ettus CIC R=decim, M=1, N=4. Gain = (R * M) ^ N const double rate_pow = std::pow(double(decim & 0xff), 4); - // Calculate compensation gain values for algorithmic gain of CORDIC and CIC taking into account + // Calculate compensation gain values for algorithmic gain of DDS and CIC taking into account // gain compensation blocks already hardcoded in place in DDC (that provide simple 1/2^n gain compensation). - // CORDIC algorithmic gain limits asymptotically around 1.647 after many iterations. - static const double CORDIC_GAIN = 1.648; + static const double DDS_GAIN = 2.0; // // The polar rotation of [I,Q] = [1,1] by Pi/8 also yields max magnitude of SQRT(2) (~1.4142) however - // input to the CORDIC thats outside the unit circle can only be sourced from a saturated RF frontend. + // input to the DDS thats outside the unit circle can only be sourced from a saturated RF frontend. // To provide additional dynamic range head room accordingly using scale factor applied at egress from DDC would // cost us small signal performance, thus we do no provide compensation gain for a saturated front end and allow // the signal to clip in the H/W as needed. If we wished to avoid the signal clipping in these circumstances then adjust code to read: - // _scaling_adjustment = std::pow(2, ceil_log2(rate_pow))/(CORDIC_GAIN*rate_pow*1.415); const double scaling_adjustment = - std::pow(2, uhd::math::ceil_log2(rate_pow))/(CORDIC_GAIN*rate_pow); + std::pow(2, uhd::math::ceil_log2(rate_pow))/(DDS_GAIN*rate_pow); update_scalar(scaling_adjustment, chan); return input_rate/decim_rate; } @@ -312,7 +310,7 @@ private: set_arg<double>("output_rate", desired_output_rate, chan); } - // Calculate compensation gain values for algorithmic gain of CORDIC and CIC taking into account + // Calculate compensation gain values for algorithmic gain of DDS and CIC taking into account // gain compensation blocks already hardcoded in place in DDC (that provide simple 1/2^n gain compensation). // Further more factor in OTW format which adds further gain factor to weight output samples correctly. void update_scalar(const double scalar, const size_t chan) @@ -324,7 +322,7 @@ private: target_scalar / actual_scalar / double(1 << 15) // Rounding error, normalized to 1.0 * get_arg<double>("fullscale"); // Scaling requested by host set_arg<double>("scalar_correction", scalar_correction, chan); - // Write DDC with scaling correction for CIC and CORDIC that maximizes dynamic range in 32/16/12/8bits. + // Write DDC with scaling correction for CIC and DDS that maximizes dynamic range in 32/16/12/8bits. sr_write("SCALE_IQ", actual_scalar, chan); } diff --git a/host/lib/rfnoc/duc_block_ctrl_impl.cpp b/host/lib/rfnoc/duc_block_ctrl_impl.cpp index 68109ec26..7f22ca903 100644 --- a/host/lib/rfnoc/duc_block_ctrl_impl.cpp +++ b/host/lib/rfnoc/duc_block_ctrl_impl.cpp @@ -182,7 +182,7 @@ public: private: - static constexpr size_t MAJOR_COMP = 1; + static constexpr size_t MAJOR_COMP = 2; static constexpr size_t MINOR_COMP = 0; static constexpr size_t RB_REG_COMPAT_NUM = 0; static constexpr size_t RB_REG_NUM_HALFBANDS = 1; @@ -192,19 +192,18 @@ private: const size_t _num_halfbands; const size_t _cic_max_interp; - //! Set the CORDIC frequency shift the signal to \p requested_freq + //! Set the DDS frequency shift the signal to \p requested_freq double set_freq(const double requested_freq, const size_t chan) { const double output_rate = get_arg<double>("output_rate"); double actual_freq; int32_t freq_word; get_freq_and_freq_word(requested_freq, output_rate, actual_freq, freq_word); - // Xilinx CORDIC uses a different format for the phase increment, hence the divide-by-four: - sr_write("CORDIC_FREQ", uint32_t(freq_word/4), chan); + sr_write("DDS_FREQ", uint32_t(freq_word), chan); return actual_freq; } - //! Return a range of valid frequencies the CORDIC can tune to + //! Return a range of valid frequencies the DDS can tune to uhd::meta_range_t get_freq_range(void) { const double output_rate = get_arg<double>("output_rate"); @@ -263,10 +262,7 @@ private: // For Ettus CIC R=interp, M=1, N=4. Gain = (R * M) ^ (N - 1) const int CIC_N = 4; const double rate_pow = std::pow(double(interp & 0xff), CIC_N - 1); - - // Experimentally determined value to scale the output to [-1, 1] - // This must also encompass the CORDIC gain - static const double CONSTANT_GAIN = 1.1644; + const double CONSTANT_GAIN = 1.0; const double scaling_adjustment = std::pow(2, uhd::math::ceil_log2(rate_pow))/(CONSTANT_GAIN*rate_pow); @@ -283,7 +279,7 @@ private: set_arg<double>("input_rate", desired_input_rate, chan); } - // Calculate compensation gain values for algorithmic gain of CORDIC and CIC taking into account + // Calculate compensation gain values for algorithmic gain of DDS and CIC taking into account // gain compensation blocks already hardcoded in place in DUC (that provide simple 1/2^n gain compensation). // Further more factor in OTW format which adds further gain factor to weight output samples correctly. void update_scalar(const double scalar, const size_t chan) |