Loading...
Searching...
No Matches
blockdef.hpp
Go to the documentation of this file.
//
// Copyright 2014-2015 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <uhd/types/device_addr.hpp>
#include <stdint.h>
#include <memory>
#include <set>
#include <vector>
namespace uhd { namespace rfnoc {
class UHD_API blockdef : public std::enable_shared_from_this<blockdef>
{
public:
typedef std::shared_ptr<blockdef> sptr;
//
// This is not the same as a uhd::rfnoc::stream_sig_t. This is used
// to describe which ports are defined in a block definition, and
// to describe what kind of connection is allowed for this port.
//
// All the keys listed in PORT_ARGS will be available in this class.
class port_t : public uhd::dict<std::string, std::string>
{
public:
static const device_addr_t PORT_ARGS;
port_t();
bool is_variable(const std::string& key) const;
bool is_keyword(const std::string& key) const;
// keywords are not resolved.
bool is_valid() const;
std::string to_string() const;
};
typedef std::vector<port_t> ports_t;
class arg_t : public uhd::dict<std::string, std::string>
{
public:
static const device_addr_t ARG_ARGS;
static const std::set<std::string> VALID_TYPES;
arg_t();
bool is_valid() const;
std::string to_string() const;
};
typedef std::vector<arg_t> args_t;
typedef uhd::dict<std::string, size_t> registers_t;
static sptr make_from_noc_id(uint64_t noc_id);
virtual bool is_block() const = 0;
virtual bool is_component() const = 0;
virtual std::string get_key() const = 0;
virtual std::string get_name() const = 0;
virtual uint64_t noc_id() const = 0;
virtual ports_t get_input_ports() = 0;
virtual ports_t get_output_ports() = 0;
virtual std::vector<size_t> get_all_port_numbers() = 0;
//
// \throws uhd::runtime_error if args are invalid.
virtual args_t get_args() = 0;
virtual registers_t get_settings_registers() = 0;
virtual registers_t get_readback_registers() = 0;
};
}} /* namespace uhd::rfnoc */
uhd::device_addr_t
Definition device_addr.hpp:39
uhd::dict
Definition dict.hpp:24
uhd::rfnoc::blockdef::arg_t::is_valid
bool is_valid() const
Basic validity check of this argument definition.
uhd::rfnoc::blockdef::arg_t::arg_t
arg_t()
uhd::rfnoc::blockdef::arg_t::VALID_TYPES
static const std::set< std::string > VALID_TYPES
Definition blockdef.hpp:59
uhd::rfnoc::blockdef::arg_t::ARG_ARGS
static const device_addr_t ARG_ARGS
A list of args an argument can have.
Definition blockdef.hpp:58
uhd::rfnoc::blockdef::arg_t::to_string
std::string to_string() const
Returns a string with the most important keys.
uhd::rfnoc::blockdef::port_t::is_variable
bool is_variable(const std::string &key) const
Checks if the value at key is a variable (e.g. '$fftlen').
uhd::rfnoc::blockdef::port_t::PORT_ARGS
static const device_addr_t PORT_ARGS
A list of args a port can have.
Definition blockdef.hpp:37
uhd::rfnoc::blockdef::port_t::is_keyword
bool is_keyword(const std::string &key) const
Checks if the value at key is a keyword (e.g. 'vlen').
uhd::rfnoc::blockdef::port_t::port_t
port_t()
uhd::rfnoc::blockdef::port_t::is_valid
bool is_valid() const
Basic validity check of this port definition. Variables and.
uhd::rfnoc::blockdef::port_t::to_string
std::string to_string() const
Returns a string with the most important keys.
uhd::rfnoc::blockdef
Definition blockdef.hpp:22
uhd::rfnoc::blockdef::get_key
virtual std::string get_key() const =0
Returns block key (i.e. what is used for the registry).
uhd::rfnoc::blockdef::make_from_noc_id
static sptr make_from_noc_id(uint64_t noc_id)
uhd::rfnoc::blockdef::get_readback_registers
virtual registers_t get_readback_registers()=0
Returns a list of readback (user) registers by name.
uhd::rfnoc::blockdef::noc_id
virtual uint64_t noc_id() const =0
Return the one NoC that is valid for this block.
uhd::rfnoc::blockdef::is_component
virtual bool is_component() const =0
Returns true if this represents a component.
uhd::rfnoc::blockdef::get_input_ports
virtual ports_t get_input_ports()=0
uhd::rfnoc::blockdef::get_output_ports
virtual ports_t get_output_ports()=0
uhd::rfnoc::blockdef::get_all_port_numbers
virtual std::vector< size_t > get_all_port_numbers()=0
Returns the full list of port numbers used.
uhd::rfnoc::blockdef::sptr
std::shared_ptr< blockdef > sptr
Definition blockdef.hpp:24
uhd::rfnoc::blockdef::get_args
virtual args_t get_args()=0
Returns the args for this block. Checks if args are valid.
uhd::rfnoc::blockdef::get_settings_registers
virtual registers_t get_settings_registers()=0
Returns a list of settings registers by name.
uhd::rfnoc::blockdef::args_t
std::vector< arg_t > args_t
Definition blockdef.hpp:68
uhd::rfnoc::blockdef::get_name
virtual std::string get_name() const =0
For blocks, returns the block name. For components, returns it's canonical name.
uhd::rfnoc::blockdef::registers_t
uhd::dict< std::string, size_t > registers_t
Definition blockdef.hpp:70
uhd::rfnoc::blockdef::ports_t
std::vector< port_t > ports_t
Definition blockdef.hpp:51
uhd::rfnoc::blockdef::is_block
virtual bool is_block() const =0
Returns true if this represents a NoC block.
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
device_addr.hpp
uhd::rfnoc
Definition actions.hpp:24
uhd
Definition build_info.hpp:12