| USRP Hardware Driver and USRP Manual Version: 4.8.0.makepkg-0-g308126a4 UHD and USRP Manual |

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
uhd::rfnoc::noc_block_base Class Reference

`#include <uhd/rfnoc/noc_block_base.hpp>`

Inheritance diagram for uhd::rfnoc::noc_block_base:

## Classes
struct | make_args_t

## Public Types
using | sptr = std::shared_ptr<noc_block_base>
using | make_args_ptr = std::unique_ptr<make_args_t>
| Opaque pointer to the constructor arguments.
Public Types inherited from uhd::rfnoc::node_t
enum class | forwarding_policy_t { ONE_TO_ONE , ONE_TO_FAN , ONE_TO_ALL_IN , ONE_TO_ALL_OUT , ONE_TO_ALL , DROP , USE_MAP }
| Types of property/action forwarding for those not defined by the block itself. More...
using | resolver_fn_t = std::function<void(void)>
using | resolve_callback_t = std::function<void(void)>
using | graph_mutex_callback_t = std::function<std::recursive_mutex&(void)>
using | action_handler_t
using | forwarding_map_t

## Public Member Functions
| ~noc_block_base () override
std::string | get_unique_id () const override
| Unique ID for an RFNoC block is its block ID.
size_t | get_num_input_ports () const override
size_t | get_num_output_ports () const override
noc_id_t | get_noc_id () const
const block_id_t & | get_block_id () const
double | get_tick_rate () const
size_t | get_mtu (const res_source_info &edge)
size_t | get_chdr_hdr_len (const bool account_for_ts=true) const
size_t | get_max_payload_size (const res_source_info &edge, const bool account_for_ts=true)
uhd::device_addr_t | get_block_args () const
uhd::property_tree::sptr & | get_tree () const
| Return a reference to this block's subtree.
uhd::property_tree::sptr & | get_tree ()
| Return a reference to this block's subtree (non-const version)
std::shared_ptr< mb_controller > | get_mb_controller ()
Public Member Functions inherited from uhd::rfnoc::node_t
| node_t ()
virtual | ~node_t ()
std::vector< std::string > | get_property_ids () const
template<typename prop_data_t>
void | set_property (const std::string &id, const prop_data_t &val, const size_t instance=0)
void | set_properties (const uhd::device_addr_t &props, const size_t instance=0)
template<typename prop_data_t>
const prop_data_t & | get_property (const std::string &id, const size_t instance=0)
virtual void | set_command_time (uhd::time_spec_t time, const size_t instance)
virtual uhd::time_spec_t | get_command_time (const size_t instance) const
virtual void | clear_command_time (const size_t instance)
Public Member Functions inherited from uhd::rfnoc::register_iface_holder
| register_iface_holder (register_iface::sptr reg)
virtual | ~register_iface_holder ()=default
register_iface & | regs ()

## Protected Member Functions
| noc_block_base (make_args_ptr make_args)
void | set_num_input_ports (const size_t num_ports)
void | set_num_output_ports (const size_t num_ports)
void | set_tick_rate (const double tick_rate)
void | set_mtu_forwarding_policy (const forwarding_policy_t policy)
void | set_mtu (const res_source_info &edge, const size_t new_mtu)
property_base_t * | get_mtu_prop_ref (const res_source_info &edge)
virtual void | deinit ()
Protected Member Functions inherited from uhd::rfnoc::node_t
void | register_property (property_base_t *prop, resolve_callback_t &&clean_callback=nullptr)
void | add_property_resolver (prop_ptrs_t &&inputs, prop_ptrs_t &&outputs, resolver_fn_t &&resolver_fn)
void | set_prop_forwarding_policy (forwarding_policy_t policy, const std::string &prop_id="")
void | set_prop_forwarding_map (const forwarding_map_t &map)
template<typename prop_data_t>
void | set_property (const std::string &id, const prop_data_t &val, const res_source_info &src_info)
template<typename prop_data_t>
const prop_data_t & | get_property (const std::string &id, const res_source_info &src_info)
void | register_action_handler (const std::string &id, action_handler_t &&handler)
void | set_action_forwarding_policy (forwarding_policy_t policy, const std::string &action_key="")
void | set_action_forwarding_map (const forwarding_map_t &map)
void | post_action (const res_source_info &edge_info, action_info::sptr action)
virtual bool | check_topology (const std::vector< size_t > &connected_inputs, const std::vector< size_t > &connected_outputs)
Protected Member Functions inherited from uhd::rfnoc::register_iface_holder
void | update_reg_iface (register_iface::sptr new_iface=nullptr)

## Friends
class | block_initializer

## Additional Inherited Members
Static Public Attributes inherited from uhd::rfnoc::node_t
static const size_t | ANY_PORT = size_t(~0)
Protected Types inherited from uhd::rfnoc::node_t
using | prop_ptrs_t = std::vector<property_base_t*>
Static Protected Attributes inherited from uhd::rfnoc::node_t
static dirtifier_t | ALWAYS_DIRTY
| A dirtifyer object, useful for properties that always need updating.

## Detailed Description

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.

## Member Typedef Documentation

## ◆ make_args_ptr

using uhd::rfnoc::noc_block_base::make_args_ptr = std::unique_ptr<make_args_t>

Opaque pointer to the constructor arguments.

## ◆ sptr

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

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

## Constructor & Destructor Documentation

## ◆ ~noc_block_base()

uhd::rfnoc::noc_block_base::~noc_block_base | ( |  | ) |
| override

## ◆ noc_block_base()

uhd::rfnoc::noc_block_base::noc_block_base | ( | make_args_ptr | make_args | ) |
| protected

## Member Function Documentation

## ◆ deinit()

virtual void uhd::rfnoc::noc_block_base::deinit | ( |  | ) |
| protected virtual

Safely de-initialize the block

This function is called by the framework when the RFNoC session is about to finish to allow blocks to safely perform actions to shut down a block. For example, if your block is producing samples, like a radio or signal generator, this is a good place to issue a "stop" command.

After this function is called, register access is no more possible. So make sure not to interact with regs() after this was called. Future access to regs() won't throw, but will print error messages and do nothing.

The rationale for having this separate from the destructor is because rfnoc_graph allows exporting references to blocks, and this function ensures that blocks are safely shut down when the rest of the device control goes away.

## ◆ get_block_args()

uhd::device_addr_t uhd::rfnoc::noc_block_base::get_block_args | ( |  | ) | const
| inline

Return the arguments that were passed into this block from the framework

## ◆ get_block_id()

const block_id_t & uhd::rfnoc::noc_block_base::get_block_id | ( |  | ) | const
| inline

Returns the unique block ID for this block.

Returns
  block_id The block ID of this block (e.g. "0/FFT#1")

## ◆ get_chdr_hdr_len()

size_t uhd::rfnoc::noc_block_base::get_chdr_hdr_len | ( | const bool | account_for_ts = true | ) | const

Return the size of a CHDR packet header, in bytes.

This helper function factors in the CHDR width for this block.

Parameters

  account_for_ts | If true (default), the assumption is that we reserve space for a timestamp. It is possible to increase the payload if no timestamp is used (only for 64 bit CHDR widths!), however, this is advanced usage and should only be used in special circumstances, as downstream blocks might not be able to handle such packets.

Returns
  the length of a CHDR header in bytes

## ◆ get_max_payload_size()

size_t uhd::rfnoc::noc_block_base::get_max_payload_size | ( | const res_source_info & | edge,
|  | const bool | account_for_ts = true )

Return the maximum usable payload size on a given edge, in bytes.

This is very similar to get_mtu(), except it also accounts for the header.

Example: Say the MTU on a given edge is 8192 bytes. The CHDR width is 64 bits. If we wanted to add a timestamp, we would thus require 16 bytes for the total header, leaving only 8192-16=8176 bytes for a payload, which is what this function would return. The same MTU, with a CHDR width of 512 bits however, would require leaving 64 bytes for the header (regardless of whether or not a timestamp is included). In that case, this function would return 8192-64=8128 bytes max payload size.

Parameters

  edge | The edge on which the max payload size is queried. edge.type must be INPUT_EDGE or OUTPUT_EDGE! See also get_mtu().
  account_for_ts | If true (default), the assumption is that we reserve space for a timestamp. It is possible to increase the payload if no timestamp is used (only for 64 bit CHDR widths!), however, this is advanced usage and should only be used in special circumstances, as downstream blocks might not be able to handle such packets.

Returns
  the max payload size as determined by the overall graph on this edge, as well as the CHDR width.

Exceptions

  uhd::value_error | if edge is not referring to a valid edge

## ◆ get_mb_controller()

std::shared_ptr< mb_controller > uhd::rfnoc::noc_block_base::get_mb_controller | ( |  | ) |

Get access to the motherboard controller for this block's motherboard

This will return a nullptr if this block doesn't have access to the motherboard. In order to gain access to the motherboard, the block needs to have requested access to the motherboard during the registration procedure. See also registry.hpp.

Even if this block requested access to the motherboard controller, there is no guarantee that UHD will honour that request. It is therefore important to verify that the returned pointer is valid.

## ◆ get_mtu()

size_t uhd::rfnoc::noc_block_base::get_mtu | ( | const res_source_info & | edge | ) |

Return the current MTU on a given edge

Note: The MTU is the maximum size of a CHDR packet, including header. In order to find out the maximum payload size, calling get_max_payload_size() is the recommended alternative.

The MTU is determined by the block itself (i.e., how big of a packet can this block handle on this edge), but also the neighboring block, and possibly the transport medium between the blocks. This value can thus be lower than what the block defines as MTU, but never higher.

Parameters

  edge | The edge on which the MTU is queried. edge.type must be INPUT_EDGE or OUTPUT_EDGE!

Returns
  the MTU as determined by the overall graph on this edge

Exceptions

  uhd::value_error | if edge is not referring to a valid edge

## ◆ get_mtu_prop_ref()

property_base_t * uhd::rfnoc::noc_block_base::get_mtu_prop_ref | ( | const res_source_info & | edge | ) |
| protected

Return a reference to an MTU property

This can be used to make the MTU an input to a property resolver. For example, blocks that have an spp property, such as the radio, can now trigger a property resolver based on the MTU.

The reference is guaranteed to remain valid for the lifetime of this block.

## ◆ get_noc_id()

noc_id_t uhd::rfnoc::noc_block_base::get_noc_id | ( |  | ) | const
| inline

Return the NoC ID for this block.

Returns
  noc_id The 32-bit NoC ID of this block

## ◆ get_num_input_ports()

size_t uhd::rfnoc::noc_block_base::get_num_input_ports | ( |  | ) | const
| inline override virtual

Number of input ports. Note: This gets passed into this block from the information stored in the global register space.

Note: This may be overridden by the block (e.g., the X300 radio may not have all ports available if no TwinRX board is plugged in), but the subclassed version may never report more ports than this.

Implements uhd::rfnoc::node_t.

## ◆ get_num_output_ports()

size_t uhd::rfnoc::noc_block_base::get_num_output_ports | ( |  | ) | const
| inline override virtual

Number of output ports. Note: This gets passed into this block from the information stored in the global register space.

Note: This may be overridden by the block (e.g., the X300 radio may not have all ports available if no TwinRX board is plugged in), but the subclassed version may never report more ports than this.

Implements uhd::rfnoc::node_t.

## ◆ get_tick_rate()

double uhd::rfnoc::noc_block_base::get_tick_rate | ( |  | ) | const

Returns the tick rate of the current time base

Note there is only ever one time base (or tick rate) per block.

## ◆ get_tree() [1/2]

uhd::property_tree::sptr & uhd::rfnoc::noc_block_base::get_tree | ( |  | ) |
| inline

Return a reference to this block's subtree (non-const version)

## ◆ get_tree() [2/2]

uhd::property_tree::sptr & uhd::rfnoc::noc_block_base::get_tree | ( |  | ) | const
| inline

Return a reference to this block's subtree.

## ◆ get_unique_id()

std::string uhd::rfnoc::noc_block_base::get_unique_id | ( |  | ) | const
| inline override virtual

Unique ID for an RFNoC block is its block ID.

Reimplemented from uhd::rfnoc::node_t.

## ◆ set_mtu()

void uhd::rfnoc::noc_block_base::set_mtu | ( | const res_source_info & | edge,
|  | const size_t | new_mtu )
| protected

Update the MTU

This is another data point in the MTU discovery process. This means that the MTU cannot be increased using the method, only decreased.

## ◆ set_mtu_forwarding_policy()

void uhd::rfnoc::noc_block_base::set_mtu_forwarding_policy | ( | const forwarding_policy_t | policy | ) |
| protected

Change the way MTUs are forwarded

The policy will have the following effect:

- DROP: This means that the MTU of one port has no bearing on the MTU of another port. This is usually a valid choice if the FPGA is repacking data, for example, a block could be consuming continous streams of data, and producing small packets of a different type.
- ONE_TO_ONE: This means the MTU is passed through from input to output and vice versa. This is typically a good choice if packets are being passed through without modifying their size. The DDC/DUC blocks will choose this policy, because the want to relay MTU information to the radio.
- ONE_TO_ALL: This means the MTU is being set to the same value on all ports.
- ONE_TO_FAN: This means the MTU is forwarded from any input port to all opposite side ports. This is an appropriate policy for the split-stream block.

The default policy is ONE_TO_ONE.

Note: The MTU forwarding policy can only be set once, and only during construction of a noc_block_base. If an RFNoC block subclassing noc_block_base wants to modify the MTU forwarding policy, it must call this function in its constructor. Once set, however, the MTU forwarding policy cannot be changed. This represents a change in behaviour from UHD 4.0. Violations of this restriction will result in a uhd::runtime_error being thrown.

## ◆ set_num_input_ports()

void uhd::rfnoc::noc_block_base::set_num_input_ports | ( | const size_t | num_ports | ) |
| protected

Update number of input ports.

- The new number of ports may not exceed the old number. This can only be used to 'decrease' the number of ports.
- This is considered an 'advanced' API and should rarely be called by blocks. See also get_num_output_ports().

Exceptions

  uhd::value_error | if `num_ports` is larger than the current number of ports.

## ◆ set_num_output_ports()

void uhd::rfnoc::noc_block_base::set_num_output_ports | ( | const size_t | num_ports | ) |
| protected

Update number of output ports.

- The new number of ports may not exceed the old number. This can only be used to 'decrease' the number of ports.
- This is considered an 'advanced' API and should rarely be called by blocks. An example of where this is useful is the X310 radio block, which has 2 output ports, but only 1 is useful for UBX/SBX/WBX boards (i.e., boards with 1 frontend). In that case, software can make a determination to 'invalidate' one of the ports.

Exceptions

  uhd::value_error | if `num_ports` is larger than the current number of ports.

## ◆ set_tick_rate()

void uhd::rfnoc::noc_block_base::set_tick_rate | ( | const double | tick_rate | ) |
| protected

Update tick rate for this node and all the connected nodes

Careful: Calling this function will trigger a property propagation to any block this block is connected to.

## Friends And Related Symbol Documentation

## ◆ block_initializer

friend class block_initializer
| friend

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

- noc_block_base.hpp