Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gr-uhd: is_back_edge argument is ignored when connecting UHD blocks. #7353

Open
pamin98 opened this issue May 18, 2024 · 0 comments
Open

gr-uhd: is_back_edge argument is ignored when connecting UHD blocks. #7353

pamin98 opened this issue May 18, 2024 · 0 comments
Labels

Comments

@pamin98
Copy link

pamin98 commented May 18, 2024

What happened?

According to the UHD documentation, graphs consisting of UHD blocks are allowed to have loops if one of the connections is declared a back edge. However, when creating such a design, a runtime error occurs, regardless of whether the boolean is_back_edge argument is set to True. By inspecting the code, one can find the connect() function implementation in gnuradio/gr-uhd/lib/rfnoc_graph_impl.cc:

    void connect(const std::string& src_block_id, 
                 const size_t src_block_port,
                 const std::string& dst_block_id,
                 const size_t dst_block_port,
                 const bool is_back_edge) override
    {
        d_logger->debug("Connecting {:s}:{:d} -> {:s}:{:d}",
                        src_block_id,
                        src_block_port,
                        dst_block_id,
                        dst_block_port);
        if (_tx_streamers.count(src_block_id)) {
            if (_rx_streamers.count(dst_block_id)) {
                throw std::runtime_error("Cannot connect RFNoC streamers directly!");
            }
            _graph->connect(_tx_streamers.at(src_block_id),
                            src_block_port,
                            block_id_t(dst_block_id),
                            dst_block_port,
                            _get_adapter_id(src_block_id, src_block_port));
            return;
        }
        if (_rx_streamers.count(dst_block_id)) {
            _graph->connect(src_block_id,
                            src_block_port,
                            _rx_streamers.at(dst_block_id),
                            dst_block_port,
                            _get_adapter_id(dst_block_id, dst_block_port));
            return;
        }

        _graph->connect(block_id_t(src_block_id),
                        src_block_port,
                        block_id_t(dst_block_id),
                        dst_block_port);
    } 

To fix the bug, the final call to _graph->connect() should be modified to include the is_back_edge argument, as it is otherwise set by default to False:

_graph->connect(block_id_t(src_block_id),
                            src_block_port,
                            block_id_t(dst_block_id),
                            dst_block_port,
                            is_back_edge);

System Information

OS: Ubuntu
GR Installation Method: Source

GNU Radio Version

4.0-git (dev-4.0)

Specific Version

0.0.0.0

Steps to Reproduce the Problem

Create a simple design containing a loop, using UHD blocks. Generate and run the code.

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants