From 2a66eb62d89c5d18c176878ce036f0109706a9e2 Mon Sep 17 00:00:00 2001 From: Lars Amsel Date: Mon, 8 Jul 2019 15:36:52 +0200 Subject: rfnoc: Introduce device-specific blocks - Add device ID constants (e.g., E310 == 0xE310, X300 == 0xA300). These are stored in the device FPGA, and can be used for decisions later - Blocks can be specific to a device. For example, x300_radio_control can only work on an X300 series device. - Because blocks can be device-specific, all radio blocks can now share a common Noc-ID (0x12AD1000). - The registry and factory functions are modified to acommodate for this. - The motherboard access is now also factored into the same registry macro. --- host/lib/rfnoc/registry_factory.cpp | 97 +++++++++++++++---------------------- 1 file changed, 38 insertions(+), 59 deletions(-) (limited to 'host/lib/rfnoc/registry_factory.cpp') diff --git a/host/lib/rfnoc/registry_factory.cpp b/host/lib/rfnoc/registry_factory.cpp index 117b60e96..bf1bc60a5 100644 --- a/host/lib/rfnoc/registry_factory.cpp +++ b/host/lib/rfnoc/registry_factory.cpp @@ -7,8 +7,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -16,6 +18,10 @@ using namespace uhd::rfnoc; +/*! Pair type for device depended block definitions. */ +using block_device_pair_t = std::pair; + + /////////////////////////////////////////////////////////////////////////////// // There are two registries: // - The "direct" registry, which is for blocks that do not have a block @@ -24,8 +30,9 @@ using namespace uhd::rfnoc; // descriptor file // // This is the direct registry: -using block_direct_reg_t = - std::unordered_map; +using block_direct_reg_t = std::unordered_map>; UHD_SINGLETON_FCN(block_direct_reg_t, get_direct_block_registry); // // This is the descriptor registry: @@ -34,96 +41,68 @@ using block_descriptor_reg_t = UHD_SINGLETON_FCN(block_descriptor_reg_t, get_descriptor_block_registry); /////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// These registries are for blocks that have requested motherboard access -using block_direct_mb_access_req_t = std::unordered_set; -UHD_SINGLETON_FCN(block_direct_mb_access_req_t, get_direct_block_mb_access_requested); -// -// This is the descriptor registry: -using block_descriptor_mb_access_req_t = std::unordered_set; -UHD_SINGLETON_FCN( - block_descriptor_mb_access_req_t, get_descriptor_block_mb_access_requested); -/////////////////////////////////////////////////////////////////////////////// - /****************************************************************************** * Registry functions * * Note: Don't use UHD_LOG_*, since all of this can be executed in a static * fashion. *****************************************************************************/ -void registry::register_block_direct(noc_block_base::noc_id_t noc_id, +void registry::register_block_direct(noc_id_t noc_id, + device_type_t device_id, const std::string& block_name, + bool mb_access, const std::string& timebase_clock, const std::string& ctrlport_clock, factory_t factory_fn) { - if (get_direct_block_registry().count(noc_id)) { + block_device_pair_t key{noc_id, device_id}; + if (get_direct_block_registry().count(key)) { std::cerr - << "[REGISTRY] WARNING: Attempting to overwrite previously registered RFNoC " - "block with Noc-ID 0x" - << std::hex << noc_id << std::dec << std::endl; + << "[REGISTRY] WARNING: Attempting to overwrite previously " + "registered RFNoC block with noc_id,device_id: " << std::hex + << "0x" << noc_id << ", 0x" << device_id <