aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r--host/lib/rfnoc/ddc_block_control.cpp7
-rw-r--r--host/lib/rfnoc/duc_block_control.cpp7
2 files changed, 12 insertions, 2 deletions
diff --git a/host/lib/rfnoc/ddc_block_control.cpp b/host/lib/rfnoc/ddc_block_control.cpp
index df606f11b..12e89961d 100644
--- a/host/lib/rfnoc/ddc_block_control.cpp
+++ b/host/lib/rfnoc/ddc_block_control.cpp
@@ -541,10 +541,15 @@ private:
double _set_freq(
const double requested_freq, const double dds_rate, const size_t chan)
{
+ static int freq_word_width = 24;
double actual_freq;
int32_t freq_word;
std::tie(actual_freq, freq_word) =
- get_freq_and_freq_word(requested_freq, dds_rate);
+ get_freq_and_freq_word(requested_freq, dds_rate, freq_word_width);
+
+ // Only the upper 24 bits of the SR_FREQ_ADDR register are used, so shift the word
+ freq_word <<= (32 - freq_word_width);
+
_ddc_reg_iface.poke32(
SR_FREQ_ADDR, uint32_t(freq_word), chan, get_command_time(chan));
return actual_freq;
diff --git a/host/lib/rfnoc/duc_block_control.cpp b/host/lib/rfnoc/duc_block_control.cpp
index ac9629ec4..487e4b8ff 100644
--- a/host/lib/rfnoc/duc_block_control.cpp
+++ b/host/lib/rfnoc/duc_block_control.cpp
@@ -525,10 +525,15 @@ private:
double _set_freq(
const double requested_freq, const double dds_rate, const size_t chan)
{
+ static int freq_word_width = 24;
double actual_freq;
int32_t freq_word;
std::tie(actual_freq, freq_word) =
- get_freq_and_freq_word(requested_freq, dds_rate);
+ get_freq_and_freq_word(requested_freq, dds_rate, freq_word_width);
+
+ // Only the upper 24 bits of the SR_FREQ_ADDR register are used, so shift the word
+ freq_word <<= (32 - freq_word_width);
+
_duc_reg_iface.poke32(
SR_FREQ_ADDR, uint32_t(freq_word), chan, get_command_time(chan));
return actual_freq;