From 2d110b1deda68351fdfbf6a8b7cc0c62897d57bc Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 5 Nov 2019 10:10:33 -0800 Subject: rfnoc_graph: Modify find_blocks() to sort return value With this patch, the elements of of the return value of find_blocks() are sorted lexicographically (specifically, using uhd::rfnoc::block_id_it::operator<()). The underlying block_container class stores the blocks in an unordered set, so the return value for find_blocks() was always sorted randomly. multi_usrp_rfnoc had to sort the return values every time find_blocks() was used to get a useful return value. Because find_blocks() had no contract for the order of returned blocks, this change simply sorts the return value before returning it. multi_usrp_rfnoc is modified to remove all the sorts that are now superfluous. A good way to see the change is to run uhd_usrp_probe, which will now contain content like this: | _____________________________________________________ | / | | RFNoC blocks on this device: | | | | * 0/DDC#0 | | * 0/DDC#1 | | * 0/DUC#0 | | * 0/DUC#1 | | * 0/DmaFIFO#0 | | * 0/Radio#0 | | * 0/Radio#1 Assuming the blocks don't change, the order of this list will always be the same following this patch. Note that the order is unrelated to the order on the control crossbar, which it never was. --- host/lib/rfnoc/block_container.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'host/lib/rfnoc') diff --git a/host/lib/rfnoc/block_container.cpp b/host/lib/rfnoc/block_container.cpp index e7fd396ba..5b68134ab 100644 --- a/host/lib/rfnoc/block_container.cpp +++ b/host/lib/rfnoc/block_container.cpp @@ -48,6 +48,11 @@ std::vector block_container_t::find_blocks( block_ids.push_back(id); } } + std::sort(block_ids.begin(), + block_ids.end(), + [](const uhd::rfnoc::block_id_t& i, const uhd::rfnoc::block_id_t& j) { + return i < j; + }); return block_ids; } -- cgit v1.2.3