diff options
author | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-03-13 10:53:43 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-04-07 14:20:14 -0500 |
commit | 11d70898d15fe9c42e191c166581d83c62354ca1 (patch) | |
tree | ca47e66c07e628e8f8b517a763b190807573853a /host/include | |
parent | 76aaf0f55788a4d2c7adeea65a9205340421ca49 (diff) | |
download | uhd-11d70898d15fe9c42e191c166581d83c62354ca1.tar.gz uhd-11d70898d15fe9c42e191c166581d83c62354ca1.tar.bz2 uhd-11d70898d15fe9c42e191c166581d83c62354ca1.zip |
rfnoc: Add FIR filter RFNoC block controller
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/rfnoc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/defaults.hpp | 7 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/fir_filter_block_control.hpp | 69 |
3 files changed, 74 insertions, 3 deletions
diff --git a/host/include/uhd/rfnoc/CMakeLists.txt b/host/include/uhd/rfnoc/CMakeLists.txt index bb3cc0190..6435ec2a6 100644 --- a/host/include/uhd/rfnoc/CMakeLists.txt +++ b/host/include/uhd/rfnoc/CMakeLists.txt @@ -35,6 +35,7 @@ UHD_INSTALL(FILES duc_block_control.hpp dmafifo_block_control.hpp fft_block_control.hpp + fir_filter_block_control.hpp null_block_control.hpp radio_control.hpp diff --git a/host/include/uhd/rfnoc/defaults.hpp b/host/include/uhd/rfnoc/defaults.hpp index 0b95ddc2e..b786bfdef 100644 --- a/host/include/uhd/rfnoc/defaults.hpp +++ b/host/include/uhd/rfnoc/defaults.hpp @@ -72,9 +72,10 @@ static const device_type_t N320 = 0x1320; static const device_type_t X300 = 0xA300; // block identifiers -static const noc_id_t RADIO_BLOCK = 0x12AD1000; -static const noc_id_t DUC_BLOCK = 0xD0C00000; -static const noc_id_t DDC_BLOCK = 0xDDC00000; +static const noc_id_t RADIO_BLOCK = 0x12AD1000; +static const noc_id_t DUC_BLOCK = 0xD0C00000; +static const noc_id_t DDC_BLOCK = 0xDDC00000; +static const noc_id_t FIR_FILTER_BLOCK = 0xf1120000; }} // namespace uhd::rfnoc diff --git a/host/include/uhd/rfnoc/fir_filter_block_control.hpp b/host/include/uhd/rfnoc/fir_filter_block_control.hpp new file mode 100644 index 000000000..5652f68ee --- /dev/null +++ b/host/include/uhd/rfnoc/fir_filter_block_control.hpp @@ -0,0 +1,69 @@ +// +// Copyright 2020 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_LIBUHD_FIR_FILTER_BLOCK_CONTROL_HPP +#define INCLUDED_LIBUHD_FIR_FILTER_BLOCK_CONTROL_HPP + +#include <uhd/config.hpp> +#include <uhd/rfnoc/noc_block_base.hpp> +#include <uhd/types/ranges.hpp> + +namespace uhd { namespace rfnoc { + +/*! FIR Filter Block Control Class + * + * The FIR Filter Block is a finite impulse response filter block for RFNoC. + * + * The RFNoC FIR block supports one input and output port of sc16 data + * (16-bit fixed-point complex samples) and a configurable (but fixed) + * number of taps. + */ +class UHD_API fir_filter_block_control : public noc_block_base +{ +public: + RFNOC_DECLARE_BLOCK(fir_filter_block_control) + + // Block registers + static const uint32_t REG_FIR_MAX_NUM_COEFFS_ADDR; + static const uint32_t REG_FIR_LOAD_COEFF_ADDR; + static const uint32_t REG_FIR_LOAD_COEFF_LAST_ADDR; + + /*! Get the maximum number of filter coefficients supported by this block + * + * Get the maximum number of filter coefficients supported by this + * block. + * + * \returns The maximum number of filter coefficients supported by this block + */ + virtual size_t get_max_num_coefficients() const = 0; + + /*! Set the filter coefficients + * + * Set the filter coefficients for this FIR block. The number of + * coefficients must be equal to or less than the maximum number of + * coefficients supported by the block. If the vector of coefficients + * passed to this function is smaller than the maximum number of + * coefficients supported by the block, it will automatically be padded + * with zeroes. If the vector of coefficients passed to this function is + * larger than the maximum number of coefficients supported by the block, + * a `uhd::value_error` is thrown. + * + * \param coeffs A vector of integer coefficients for the FIR filter + */ + virtual void set_coefficients(const std::vector<int16_t>& coeffs) = 0; + + /*! Get the filter coefficients + * + * Return a vector with the current filter coefficients. + * + * \returns The vector of current filter coefficients + */ + virtual std::vector<int16_t> get_coefficients() const = 0; +}; + +}} // namespace uhd::rfnoc + +#endif /* INCLUDED_LIBUHD_FIR_FILTER_BLOCK_CONTROL_HPP */ |