aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r--host/lib/rfnoc/block_ctrl_base.cpp8
-rw-r--r--host/lib/rfnoc/sink_block_ctrl_base.cpp14
-rw-r--r--host/lib/rfnoc/source_block_ctrl_base.cpp10
3 files changed, 27 insertions, 5 deletions
diff --git a/host/lib/rfnoc/block_ctrl_base.cpp b/host/lib/rfnoc/block_ctrl_base.cpp
index ed8068b5b..e70267b96 100644
--- a/host/lib/rfnoc/block_ctrl_base.cpp
+++ b/host/lib/rfnoc/block_ctrl_base.cpp
@@ -94,12 +94,16 @@ block_ctrl_base::block_ctrl_base(const make_args_t& make_args)
// Set source addresses:
sr_write(SR_BLOCK_SID, get_address(ctrl_port), ctrl_port);
// Set sink buffer sizes:
- settingsbus_reg_t reg = SR_READBACK_REG_FIFOSIZE;
- size_t buf_size_bytes = size_t(sr_read64(reg, ctrl_port));
+ settingsbus_reg_t reg_fifo = SR_READBACK_REG_FIFOSIZE;
+ size_t buf_size_bytes = size_t(sr_read64(reg_fifo, ctrl_port));
if (buf_size_bytes > 0)
n_valid_input_buffers++;
_tree->create<size_t>(_root_path / "input_buffer_size" / ctrl_port)
.set(buf_size_bytes);
+ // Set MTU size and convert to bytes:
+ settingsbus_reg_t reg_mtu = SR_READBACK_REG_MTU;
+ size_t mtu = 8 * (1 << size_t(sr_read64(reg_mtu, ctrl_port)));
+ _tree->create<size_t>(_root_path / "mtu" / ctrl_port).set(mtu);
// Set default destination SIDs
// Otherwise, the default is someone else's SID, which we don't want
sr_write(SR_RESP_IN_DST_SID, 0xFFFF, ctrl_port);
diff --git a/host/lib/rfnoc/sink_block_ctrl_base.cpp b/host/lib/rfnoc/sink_block_ctrl_base.cpp
index bb81706f9..f1d65350a 100644
--- a/host/lib/rfnoc/sink_block_ctrl_base.cpp
+++ b/host/lib/rfnoc/sink_block_ctrl_base.cpp
@@ -43,11 +43,19 @@ std::vector<size_t> sink_block_ctrl_base::get_input_ports() const
**********************************************************************/
size_t sink_block_ctrl_base::get_fifo_size(size_t block_port) const
{
- if (_tree->exists(
- _root_path / "input_buffer_size" / str(boost::format("%d") % block_port))) {
+ if (_tree->exists(_root_path / "input_buffer_size" / std::to_string(block_port))) {
return _tree
->access<size_t>(
- _root_path / "input_buffer_size" / str(boost::format("%d") % block_port))
+ _root_path / "input_buffer_size" / std::to_string(block_port))
+ .get();
+ }
+ return 0;
+}
+
+size_t sink_block_ctrl_base::get_mtu(size_t block_port) const
+{
+ if (_tree->exists(_root_path / "mtu" / std::to_string(block_port))) {
+ return _tree->access<size_t>(_root_path / "mtu" / std::to_string(block_port))
.get();
}
return 0;
diff --git a/host/lib/rfnoc/source_block_ctrl_base.cpp b/host/lib/rfnoc/source_block_ctrl_base.cpp
index efdf94e9f..2ddb455a1 100644
--- a/host/lib/rfnoc/source_block_ctrl_base.cpp
+++ b/host/lib/rfnoc/source_block_ctrl_base.cpp
@@ -124,6 +124,16 @@ void source_block_ctrl_base::configure_flow_control_out(const bool enable_fc_out
sr_write(SR_FLOW_CTRL_EN, config, block_port);
}
+size_t source_block_ctrl_base::get_mtu(size_t block_port) const
+{
+ if (_tree->exists(_root_path / "mtu" / std::to_string(block_port))) {
+ return _tree->access<size_t>(_root_path / "mtu" / std::to_string(block_port))
+ .get();
+ }
+ return 0;
+}
+
+
/***********************************************************************
* Hooks
**********************************************************************/