From 01f08d3fa5ae0cd8a2fc3c6e1112117a1f7f9768 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 3 Jun 2019 23:28:19 -0700 Subject: rfnoc: Add check_topology() API to nodes This API lets blocks decide if their current topology is OK for them, and make decisions based on their topology. --- host/lib/rfnoc/node.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'host/lib/rfnoc/node.cpp') diff --git a/host/lib/rfnoc/node.cpp b/host/lib/rfnoc/node.cpp index 33649b23f..7eff22eab 100644 --- a/host/lib/rfnoc/node.cpp +++ b/host/lib/rfnoc/node.cpp @@ -154,6 +154,23 @@ void node_t::post_action( _post_action_cb(edge_info, action); } +bool node_t::check_topology(const std::vector& connected_inputs, + const std::vector& connected_outputs) +{ + for (size_t port : connected_inputs) { + if (port >= get_num_input_ports()) { + return false; + } + } + for (size_t port : connected_outputs) { + if (port >= get_num_output_ports()) { + return false; + } + } + + return true; +} + /*** Private methods *********************************************************/ property_base_t* node_t::_find_property( res_source_info src_info, const std::string& id) const -- cgit v1.2.3