diff options
author | Steven Koo <steven.koo@ni.com> | 2020-09-21 11:32:19 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-09-25 11:21:10 -0500 |
commit | b975885de26143d34d3f1baa7388a5d90449b2db (patch) | |
tree | f55820588667476329da444deabf1190eba2448f | |
parent | 05a6b351d75231337a4bdc783791515676b1c333 (diff) | |
download | uhd-b975885de26143d34d3f1baa7388a5d90449b2db.tar.gz uhd-b975885de26143d34d3f1baa7388a5d90449b2db.tar.bz2 uhd-b975885de26143d34d3f1baa7388a5d90449b2db.zip |
lib: graph_utils: Error on single SEP edge
It could be possible that we only find one SEP connected edge, which
should be invalid.
-rw-r--r-- | host/lib/utils/graph_utils.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/host/lib/utils/graph_utils.cpp b/host/lib/utils/graph_utils.cpp index e92e83da5..f21000ccf 100644 --- a/host/lib/utils/graph_utils.cpp +++ b/host/lib/utils/graph_utils.cpp @@ -129,28 +129,32 @@ void connect_through_blocks(rfnoc_graph::sptr graph, // call connect on the src and dst blocks since calling // connect on SEPs is invalid std::string src_to_sep_id; - size_t src_to_sep_port = 0; + size_t src_to_sep_port = 0; + bool has_src_to_sep_connection = false; std::string sep_to_dst_id; - size_t sep_to_dst_port = 0; - bool has_sep_connection = false; + size_t sep_to_dst_port = 0; + bool has_sep_to_dst_connection = false; for (auto edge : block_chain) { if (uhd::rfnoc::block_id_t(edge.dst_blockid).match(uhd::rfnoc::NODE_ID_SEP)) { - has_sep_connection = true; - src_to_sep_id = edge.src_blockid; - src_to_sep_port = edge.src_port; + has_src_to_sep_connection = true; + src_to_sep_id = edge.src_blockid; + src_to_sep_port = edge.src_port; } else if (uhd::rfnoc::block_id_t(edge.src_blockid) .match(uhd::rfnoc::NODE_ID_SEP)) { - has_sep_connection = true; - sep_to_dst_id = edge.dst_blockid; - sep_to_dst_port = edge.dst_port; + has_sep_to_dst_connection = true; + sep_to_dst_id = edge.dst_blockid; + sep_to_dst_port = edge.dst_port; } else { graph->connect( edge.src_blockid, edge.src_port, edge.dst_blockid, edge.dst_port); } } - if (has_sep_connection) { + if (has_src_to_sep_connection && has_sep_to_dst_connection) { graph->connect(src_to_sep_id, src_to_sep_port, sep_to_dst_id, sep_to_dst_port); + } else if (has_src_to_sep_connection != has_sep_to_dst_connection) { + throw uhd::runtime_error( + "[graph_utils] Incomplete path. Only one SEP edge found."); } } |