USRP Hardware Driver and USRP Manual  Version: 4.6.0.0
UHD and USRP Manual
uhd::rfnoc::rfnoc_graph Class Referenceabstract

#include <uhd/rfnoc_graph.hpp>

Inheritance diagram for uhd::rfnoc::rfnoc_graph:

Public Types

using sptr = std::shared_ptr< rfnoc_graph >
 

Public Member Functions

virtual ~rfnoc_graph ()
 
virtual std::vector< block_id_tfind_blocks (const std::string &block_id_hint) const =0
 
template<typename T >
std::vector< block_id_tfind_blocks (const std::string &block_id_hint) const
 
virtual bool has_block (const block_id_t &block_id) const =0
 Checks if a specific NoC block exists on the device. More...
 
template<typename T >
bool has_block (const block_id_t &block_id) const
 
virtual noc_block_base::sptr get_block (const block_id_t &block_id) const =0
 Returns a block controller class for an NoC block. More...
 
template<typename T >
std::shared_ptr< T > get_block (const block_id_t &block_id) const
 
virtual bool is_connectable (const block_id_t &src_blk, size_t src_port, const block_id_t &dst_blk, size_t dst_port)=0
 
virtual void connect (const block_id_t &src_blk, size_t src_port, const block_id_t &dst_blk, size_t dst_port, bool is_back_edge=false)=0
 
virtual void connect (uhd::tx_streamer::sptr streamer, size_t strm_port, const block_id_t &dst_blk, size_t dst_port, uhd::transport::adapter_id_t adapter_id=uhd::transport::NULL_ADAPTER_ID)=0
 
virtual void connect (const block_id_t &src_blk, size_t src_port, uhd::rx_streamer::sptr streamer, size_t strm_port, uhd::transport::adapter_id_t adapter_id=uhd::transport::NULL_ADAPTER_ID)=0
 
virtual void disconnect (const block_id_t &src_blk, size_t src_port, const block_id_t &dst_blk, size_t dst_port)=0
 
virtual void disconnect (const std::string &streamer_id)=0
 
virtual void disconnect (const std::string &streamer_id, size_t port)=0
 
virtual std::vector< uhd::transport::adapter_id_tenumerate_adapters_from_src (const block_id_t &src_blk, size_t src_port)=0
 
virtual std::vector< uhd::transport::adapter_id_tenumerate_adapters_to_dst (const block_id_t &dst_blk, size_t dst_port)=0
 
virtual std::vector< graph_edge_tenumerate_static_connections () const =0
 
virtual std::vector< graph_edge_tenumerate_active_connections ()=0
 
virtual void commit ()=0
 
virtual void release ()=0
 
virtual rx_streamer::sptr create_rx_streamer (const size_t num_ports, const stream_args_t &args)=0
 
virtual tx_streamer::sptr create_tx_streamer (const size_t num_ports, const stream_args_t &args)=0
 
virtual size_t get_num_mboards () const =0
 
virtual std::shared_ptr< mb_controllerget_mb_controller (const size_t mb_index=0)=0
 
virtual bool synchronize_devices (const uhd::time_spec_t &time_spec, const bool quiet)=0
 
virtual uhd::property_tree::sptr get_tree (void) const =0
 Return a reference to the property tree. More...
 

Static Public Member Functions

static sptr make (const device_addr_t &dev_addr)
 

Detailed Description

The core class for a UHD session with (an) RFNoC device(s)

This class is a superset of uhd::device. It does not only hold a device session, but also manages the RFNoC blocks on those devices. Only devices compatible with a modern version of RFNoC can be addressed by this class.

Member Typedef Documentation

◆ sptr

using uhd::rfnoc::rfnoc_graph::sptr = std::shared_ptr<rfnoc_graph>

A shared pointer to allow easy access to this class and for automatic memory management.

Constructor & Destructor Documentation

◆ ~rfnoc_graph()

virtual uhd::rfnoc::rfnoc_graph::~rfnoc_graph ( )
inlinevirtual

Member Function Documentation

◆ commit()

virtual void uhd::rfnoc::rfnoc_graph::commit ( )
pure virtual

Commit graph and run initial checks

This method needs to be called when the graph is ready for action. It will run checks on the graph and run a property propagation.

Exceptions
uhd::resolve_errorif the properties fail to resolve.

◆ connect() [1/3]

virtual void uhd::rfnoc::rfnoc_graph::connect ( const block_id_t src_blk,
size_t  src_port,
const block_id_t dst_blk,
size_t  dst_port,
bool  is_back_edge = false 
)
pure virtual

Connect a RFNoC block with block ID src_block to another with block ID dst_block.

Note you need to also call this on statically connected blocks if you desire to use them.

Connections that are made using this API call will be listed when calling enumerate_active_connections().

Parameters
src_blkThe block ID of the source block to connect.
src_portThe port of the source block to connect.
dst_blkThe block ID of the destination block to connect to.
dst_portThe port of the destination block to connect to.
is_back_edgeFlag this edge as a back-edge. See also Back edges.
Exceptions
uhd::routing_errorif the source or destination ports are statically connected to a different block

◆ connect() [2/3]

virtual void uhd::rfnoc::rfnoc_graph::connect ( uhd::tx_streamer::sptr  streamer,
size_t  strm_port,
const block_id_t dst_blk,
size_t  dst_port,
uhd::transport::adapter_id_t  adapter_id = uhd::transport::NULL_ADAPTER_ID 
)
pure virtual

Connect TX streamer to an input of an NoC block

Parameters
streamerThe streamer to connect.
strm_portThe port of the streamer to connect.
dst_blkThe block ID of the destination block to connect to.
dst_portThe port of the destination block to connect to.
adapter_idThe local device ID (transport) to use for this connection.
Exceptions
connect_disallowed_on_dstif the destination port is statically connected to a different block

◆ connect() [3/3]

virtual void uhd::rfnoc::rfnoc_graph::connect ( const block_id_t src_blk,
size_t  src_port,
uhd::rx_streamer::sptr  streamer,
size_t  strm_port,
uhd::transport::adapter_id_t  adapter_id = uhd::transport::NULL_ADAPTER_ID 
)
pure virtual

Connect RX streamer to an output of an NoC block

Parameters
src_blkThe block ID of the source block to connect.
src_portThe port of the source block to connect.
streamerThe streamer to connect.
strm_portThe port of the streamer to connect.
adapter_idThe local device ID (transport) to use for this connection.
Exceptions
connect_disallowed_on_srcif the source port is statically connected to a different block

◆ create_rx_streamer()

virtual rx_streamer::sptr uhd::rfnoc::rfnoc_graph::create_rx_streamer ( const size_t  num_ports,
const stream_args_t args 
)
pure virtual

Create a new receive streamer from the streamer arguments The created streamer is still not connected to anything yet. The graph::connect call has to be made on this streamer to start using it. If a different streamer is already connected to the intended source then that call may fail.

Parameters
num_portsNumber of ports that will be connected to the streamer
argsArguments to aid the construction of the streamer
Returns
a shared pointer to a new streamer

◆ create_tx_streamer()

virtual tx_streamer::sptr uhd::rfnoc::rfnoc_graph::create_tx_streamer ( const size_t  num_ports,
const stream_args_t args 
)
pure virtual

Create a new transmit streamer from the streamer arguments The created streamer is still not connected to anything yet. The graph::connect call has to be made on this streamer to start using it. If a different streamer is already connected to the intended sink then that call may fail.

Parameters
num_portsNumber of ports that will be connected to the streamer
argsArguments to aid the construction of the streamer
Returns
a shared pointer to a new streamer

◆ disconnect() [1/3]

virtual void uhd::rfnoc::rfnoc_graph::disconnect ( const block_id_t src_blk,
size_t  src_port,
const block_id_t dst_blk,
size_t  dst_port 
)
pure virtual

Disconnect a RFNoC block with block ID src_blk from another with block ID dst_blk. This will logically disconnect the blocks, but the physical connection will not be changed until a new connection is made on the source port.

Disconnected edges will no longer be listed in enumerate_active_connections().

Parameters
src_blkThe block ID of the source block to disconnect.
src_portThe port of the source block to disconnect.
dst_blkThe block ID of the destination block to disconnect from.
dst_portThe port of the destination block to disconnect from.

◆ disconnect() [2/3]

virtual void uhd::rfnoc::rfnoc_graph::disconnect ( const std::string &  streamer_id)
pure virtual

Disconnect a streamer with ID streamer_id. This will logically disconnect the streamer, but physical connection will not be changed. For RX streamers, the physical connection will be changed when a new connection is made to the upstream source port(s). For TX streamers, the physical connection will be changed when the TX streamer is destroyed or the port(s) are connected to another block.

Parameters
streamer_idThe ID of the streamer to disconnect.

◆ disconnect() [3/3]

virtual void uhd::rfnoc::rfnoc_graph::disconnect ( const std::string &  streamer_id,
size_t  port 
)
pure virtual

Disconnect port port of a streamer with ID streamer_id. This will logically disconnect the streamer, but physical connection will not be changed. For RX streamers, the physical connection will be changed when a new connection is made to the upstreame source port. For TX streamers, the physical connection will be changed when the TX streamer is destroyed or the port is connected to another block.

Parameters
streamer_idThe ID of the streamer.
portThe port to disconnect.

◆ enumerate_active_connections()

virtual std::vector<graph_edge_t> uhd::rfnoc::rfnoc_graph::enumerate_active_connections ( )
pure virtual

Enumerate all the active connections in the graph

An active connection is a connection which was previously created by calling connect().

Returns
A vector containing all the active edges in the graph.

◆ enumerate_adapters_from_src()

virtual std::vector<uhd::transport::adapter_id_t> uhd::rfnoc::rfnoc_graph::enumerate_adapters_from_src ( const block_id_t src_blk,
size_t  src_port 
)
pure virtual

Enumerate all the possible host transport adapters that can be used to receive from the specified block

If addr and second_addr were specified in device_args, the adapter_id_t associated with addr will come first in the vector, then second_addr.

Parameters
src_blkThe block ID of the source block to connect to.
src_portThe port of the source block to connect to.

◆ enumerate_adapters_to_dst()

virtual std::vector<uhd::transport::adapter_id_t> uhd::rfnoc::rfnoc_graph::enumerate_adapters_to_dst ( const block_id_t dst_blk,
size_t  dst_port 
)
pure virtual

Enumerate all the possible host transport adapters that can be used to send to the specified block

If addr and second_addr were specified in device_args, the adapter_id_t associated with addr will come first in the vector, then second_addr.

Parameters
dst_blkThe block ID of the destination block to connect to.
dst_portThe port of the destination block to connect to.

◆ enumerate_static_connections()

virtual std::vector<graph_edge_t> uhd::rfnoc::rfnoc_graph::enumerate_static_connections ( ) const
pure virtual

Enumerate all the possible static connections in the graph

A static connection is a connection that is statically connected in hardware. Note that static connections also need to be declared using connect() if an application wants to use them, or they won't be available for property propagation or any other graph mechanism.

Returns
A vector containing all the static edges in the graph.

◆ find_blocks() [1/2]

virtual std::vector<block_id_t> uhd::rfnoc::rfnoc_graph::find_blocks ( const std::string &  block_id_hint) const
pure virtual

Returns the block ids of all blocks that match the specified hint

Uses block_id_t::match() internally. If no matching block is found, it returns an empty vector.

The returned vector is sorted lexicographically.

To access specialized block controller classes (i.e. derived from uhd::rfnoc::noc_block_base), use the templated version of this function:

// Assume DEV is an rfnoc_graph::sptr
auto null_blocks = DEV->find_blocks<null_block_control>("NullSrcSink");
if (null_blocks.empty()) { cout << "No null blocks found!" << endl; }
Note
this access is not thread safe if performed during block enumeration
Returns
A sorted list of block IDs that match the hint

◆ find_blocks() [2/2]

template<typename T >
std::vector<block_id_t> uhd::rfnoc::rfnoc_graph::find_blocks ( const std::string &  block_id_hint) const
inline

Type-cast version of find_blocks().

◆ get_block() [1/2]

virtual noc_block_base::sptr uhd::rfnoc::rfnoc_graph::get_block ( const block_id_t block_id) const
pure virtual

Returns a block controller class for an NoC block.

If the given block ID is not valid (i.e. such a block does not exist on this device), it will throw a uhd::lookup_error.

Parameters
block_idCanonical block name (e.g. "0/FFT#1").
Note
this access is not thread safe if peformed during block enumeration

◆ get_block() [2/2]

template<typename T >
std::shared_ptr<T> uhd::rfnoc::rfnoc_graph::get_block ( const block_id_t block_id) const
inline

Same as get_block(), but with a type cast.

If you have a block controller class that is derived from noc_block_base, use this function to access its specific methods. If the given block ID is not valid (i.e. such a block does not exist on this device) or if the type does not match, it will throw a uhd::lookup_error.

// Assume DEV is an rfnoc_graph::sptr
auto block_controller = DEV->get_block<my_noc_block>("0/MyBlock#0");
block_controller->my_own_block_method();
Note
this access is not thread safe if performed during block enumeration

◆ get_mb_controller()

virtual std::shared_ptr<mb_controller> uhd::rfnoc::rfnoc_graph::get_mb_controller ( const size_t  mb_index = 0)
pure virtual

Return a reference to a motherboard controller

See also uhd::rfnoc::mb_controller

Parameters
mb_indexThe index of the motherboard in the graph, 0 if only one device is used.
Returns
a reference to the motherboard controller at index mb_index

◆ get_num_mboards()

virtual size_t uhd::rfnoc::rfnoc_graph::get_num_mboards ( ) const
pure virtual

Return the number of motherboards in this graph

Methods that take a motherboard index (e.g., get_mb_controller()) will error out if an index is passed that is greater or equal to this number of motherboards.

Returns
the number of motherboards in this graph

◆ get_tree()

virtual uhd::property_tree::sptr uhd::rfnoc::rfnoc_graph::get_tree ( void  ) const
pure virtual

Return a reference to the property tree.

◆ has_block() [1/2]

virtual bool uhd::rfnoc::rfnoc_graph::has_block ( const block_id_t block_id) const
pure virtual

Checks if a specific NoC block exists on the device.

Parameters
block_idCanonical block name (e.g. "0/FFT#1").
Returns
true if a block with the specified id exists
Note
this access is not thread safe if performed during block enumeration

◆ has_block() [2/2]

template<typename T >
bool uhd::rfnoc::rfnoc_graph::has_block ( const block_id_t block_id) const
inline

Same as has_block(), but with a type check.

Returns
true if a block of type T with the specified id exists
Note
this access is not thread safe if performed during block enumeration

◆ is_connectable()

virtual bool uhd::rfnoc::rfnoc_graph::is_connectable ( const block_id_t src_blk,
size_t  src_port,
const block_id_t dst_blk,
size_t  dst_port 
)
pure virtual

Verify if two blocks/ports are connectable.

If this call returns true, then connect() can be called with the same arguments. It does not, however, check if the block was already connnected.

Returns
true if the two blocks are connectable

◆ make()

static sptr uhd::rfnoc::rfnoc_graph::make ( const device_addr_t dev_addr)
static

Make a new USRP graph from the specified device address(es).

Parameters
dev_addrthe device address
Returns
A new rfnoc_graph object
Exceptions
uhd::key_errorno device found
uhd::index_errorfewer devices found than expected

◆ release()

virtual void uhd::rfnoc::rfnoc_graph::release ( )
pure virtual

Release graph: Opposite of commit()

Calling this will disable property propagation until commit() has been called an equal number of times.

◆ synchronize_devices()

virtual bool uhd::rfnoc::rfnoc_graph::synchronize_devices ( const uhd::time_spec_t time_spec,
const bool  quiet 
)
pure virtual

Run any routines necessary to synchronize devices

The specific implementation of this call are device-specific. In all cases, it will set the motherboard time to a common value, if devices share a common reference. Depending on the hardware it may run other algorithms to synchronize individual hardware components.

Any application that requires any kind of phase or time alignment (if supported by the hardware) must call this before operation. Note that during the initialization of an rfnoc_graph, this method is always called and thus calling it again from an external application is only necessary when synchronization was previously lost.

Note that because this is a motherboard-level API, individual LOs may still be unsynchronized (i.e., not phase-aligned) after calling this. Typically, to synchronize LOs, it is necessary to tune daughterboard channels to the same frequency by using a timed command. See Synchronizing Channel Phase for more details.

Internally, this calls mb_controller::synchronize() with a full list of motherboard controllers for this rfnoc_graph.

Parameters
time_specThe timestamp to be used to sync the devices. It will be an input to set_time_next_pps() on the motherboard controllers.
quietIf true, there will be no errors or warnings printed if the synchronization happens. synchronize_devices() will always be called during initialization, but preconditions might not yet be met (e.g., the time and reference sources might still be internal), and will fail quietly in that case.
Returns
the success status of this call (true means devices are now synchronized)

The documentation for this class was generated from the following file: