diff options
-rw-r--r-- | host/include/uhd/rfnoc/noc_block_base.hpp | 92 | ||||
-rw-r--r-- | host/lib/rfnoc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/lib/rfnoc/noc_block_base.cpp | 11 |
3 files changed, 104 insertions, 0 deletions
diff --git a/host/include/uhd/rfnoc/noc_block_base.hpp b/host/include/uhd/rfnoc/noc_block_base.hpp new file mode 100644 index 000000000..034caff9e --- /dev/null +++ b/host/include/uhd/rfnoc/noc_block_base.hpp @@ -0,0 +1,92 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_LIBUHD_NOC_BLOCK_BASE_HPP +#define INCLUDED_LIBUHD_NOC_BLOCK_BASE_HPP + +#include <uhd/config.hpp> +#include <uhd/rfnoc/block_id.hpp> +#include <uhd/rfnoc/node.hpp> + +//! Shorthand for block constructor +#define UHD_RFNOC_BLOCK_CONSTRUCTOR(CLASS_NAME) \ + CLASS_NAME##_impl(make_args_ptr make_args) : noc_block_base(std::move(make_args)) + +namespace uhd { namespace rfnoc { + +/*! + * The primary interface to a NoC block in the FPGA + * + * The block supports three types of data access: + * - Low-level register access + * - High-level property access + * - Action execution + * + * The main difference between this class and its parent is the direct access to + * registers, and the NoC&block IDs. + */ +class UHD_API noc_block_base : public node_t +{ +public: + /*! A shared pointer to allow easy access to this class and for + * automatic memory management. + */ + using sptr = std::shared_ptr<noc_block_base>; + + /*! The NoC ID is the unique identifier of the block type. All blocks of the + * same type have the same NoC ID. + */ + using noc_id_t = uint32_t; + + /************************************************************************** + * node_t API calls + *************************************************************************/ + //! Unique ID for an RFNoC block is its block ID + std::string get_unique_id() const { return get_block_id().to_string(); } + + //! Number of input ports. Note: This gets passed into this block from the + // information stored in the global register space. + size_t get_num_input_ports() const { return _num_input_ports; } + + //! Number of output ports. Note: This gets passed outto this block from the + // information stored in the global register space. + size_t get_num_output_ports() const { return _num_output_ports; } + + /************************************************************************** + * RFNoC-block specific API calls + *************************************************************************/ + /*! Return the NoC ID for this block. + * + * \return noc_id The 32-bit NoC ID of this block + */ + noc_id_t get_noc_id() const { return _noc_id; } + + /*! Returns the unique block ID for this block. + * + * \return block_id The block ID of this block (e.g. "0/FFT#1") + */ + const block_id_t& get_block_id() const { return _block_id; } + +private: + //! This block's Noc-ID + noc_id_t _noc_id; + + //! This block's block-ID + // + // The framework will guarantee that no one else has the same block ID + block_id_t _block_id; + + //! Number of input ports + size_t _num_input_ports; + + //! Number of output ports + size_t _num_output_ports; +}; // class noc_block_base + +}} /* namespace uhd::rfnoc */ + +#endif /* INCLUDED_LIBUHD_NOC_BLOCK_BASE_HPP */ + diff --git a/host/lib/rfnoc/CMakeLists.txt b/host/lib/rfnoc/CMakeLists.txt index dce1f286b..9d691ac5e 100644 --- a/host/lib/rfnoc/CMakeLists.txt +++ b/host/lib/rfnoc/CMakeLists.txt @@ -20,6 +20,7 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/ctrl_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/graph_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/legacy_compat.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/noc_block_base.cpp ${CMAKE_CURRENT_SOURCE_DIR}/node_ctrl_base.cpp ${CMAKE_CURRENT_SOURCE_DIR}/node.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rate_node_ctrl.cpp diff --git a/host/lib/rfnoc/noc_block_base.cpp b/host/lib/rfnoc/noc_block_base.cpp new file mode 100644 index 000000000..3cacc455b --- /dev/null +++ b/host/lib/rfnoc/noc_block_base.cpp @@ -0,0 +1,11 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include <uhd/rfnoc/noc_block_base.hpp> +#include <uhd/exception.hpp> + +using namespace uhd::rfnoc; + |