aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-11-04 11:55:33 +0100
committerAaron Rossetto <aaron.rossetto@ni.com>2021-11-12 12:11:33 -0800
commit09839fa23229daf00cb9b857806d47d2cac50057 (patch)
tree09068ed6dbda6747b1a1730885746c120c6eb934 /host
parentbccc2b49ab25551c6fc104a0b69f69121b76031d (diff)
downloaduhd-09839fa23229daf00cb9b857806d47d2cac50057.tar.gz
uhd-09839fa23229daf00cb9b857806d47d2cac50057.tar.bz2
uhd-09839fa23229daf00cb9b857806d47d2cac50057.zip
rfnoc: Add CHDR width to make args
This provides every block controller with a copy of its CHDR width. Note: mock blocks always get configured with a 64-bit CHDR width, to retain API compatibility.
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/rfnoc/noc_block_base.hpp4
-rw-r--r--host/include/uhd/rfnoc/noc_block_make_args.hpp6
-rw-r--r--host/lib/rfnoc/mock_block.cpp2
-rw-r--r--host/lib/rfnoc/noc_block_base.cpp1
-rw-r--r--host/lib/rfnoc/rfnoc_graph.cpp1
-rw-r--r--host/tests/rfnoc_propprop_test.cpp2
6 files changed, 15 insertions, 1 deletions
diff --git a/host/include/uhd/rfnoc/noc_block_base.hpp b/host/include/uhd/rfnoc/noc_block_base.hpp
index dbb20b8d2..ab002841c 100644
--- a/host/include/uhd/rfnoc/noc_block_base.hpp
+++ b/host/include/uhd/rfnoc/noc_block_base.hpp
@@ -12,6 +12,7 @@
#include <uhd/rfnoc/defaults.hpp>
#include <uhd/rfnoc/node.hpp>
#include <uhd/rfnoc/register_iface_holder.hpp>
+#include <uhd/rfnoc/rfnoc_types.hpp>
#include <uhd/types/device_addr.hpp>
//! Shorthand for block constructor
@@ -306,6 +307,9 @@ private:
//! The actual MTU value
std::unordered_map<res_source_info, size_t> _mtu;
+ //! CHDR width of this block
+ chdr_w_t _chdr_w;
+
//! Reference to the ctrlport clock_iface object shared with the register_iface
std::shared_ptr<clock_iface> _ctrlport_clock_iface;
diff --git a/host/include/uhd/rfnoc/noc_block_make_args.hpp b/host/include/uhd/rfnoc/noc_block_make_args.hpp
index 9d45c98b0..e2f056849 100644
--- a/host/include/uhd/rfnoc/noc_block_make_args.hpp
+++ b/host/include/uhd/rfnoc/noc_block_make_args.hpp
@@ -9,6 +9,7 @@
#include <uhd/property_tree.hpp>
#include <uhd/rfnoc/noc_block_base.hpp>
#include <uhd/rfnoc/register_iface.hpp>
+#include <uhd/rfnoc/rfnoc_types.hpp>
namespace uhd { namespace rfnoc {
@@ -36,9 +37,12 @@ struct noc_block_base::make_args_t
//! Number of output ports (gets reported from the FPGA)
size_t num_output_ports;
- //! Value of the MTU register
+ //! Value of the MTU register, converted to bytes
size_t mtu;
+ //! CHDR width of this block
+ chdr_w_t chdr_w;
+
//! Register interface to this block's register space
register_iface::sptr reg_iface;
diff --git a/host/lib/rfnoc/mock_block.cpp b/host/lib/rfnoc/mock_block.cpp
index 4332d078e..e867f06b4 100644
--- a/host/lib/rfnoc/mock_block.cpp
+++ b/host/lib/rfnoc/mock_block.cpp
@@ -6,6 +6,7 @@
#include <uhd/property_tree.hpp>
#include <uhd/rfnoc/defaults.hpp>
+#include <uhd/rfnoc/rfnoc_types.hpp>
#include <uhd/rfnoc/mock_block.hpp>
#include <uhd/types/device_addr.hpp>
#include <uhdlib/rfnoc/clock_iface.hpp>
@@ -36,6 +37,7 @@ uhd::rfnoc::mock_block_container uhd::rfnoc::get_mock_block(const noc_id_t noc_i
ret_val.make_args->num_input_ports = num_inputs;
ret_val.make_args->num_output_ports = num_outputs;
ret_val.make_args->mtu = mtu;
+ ret_val.make_args->chdr_w = CHDR_W_64;
ret_val.make_args->reg_iface = ret_val.reg_iface;
ret_val.make_args->tree = ret_val.tree;
ret_val.make_args->args = args;
diff --git a/host/lib/rfnoc/noc_block_base.cpp b/host/lib/rfnoc/noc_block_base.cpp
index dd9ac2455..c2db597cb 100644
--- a/host/lib/rfnoc/noc_block_base.cpp
+++ b/host/lib/rfnoc/noc_block_base.cpp
@@ -23,6 +23,7 @@ noc_block_base::noc_block_base(make_args_ptr make_args)
, _block_id(make_args->block_id)
, _num_input_ports(make_args->num_input_ports)
, _num_output_ports(make_args->num_output_ports)
+ , _chdr_w(make_args->chdr_w)
, _ctrlport_clock_iface(make_args->ctrlport_clk_iface)
, _tb_clock_iface(make_args->tb_clk_iface)
, _mb_controller(std::move(make_args->mb_control))
diff --git a/host/lib/rfnoc/rfnoc_graph.cpp b/host/lib/rfnoc/rfnoc_graph.cpp
index f6b07a36f..35a5cb28c 100644
--- a/host/lib/rfnoc/rfnoc_graph.cpp
+++ b/host/lib/rfnoc/rfnoc_graph.cpp
@@ -718,6 +718,7 @@ private:
make_args_uptr->num_output_ports = block_info.num_outputs;
make_args_uptr->mtu =
(1 << block_info.data_mtu) * chdr_w_to_bits(mb.get_chdr_w()) / 8;
+ make_args_uptr->chdr_w = mb.get_chdr_w();
make_args_uptr->reg_iface = block_reg_iface;
make_args_uptr->tb_clk_iface = tb_clk_iface;
make_args_uptr->ctrlport_clk_iface = ctrlport_clk_iface;
diff --git a/host/tests/rfnoc_propprop_test.cpp b/host/tests/rfnoc_propprop_test.cpp
index bea432fff..1752e4c21 100644
--- a/host/tests/rfnoc_propprop_test.cpp
+++ b/host/tests/rfnoc_propprop_test.cpp
@@ -7,6 +7,7 @@
#include "rfnoc_graph_mock_nodes.hpp"
#include <uhd/rfnoc/mock_block.hpp>
#include <uhd/rfnoc/noc_block_base.hpp>
+#include <uhd/rfnoc/rfnoc_types.hpp>
#include <uhd/utils/log.hpp>
#include <uhdlib/rfnoc/clock_iface.hpp>
#include <uhdlib/rfnoc/graph.hpp>
@@ -258,6 +259,7 @@ BOOST_AUTO_TEST_CASE(test_mtu_forwarding_policy_restrictions)
mbc.make_args->num_input_ports = 2;
mbc.make_args->num_output_ports = 2;
mbc.make_args->mtu = 8000;
+ mbc.make_args->chdr_w = uhd::rfnoc::CHDR_W_64;
mbc.make_args->reg_iface = mbc.reg_iface;
mbc.make_args->tree = mbc.tree;
mbc.make_args->tb_clk_iface =