aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorAaron Rossetto <aaron.rossetto@ni.com>2020-05-08 08:59:54 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-06-29 13:41:15 -0500
commit619f9d637224627d5359e7d63e88a70660164a86 (patch)
treef62b37bd1ec471dced82113a2937dde7d19b5c54 /host/include
parent38caced6946243f0390c541df54160c45e4959cc (diff)
downloaduhd-619f9d637224627d5359e7d63e88a70660164a86.tar.gz
uhd-619f9d637224627d5359e7d63e88a70660164a86.tar.bz2
uhd-619f9d637224627d5359e7d63e88a70660164a86.zip
rfnoc: Add window RFNoC block controller
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/rfnoc/CMakeLists.txt1
-rw-r--r--host/include/uhd/rfnoc/defaults.hpp1
-rw-r--r--host/include/uhd/rfnoc/window_block_control.hpp74
3 files changed, 76 insertions, 0 deletions
diff --git a/host/include/uhd/rfnoc/CMakeLists.txt b/host/include/uhd/rfnoc/CMakeLists.txt
index 9c389af03..cc91a6125 100644
--- a/host/include/uhd/rfnoc/CMakeLists.txt
+++ b/host/include/uhd/rfnoc/CMakeLists.txt
@@ -42,6 +42,7 @@ UHD_INSTALL(FILES
radio_control.hpp
split_stream_block_control.hpp
vector_iir_block_control.hpp
+ window_block_control.hpp
DESTINATION ${INCLUDE_DIR}/uhd/rfnoc
COMPONENT headers
diff --git a/host/include/uhd/rfnoc/defaults.hpp b/host/include/uhd/rfnoc/defaults.hpp
index e8f1c11e7..2104e8416 100644
--- a/host/include/uhd/rfnoc/defaults.hpp
+++ b/host/include/uhd/rfnoc/defaults.hpp
@@ -81,5 +81,6 @@ static const noc_id_t FOSPHOR_BLOCK = 0x666F0000;
static const noc_id_t SPLIT_STREAM_BLOCK = 0x57570000;
static const noc_id_t RADIO_BLOCK = 0x12AD1000;
static const noc_id_t VECTOR_IIR_BLOCK = 0x11120000;
+static const noc_id_t WINDOW_BLOCK = 0xD0530000;
}} // namespace uhd::rfnoc
diff --git a/host/include/uhd/rfnoc/window_block_control.hpp b/host/include/uhd/rfnoc/window_block_control.hpp
new file mode 100644
index 000000000..316a1a288
--- /dev/null
+++ b/host/include/uhd/rfnoc/window_block_control.hpp
@@ -0,0 +1,74 @@
+//
+// Copyright 2020 Ettus Research, a National Instruments Brand
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#pragma once
+
+#include <uhd/config.hpp>
+#include <uhd/rfnoc/noc_block_base.hpp>
+#include <uhd/types/ranges.hpp>
+
+namespace uhd { namespace rfnoc {
+
+/*! Window Block Control Class
+ *
+ * The Window Block is a windowing block for RFNoC that is intended to be
+ * used with the FFT block. The block can be configured with coefficients,
+ * by which the samples in each input packet are multiplied before begin
+ * output. The first sample of the first packet is multiplied by the first
+ * first coefficient, the second sample is multiplied by the second
+ * coefficient, and so on.
+ *
+ * The RFNoC window block supports a configurable number of pairs of input
+ * and output ports of sc16 data (16-bit fixed-point complex samples) and
+ * a configurable window length and coefficients for each.
+ */
+class UHD_API window_block_control : public noc_block_base
+{
+public:
+ RFNOC_DECLARE_BLOCK(window_block_control)
+
+ // Block registers
+ static const uint32_t REG_WINDOW_BLOCK_SIZE;
+
+ static const uint32_t REG_WINDOW_LEN_OFFSET;
+ static const uint32_t REG_WINDOW_MAX_LEN_OFFSET;
+ static const uint32_t REG_WINDOW_LOAD_COEFF_OFFSET;
+ static const uint32_t REG_WINDOW_LOAD_COEFF_LAST_OFFSET;
+
+ /*! Get the maximum number of window coefficients supported by this block
+ *
+ * Get the maximum number of window coefficients supported by this
+ * block.
+ *
+ * \param chan The channel to retrieve the maximum number of coefficients from
+ * \returns The maximum number of window coefficients supported by this block
+ */
+ virtual size_t get_max_num_coefficients(const size_t chan) const = 0;
+
+ /*! Set the window coefficients
+ *
+ * Set the window coefficients for a given channel. The number of
+ * coefficients must be equal to or less than the maximum number of
+ * coefficients supported by the given channel of the block.
+ *
+ * \param coeffs A vector of integer coefficients for the window
+ * \param chan The channel to apply the coefficients to
+ */
+ virtual void set_coefficients(
+ const std::vector<int16_t>& coeffs, const size_t chan) = 0;
+
+ /*! Get the window coefficients
+ *
+ * Return a vector with the current window coefficients for a given channel.
+ *
+ * \param chan The channel to retrieve the current window coefficients from
+ * \returns The vector of current window coefficients
+ */
+ virtual std::vector<int16_t> get_coefficients(const size_t chan) const = 0;
+};
+
+}} // namespace uhd::rfnoc
+