From 11d70898d15fe9c42e191c166581d83c62354ca1 Mon Sep 17 00:00:00 2001 From: Aaron Rossetto Date: Fri, 13 Mar 2020 10:53:43 -0500 Subject: rfnoc: Add FIR filter RFNoC block controller --- host/include/uhd/rfnoc/CMakeLists.txt | 1 + host/include/uhd/rfnoc/defaults.hpp | 7 ++- .../include/uhd/rfnoc/fir_filter_block_control.hpp | 69 ++++++++++++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 host/include/uhd/rfnoc/fir_filter_block_control.hpp (limited to 'host/include') 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 +#include +#include + +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& coeffs) = 0; + + /*! Get the filter coefficients + * + * Return a vector with the current filter coefficients. + * + * \returns The vector of current filter coefficients + */ + virtual std::vector get_coefficients() const = 0; +}; + +}} // namespace uhd::rfnoc + +#endif /* INCLUDED_LIBUHD_FIR_FILTER_BLOCK_CONTROL_HPP */ -- cgit v1.2.3