diff options
author | Jonathon Pendlum <jonathon.pendlum@ettus.com> | 2022-02-11 00:53:06 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-03-02 14:52:46 -0600 |
commit | 60ca903776c5e6c676a52551f45a8a09d2dfe374 (patch) | |
tree | 5fc02ef4a003f77c7ec6bbc5f17c67463cd96819 | |
parent | a630a36bb935dd66cb95a38c63df76a4477c4688 (diff) | |
download | uhd-60ca903776c5e6c676a52551f45a8a09d2dfe374.tar.gz uhd-60ca903776c5e6c676a52551f45a8a09d2dfe374.tar.bz2 uhd-60ca903776c5e6c676a52551f45a8a09d2dfe374.zip |
rfnoc: window: Set window size register after loading coefficients
-rw-r--r-- | host/lib/rfnoc/window_block_control.cpp | 4 | ||||
-rw-r--r-- | host/tests/rfnoc_block_tests/window_block_test.cpp | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/host/lib/rfnoc/window_block_control.cpp b/host/lib/rfnoc/window_block_control.cpp index 9acb963d0..ad6eb466c 100644 --- a/host/lib/rfnoc/window_block_control.cpp +++ b/host/lib/rfnoc/window_block_control.cpp @@ -118,6 +118,10 @@ private: _window_reg_iface.poke32(REG_WINDOW_LOAD_COEFF_LAST_OFFSET, static_cast<uint32_t>(_coeffs.at(chan).at(num_coeffs - 1)), chan); + // Set window size + _window_reg_iface.poke32(REG_WINDOW_LEN_OFFSET, + static_cast<uint32_t>(num_coeffs), + chan); } //! Maximum length of window diff --git a/host/tests/rfnoc_block_tests/window_block_test.cpp b/host/tests/rfnoc_block_tests/window_block_test.cpp index 26978464b..e45c00cbb 100644 --- a/host/tests/rfnoc_block_tests/window_block_test.cpp +++ b/host/tests/rfnoc_block_tests/window_block_test.cpp @@ -35,6 +35,7 @@ class window_mock_reg_iface_t : public mock_reg_iface_t public: window_mock_reg_iface_t(size_t num_chans, std::vector<size_t> max_num_coeffs) : last_coeff_write_pos(num_chans, 0) + , num_coeffs(num_chans) , coeffs(num_chans) , _num_chans(num_chans) , _max_num_coeffs(max_num_coeffs) @@ -58,6 +59,8 @@ public: } else if (offset == window_block_control::REG_WINDOW_LOAD_COEFF_LAST_OFFSET) { last_coeff_write_pos[chan] = coeffs.at(chan).size(); coeffs.at(chan).push_back(uhd::narrow_cast<int16_t>(data)); + } else if (offset == window_block_control::REG_WINDOW_LEN_OFFSET) { + num_coeffs[chan] = uhd::narrow_cast<int16_t>(data); } else { throw uhd::assertion_error("Invalid write to out of bounds offset"); } @@ -87,6 +90,7 @@ public: } std::vector<size_t> last_coeff_write_pos; + std::vector<size_t> num_coeffs; std::vector<std::vector<int16_t>> coeffs; private: @@ -179,6 +183,9 @@ BOOST_FIXTURE_TEST_CASE(window_test_set_get_coefficients, window_block_fixture) // Check that all coefficients were written BOOST_CHECK_EQUAL(reg_iface->coeffs.at(chan).size(), num_coeffs_chan); + // Check correct window length was written + BOOST_CHECK_EQUAL(reg_iface->num_coeffs.at(chan), num_coeffs_chan); + // Check correctness of coefficients for (size_t i = 0; i < coeffs.size(); i++) { BOOST_CHECK_EQUAL(reg_iface->coeffs.at(chan).at(i), chan); |