From 75a090543b8fb8e7c875387eee6d3fe7227e4450 Mon Sep 17 00:00:00 2001 From: Ciro Nishiguchi Date: Thu, 23 May 2019 20:38:07 -0500 Subject: rfnoc: add rx and tx transports, and amend rfnoc_graph transports: Transports build on I/O service and implements flow control and sequence number checking. The rx streamer subclass extends the streamer implementation to connect it to the rfnoc graph. It receives configuration values from property propagation and configures the streamer accordingly. It also implements the issue_stream_cmd rx_streamer API method. Add implementation of rx streamer creation and method to connect it to an rfnoc block. rfnoc_graph: Cache more connection info, clarify contract Summary of changes: - rfnoc_graph stores more information about static connections at the beginning. Some search algorithms are replaced by simpler lookups. - The contract for connect() was clarified. It is required to call connect, even for static connections. --- host/tests/rfnoc_chdr_test.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'host/tests/rfnoc_chdr_test.cpp') diff --git a/host/tests/rfnoc_chdr_test.cpp b/host/tests/rfnoc_chdr_test.cpp index 417ed2f96..1c63d5976 100644 --- a/host/tests/rfnoc_chdr_test.cpp +++ b/host/tests/rfnoc_chdr_test.cpp @@ -222,3 +222,49 @@ BOOST_AUTO_TEST_CASE(chdr_strc_packet_no_swap_64) std::cout << pyld.to_string(); } } + +BOOST_AUTO_TEST_CASE(chdr_generic_packet_calculate_pyld_offset_64) +{ + // Check calculation without timestamp + auto test_pyld_offset = [](chdr_packet::uptr& pkt, + const packet_type_t pkt_type, + const size_t num_mdata) + { + uint64_t buff[MAX_BUF_SIZE_WORDS]; + chdr_header header; + header.set_pkt_type(pkt_type); + header.set_num_mdata(num_mdata); + + pkt->refresh(reinterpret_cast(buff), header, 0); + + const size_t pyld_offset = pkt->calculate_payload_offset( + pkt_type, num_mdata); + + void* pyld_ptr = pkt->get_payload_ptr(); + + const size_t non_pyld_bytes = static_cast( + reinterpret_cast(pyld_ptr) - + reinterpret_cast(buff)); + + BOOST_CHECK(pyld_offset == non_pyld_bytes); + }; + + { + chdr_packet::uptr pkt = chdr64_be_factory.make_generic(); + test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 0); + test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 1); + test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 2); + test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 0); + test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 1); + test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 2); + } + { + chdr_packet::uptr pkt = chdr256_be_factory.make_generic(); + test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 0); + test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 1); + test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 2); + test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 0); + test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 1); + test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 2); + } +} -- cgit v1.2.3