diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-12-08 15:00:57 +0100 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-12-09 13:10:00 -0800 |
commit | ece958327caf4db4daee79ac2d3935bae3e1e87c (patch) | |
tree | b2b65752f154dcd1e36735fb619544cf136b511a /host/tests | |
parent | f308a453c4e615143a467869accf550ab36493c7 (diff) | |
download | uhd-ece958327caf4db4daee79ac2d3935bae3e1e87c.tar.gz uhd-ece958327caf4db4daee79ac2d3935bae3e1e87c.tar.bz2 uhd-ece958327caf4db4daee79ac2d3935bae3e1e87c.zip |
tests: Add replay-back-edge test
This tests the following graph: DDC -> Replay -> DDC, where the initial
and final blocks are the same (i.e., a loop). This could be useful for
generating and capturing data with the same replay block while testing
a block.
Note that this test will fail if the edge consistency checks are buggy.
Diffstat (limited to 'host/tests')
-rw-r--r-- | host/tests/rfnoc_block_tests/replay_block_test.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/host/tests/rfnoc_block_tests/replay_block_test.cpp b/host/tests/rfnoc_block_tests/replay_block_test.cpp index db9f8c177..11c621b5a 100644 --- a/host/tests/rfnoc_block_tests/replay_block_test.cpp +++ b/host/tests/rfnoc_block_tests/replay_block_test.cpp @@ -7,6 +7,7 @@ #include "../rfnoc_graph_mock_nodes.hpp" #include <uhd/convert.hpp> #include <uhd/rfnoc/actions.hpp> +#include <uhd/rfnoc/ddc_block_control.hpp> #include <uhd/rfnoc/defaults.hpp> #include <uhd/rfnoc/mock_block.hpp> #include <uhd/rfnoc/replay_block_control.hpp> @@ -759,3 +760,46 @@ BOOST_FIXTURE_TEST_CASE(replay_test_graph, replay_block_fixture) graph.commit(); UHD_LOG_INFO("TEST", "Commit complete."); } + +/* + * This test case ensures that the Replay Block can be added to an RFNoC graph + * in a loop. + */ +BOOST_FIXTURE_TEST_CASE(replay_test_graph_loop, replay_block_fixture) +{ + detail::graph_t graph{}; + detail::graph_t::graph_edge_t edge_port_info; + edge_port_info.src_port = 0; + edge_port_info.dst_port = 0; + edge_port_info.property_propagation_active = false; + edge_port_info.edge = detail::graph_t::graph_edge_t::DYNAMIC; + + // Now create a DDC block + UHD_LOG_DEBUG("TEST", "Making DDC block control...."); + node_accessor_t node_accessor{}; + constexpr uint32_t num_hb = 2; + constexpr uint32_t max_cic = 128; + constexpr size_t num_chans = 1; + constexpr noc_id_t noc_id = DDC_BLOCK; + auto block_container = + get_mock_block(noc_id, num_chans, num_chans, uhd::device_addr_t("")); + auto& ddc_reg_iface = block_container.reg_iface; + ddc_reg_iface->read_memory[ddc_block_control::RB_COMPAT_NUM] = + (ddc_block_control::MAJOR_COMPAT << 16) | ddc_block_control::MINOR_COMPAT; + ddc_reg_iface->read_memory[ddc_block_control::RB_NUM_HB] = num_hb; + ddc_reg_iface->read_memory[ddc_block_control::RB_CIC_MAX_DECIM] = max_cic; + auto test_ddc = block_container.get_block<ddc_block_control>(); + + node_accessor.init_props(test_ddc.get()); + UHD_LOG_DEBUG("TEST", "DDC done."); + + UHD_LOG_INFO("TEST", "Creating graph..."); + graph.connect(test_ddc.get(), test_replay.get(), edge_port_info); + // Graph must be DAG, disable prop prop on back-edge (normally, + // rfnoc_graph::connect() would do this for us if we declare a back-edge + edge_port_info.property_propagation_active = true; + graph.connect(test_replay.get(), test_ddc.get(), edge_port_info); + UHD_LOG_INFO("TEST", "Committing graph..."); + graph.commit(); + UHD_LOG_INFO("TEST", "Commit complete."); +} |