From 6b3164dd269645cb4163e2856116d28a35402ba6 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 12 Jun 2020 00:05:03 +0200 Subject: [PATCH] refactor IpNode and IpCore class names --- fpga/include/villas/fpga/card.hpp | 10 ++--- fpga/include/villas/fpga/{ip.hpp => core.hpp} | 34 ++++++++--------- fpga/include/villas/fpga/ips/aurora.hpp | 8 ++-- fpga/include/villas/fpga/ips/bram.hpp | 10 ++--- fpga/include/villas/fpga/ips/dma.hpp | 8 ++-- fpga/include/villas/fpga/ips/fifo.hpp | 14 +++---- fpga/include/villas/fpga/ips/gpio.hpp | 8 ++-- fpga/include/villas/fpga/ips/gpu2rtds.hpp | 8 ++-- fpga/include/villas/fpga/ips/hls.hpp | 4 +- fpga/include/villas/fpga/ips/intc.hpp | 8 ++-- fpga/include/villas/fpga/ips/pcie.hpp | 10 ++--- fpga/include/villas/fpga/ips/rtds.hpp | 8 ++-- fpga/include/villas/fpga/ips/rtds2gpu.hpp | 8 ++-- fpga/include/villas/fpga/ips/switch.hpp | 14 +++---- fpga/include/villas/fpga/ips/timer.hpp | 8 ++-- .../villas/fpga/{ip_node.hpp => node.hpp} | 14 +++---- fpga/lib/CMakeLists.txt | 4 +- fpga/lib/card.cpp | 10 ++--- fpga/lib/{ip.cpp => core.cpp} | 38 +++++++++---------- fpga/lib/ips/bram.cpp | 2 +- fpga/lib/ips/dma.cpp | 2 +- fpga/lib/ips/pcie.cpp | 2 +- fpga/lib/ips/switch.cpp | 4 +- fpga/lib/{ip_node.cpp => node.cpp} | 34 ++++++++--------- fpga/src/villas-fpga-pipe.cpp | 2 +- fpga/tests/dma.cpp | 2 +- fpga/tests/fpga.cpp | 2 +- fpga/tests/hls.c | 2 +- fpga/tests/intc.c | 2 +- 29 files changed, 140 insertions(+), 140 deletions(-) rename fpga/include/villas/fpga/{ip.hpp => core.hpp} (91%) rename fpga/include/villas/fpga/{ip_node.hpp => node.hpp} (93%) rename fpga/lib/{ip.cpp => core.cpp} (91%) rename fpga/lib/{ip_node.cpp => node.cpp} (86%) diff --git a/fpga/include/villas/fpga/card.hpp b/fpga/include/villas/fpga/card.hpp index 2b31b3e2e..6c6d454e9 100644 --- a/fpga/include/villas/fpga/card.hpp +++ b/fpga/include/villas/fpga/card.hpp @@ -42,7 +42,7 @@ #include #include -#include +#include #define PCI_FILTER_DEFAULT_FPGA { \ .id = { \ @@ -75,9 +75,9 @@ public: bool reset() { return true; } void dump() { } - ip::IpCore::Ptr lookupIp(const std::string& name) const; - ip::IpCore::Ptr lookupIp(const Vlnv& vlnv) const; - ip::IpCore::Ptr lookupIp(const ip::IpIdentifier& id) const; + ip::Core::Ptr lookupIp(const std::string& name) const; + ip::Core::Ptr lookupIp(const Vlnv& vlnv) const; + ip::Core::Ptr lookupIp(const ip::IpIdentifier& id) const; bool mapMemoryBlock(const MemoryBlock& block); @@ -87,7 +87,7 @@ private: std::set memoryBlocksMapped; public: // TODO: make this private - ip::IpCore::List ips; ///< IPs located on this FPGA card + ip::Core::List ips; ///< IPs located on this FPGA card bool do_reset; /**< Reset VILLASfpga during startup? */ int affinity; /**< Affinity for MSI interrupts */ diff --git a/fpga/include/villas/fpga/ip.hpp b/fpga/include/villas/fpga/core.hpp similarity index 91% rename from fpga/include/villas/fpga/ip.hpp rename to fpga/include/villas/fpga/core.hpp index 3d676d4c9..716deb334 100644 --- a/fpga/include/villas/fpga/ip.hpp +++ b/fpga/include/villas/fpga/core.hpp @@ -51,8 +51,8 @@ class PCIeCard; namespace ip { // forward declarations -class IpCore; -class IpCoreFactory; +class Core; +class CoreFactory; class InterruptController; @@ -98,15 +98,15 @@ private: }; -class IpCore { - friend IpCoreFactory; +class Core { + friend CoreFactory; public: - IpCore() : card(nullptr) {} - virtual ~IpCore() = default; + Core() : card(nullptr) {} + virtual ~Core() = default; - using Ptr = std::shared_ptr; - using List = std::list; + using Ptr = std::shared_ptr; + using List = std::list; public: /* Generic management interface for IPs */ @@ -168,15 +168,15 @@ public: { return getInstanceName() != otherName; } bool - operator==(const IpCore& otherIp) const + operator==(const Core& otherIp) const { return this->id == otherIp.id; } bool - operator!=(const IpCore& otherIp) const + operator!=(const Core& otherIp) const { return this->id != otherIp.id; } friend std::ostream& - operator<< (std::ostream& stream, const IpCore& ip) + operator<< (std::ostream& stream, const Core& ip) { return stream << ip.id; } protected: @@ -237,12 +237,12 @@ protected: -class IpCoreFactory : public plugin::Plugin { +class CoreFactory : public plugin::Plugin { public: using plugin::Plugin::Plugin; /// Returns a running and checked FPGA IP - static IpCore::List + static Core::List make(PCIeCard* card, json_t *json_ips); protected: @@ -252,20 +252,20 @@ protected: private: /// Create a concrete IP instance - virtual IpCore* create() = 0; + virtual Core* create() = 0; /// Configure IP instance from JSON config - virtual bool configureJson(IpCore& /* ip */, json_t* /* json */) + virtual bool configureJson(Core& /* ip */, json_t* /* json */) { return true; } virtual Vlnv getCompatibleVlnv() const = 0; protected: static Logger - getStaticLogger() { return villas::logging.get("IpCoreFactory"); } + getStaticLogger() { return villas::logging.get("CoreFactory"); } private: - static IpCoreFactory* + static CoreFactory* lookup(const Vlnv& vlnv); }; diff --git a/fpga/include/villas/fpga/ips/aurora.hpp b/fpga/include/villas/fpga/ips/aurora.hpp index c7e1c621d..aec351bee 100644 --- a/fpga/include/villas/fpga/ips/aurora.hpp +++ b/fpga/include/villas/fpga/ips/aurora.hpp @@ -27,13 +27,13 @@ #pragma once -#include +#include namespace villas { namespace fpga { namespace ip { -class Aurora : public IpNode { +class Aurora : public Node { public: static constexpr const char* masterPort = "m_axis"; static constexpr const char* slavePort = "s_axis"; @@ -62,10 +62,10 @@ private: }; -class AuroraFactory : public IpNodeFactory { +class AuroraFactory : public NodeFactory { public: - IpCore* create() + Core* create() { return new Aurora; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/bram.hpp b/fpga/include/villas/fpga/ips/bram.hpp index a123bcc73..56139c6a1 100644 --- a/fpga/include/villas/fpga/ips/bram.hpp +++ b/fpga/include/villas/fpga/ips/bram.hpp @@ -27,14 +27,14 @@ #pragma once #include -#include +#include namespace villas { namespace fpga { namespace ip { -class Bram : public IpCore +class Bram : public Core { friend class BramFactory; public: @@ -56,12 +56,12 @@ private: -class BramFactory : public IpCoreFactory { +class BramFactory : public CoreFactory { public: - bool configureJson(IpCore& ip, json_t *json_ip); + bool configureJson(Core& ip, json_t *json_ip); - IpCore* create() + Core* create() { return new Bram; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/dma.hpp b/fpga/include/villas/fpga/ips/dma.hpp index e241503d2..77208ca20 100644 --- a/fpga/include/villas/fpga/ips/dma.hpp +++ b/fpga/include/villas/fpga/ips/dma.hpp @@ -29,13 +29,13 @@ #include #include -#include +#include namespace villas { namespace fpga { namespace ip { -class Dma : public IpNode +class Dma : public Node { public: friend class DmaFactory; @@ -112,10 +112,10 @@ private: -class DmaFactory : public IpNodeFactory { +class DmaFactory : public NodeFactory { public: - IpCore* create() + Core* create() { return new Dma; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/fifo.hpp b/fpga/include/villas/fpga/ips/fifo.hpp index 3f025f2ec..1d4694035 100644 --- a/fpga/include/villas/fpga/ips/fifo.hpp +++ b/fpga/include/villas/fpga/ips/fifo.hpp @@ -31,7 +31,7 @@ #include -#include +#include namespace villas { @@ -39,7 +39,7 @@ namespace fpga { namespace ip { -class Fifo : public IpNode +class Fifo : public Node { public: friend class FifoFactory; @@ -63,10 +63,10 @@ private: -class FifoFactory : public IpNodeFactory { +class FifoFactory : public NodeFactory { public: - IpCore* create() + Core* create() { return new Fifo; } std::string @@ -82,15 +82,15 @@ public: }; -class FifoData : public IpNode { +class FifoData : public Node { friend class FifoDataFactory; }; -class FifoDataFactory : public IpNodeFactory { +class FifoDataFactory : public NodeFactory { public: - IpCore* create() + Core* create() { return new FifoData; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/gpio.hpp b/fpga/include/villas/fpga/ips/gpio.hpp index 19beb329d..ffa695626 100644 --- a/fpga/include/villas/fpga/ips/gpio.hpp +++ b/fpga/include/villas/fpga/ips/gpio.hpp @@ -30,14 +30,14 @@ #include -#include +#include namespace villas { namespace fpga { namespace ip { -class GeneralPurposeIO : public IpCore +class GeneralPurposeIO : public Core { public: @@ -51,14 +51,14 @@ private: { return { registerMemory }; } }; -class GeneralPurposeIOFactory : public IpCoreFactory { +class GeneralPurposeIOFactory : public CoreFactory { public: static constexpr const char* getCompatibleVlnvString() { return "xilinx.com:ip:axi_gpio:"; } - IpCore* create() + Core* create() { return new GeneralPurposeIO; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/gpu2rtds.hpp b/fpga/include/villas/fpga/ips/gpu2rtds.hpp index b4622ef4b..e3e18d846 100644 --- a/fpga/include/villas/fpga/ips/gpu2rtds.hpp +++ b/fpga/include/villas/fpga/ips/gpu2rtds.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include #include @@ -12,7 +12,7 @@ namespace fpga { namespace ip { -class Gpu2Rtds : public IpNode, public Hls +class Gpu2Rtds : public Node, public Hls { public: friend class Gpu2RtdsFactory; @@ -63,10 +63,10 @@ public: }; -class Gpu2RtdsFactory : public IpNodeFactory { +class Gpu2RtdsFactory : public NodeFactory { public: - IpCore* create() + Core* create() { return new Gpu2Rtds; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/hls.hpp b/fpga/include/villas/fpga/ips/hls.hpp index e453a7713..96d794af9 100644 --- a/fpga/include/villas/fpga/ips/hls.hpp +++ b/fpga/include/villas/fpga/ips/hls.hpp @@ -1,14 +1,14 @@ #pragma once #include -#include +#include namespace villas { namespace fpga { namespace ip { -class Hls : public virtual IpCore +class Hls : public virtual Core { public: virtual bool init() diff --git a/fpga/include/villas/fpga/ips/intc.hpp b/fpga/include/villas/fpga/ips/intc.hpp index 6c68e5137..278ada8e9 100644 --- a/fpga/include/villas/fpga/ips/intc.hpp +++ b/fpga/include/villas/fpga/ips/intc.hpp @@ -30,14 +30,14 @@ #include -#include +#include namespace villas { namespace fpga { namespace ip { -class InterruptController : public IpCore +class InterruptController : public Core { public: using IrqMaskType = uint32_t; @@ -81,14 +81,14 @@ private: -class InterruptControllerFactory : public IpCoreFactory { +class InterruptControllerFactory : public CoreFactory { public: static constexpr const char* getCompatibleVlnvString() { return "acs.eonerc.rwth-aachen.de:user:axi_pcie_intc:"; } - IpCore* create() + Core* create() { return new InterruptController; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/pcie.hpp b/fpga/include/villas/fpga/ips/pcie.hpp index 538fe0371..bf168759e 100644 --- a/fpga/include/villas/fpga/ips/pcie.hpp +++ b/fpga/include/villas/fpga/ips/pcie.hpp @@ -32,13 +32,13 @@ #include -#include +#include namespace villas { namespace fpga { namespace ip { -class AxiPciExpressBridge : public IpCore { +class AxiPciExpressBridge : public Core { public: friend class AxiPciExpressBridgeFactory; @@ -63,16 +63,16 @@ private: }; -class AxiPciExpressBridgeFactory : public IpCoreFactory { +class AxiPciExpressBridgeFactory : public CoreFactory { public: static constexpr const char* getCompatibleVlnvString() { return "xilinx.com:ip:axi_pcie:"; } - bool configureJson(IpCore& ip, json_t *json_ip); + bool configureJson(Core& ip, json_t *json_ip); - IpCore* create() + Core* create() { return new AxiPciExpressBridge; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/rtds.hpp b/fpga/include/villas/fpga/ips/rtds.hpp index 81d8967fb..affe34353 100644 --- a/fpga/include/villas/fpga/ips/rtds.hpp +++ b/fpga/include/villas/fpga/ips/rtds.hpp @@ -27,13 +27,13 @@ #pragma once -#include +#include namespace villas { namespace fpga { namespace ip { -class Rtds : public IpNode { +class Rtds : public Node { public: static constexpr const char* masterPort = "m_axis"; static constexpr const char* slavePort = "s_axis"; @@ -60,9 +60,9 @@ private: }; -class RtdsFactory : public IpNodeFactory { +class RtdsFactory : public NodeFactory { public: - IpCore* create() + Core* create() { return new Rtds; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/rtds2gpu.hpp b/fpga/include/villas/fpga/ips/rtds2gpu.hpp index cedd41bee..fb24373b2 100644 --- a/fpga/include/villas/fpga/ips/rtds2gpu.hpp +++ b/fpga/include/villas/fpga/ips/rtds2gpu.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include #include "rtds2gpu/xrtds2gpu.h" @@ -25,7 +25,7 @@ union ControlRegister { }; -class Rtds2Gpu : public IpNode, public Hls +class Rtds2Gpu : public Node, public Hls { public: friend class Rtds2GpuFactory; @@ -72,10 +72,10 @@ private: }; -class Rtds2GpuFactory : public IpNodeFactory { +class Rtds2GpuFactory : public NodeFactory { public: - IpCore* create() + Core* create() { return new Rtds2Gpu; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/switch.hpp b/fpga/include/villas/fpga/ips/switch.hpp index 233edce79..fe3cc9ef0 100644 --- a/fpga/include/villas/fpga/ips/switch.hpp +++ b/fpga/include/villas/fpga/ips/switch.hpp @@ -34,13 +34,13 @@ #include -#include +#include namespace villas { namespace fpga { namespace ip { -class AxiStreamSwitch : public IpNode { +class AxiStreamSwitch : public Node { public: friend class AxiStreamSwitchFactory; @@ -60,8 +60,8 @@ private: { return { registerMemory }; } struct Path { - IpCore* masterOut; - IpCore* slaveIn; + Core* masterOut; + Core* slaveIn; }; int num_ports; @@ -70,16 +70,16 @@ private: }; -class AxiStreamSwitchFactory : public IpNodeFactory { +class AxiStreamSwitchFactory : public NodeFactory { public: static constexpr const char* getCompatibleVlnvString() { return "xilinx.com:ip:axis_switch:"; } - bool configureJson(IpCore& ip, json_t *json_ip); + bool configureJson(Core& ip, json_t *json_ip); - IpCore* create() + Core* create() { return new AxiStreamSwitch; } virtual std::string diff --git a/fpga/include/villas/fpga/ips/timer.hpp b/fpga/include/villas/fpga/ips/timer.hpp index 1856af260..b0aee3f9c 100644 --- a/fpga/include/villas/fpga/ips/timer.hpp +++ b/fpga/include/villas/fpga/ips/timer.hpp @@ -33,14 +33,14 @@ #include #include -#include +#include namespace villas { namespace fpga { namespace ip { -class Timer : public IpCore +class Timer : public Core { friend class TimerFactory; public: @@ -73,10 +73,10 @@ private: -class TimerFactory : public IpCoreFactory { +class TimerFactory : public CoreFactory { public: - IpCore* create() + Core* create() { return new Timer; } virtual std::string diff --git a/fpga/include/villas/fpga/ip_node.hpp b/fpga/include/villas/fpga/node.hpp similarity index 93% rename from fpga/include/villas/fpga/ip_node.hpp rename to fpga/include/villas/fpga/node.hpp index 76a47f408..08f5b42d5 100644 --- a/fpga/include/villas/fpga/ip_node.hpp +++ b/fpga/include/villas/fpga/node.hpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include @@ -85,10 +85,10 @@ public: }; -class IpNode : public virtual IpCore { +class Node : public virtual Core { public: - friend class IpNodeFactory; + friend class NodeFactory; struct StreamPort { int portNumber; @@ -107,7 +107,7 @@ public: // easy-usage assuming that the slave IP to connect to only has one slave // port and implements the getDefaultSlavePort() function - bool connect(const IpNode& slaveNode) + bool connect(const Node& slaveNode) { return this->connect(this->getDefaultMasterPort(), slaveNode.getDefaultSlavePort()); } // used by easy-usage connect, will throw if not implemented by derived node @@ -140,11 +140,11 @@ protected: static StreamGraph streamGraph; }; -class IpNodeFactory : public IpCoreFactory { +class NodeFactory : public CoreFactory { public: - using IpCoreFactory::IpCoreFactory; + using CoreFactory::CoreFactory; - virtual bool configureJson(IpCore& ip, json_t *json_ip); + virtual bool configureJson(Core& ip, json_t *json_ip); }; /** @} */ diff --git a/fpga/lib/CMakeLists.txt b/fpga/lib/CMakeLists.txt index 4524cfd30..08db15e33 100644 --- a/fpga/lib/CMakeLists.txt +++ b/fpga/lib/CMakeLists.txt @@ -23,8 +23,8 @@ set(SOURCES vlnv.cpp card.cpp - ip.cpp - ip_node.cpp + core.cpp + node.cpp ips/timer.cpp ips/switch.cpp diff --git a/fpga/lib/card.cpp b/fpga/lib/card.cpp index fb9970680..aa383f13e 100644 --- a/fpga/lib/card.cpp +++ b/fpga/lib/card.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include namespace villas { @@ -92,7 +92,7 @@ PCIeCardFactory::make(json_t *json, struct pci* pci, std::shared_ptrips = ip::IpCoreFactory::make(card.get(), json_ips); + card->ips = ip::CoreFactory::make(card.get(), json_ips); if (card->ips.empty()) { logger->error("Cannot initialize IPs of FPGA card {}", card_name); continue; @@ -136,7 +136,7 @@ PCIeCard::~PCIeCard() } -ip::IpCore::Ptr +ip::Core::Ptr PCIeCard::lookupIp(const std::string& name) const { for (auto& ip : ips) { @@ -149,7 +149,7 @@ PCIeCard::lookupIp(const std::string& name) const } -ip::IpCore::Ptr +ip::Core::Ptr PCIeCard::lookupIp(const Vlnv& vlnv) const { for (auto& ip : ips) { @@ -161,7 +161,7 @@ PCIeCard::lookupIp(const Vlnv& vlnv) const return nullptr; } -ip::IpCore::Ptr +ip::Core::Ptr PCIeCard::lookupIp(const ip::IpIdentifier& id) const { for (auto& ip : ips) { diff --git a/fpga/lib/ip.cpp b/fpga/lib/core.cpp similarity index 91% rename from fpga/lib/ip.cpp rename to fpga/lib/core.cpp index 9985b2f80..d1836a6ab 100644 --- a/fpga/lib/ip.cpp +++ b/fpga/lib/core.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include @@ -52,8 +52,8 @@ vlnvInitializationOrder = { }; -IpCore::List -IpCoreFactory::make(PCIeCard* card, json_t *json_ips) +Core::List +CoreFactory::make(PCIeCard* card, json_t *json_ips) { // We only have this logger until we know the factory to build an IP with auto loggerStatic = getStaticLogger(); @@ -61,8 +61,8 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips) std::list allIps; // all IPs available in config std::list orderedIps; // IPs ordered in initialization order - IpCore::List configuredIps; // Successfully configured IPs - IpCore::List initializedIps; // Initialized, i.e. ready-to-use IPs + Core::List configuredIps; // Successfully configured IPs + Core::List initializedIps; // Initialized, i.e. ready-to-use IPs // parse all IP instance names and their VLNV into list `allIps` @@ -112,29 +112,29 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips) // This is the magic part! Factories automatically register as a // plugin as soon as they are instantiated. If there are multiple // candidates, the first suitable factory will be used. - IpCoreFactory* ipCoreFactory = lookup(id.getVlnv()); + CoreFactory* CoreFactory = lookup(id.getVlnv()); - if (ipCoreFactory == nullptr) { + if (CoreFactory == nullptr) { loggerStatic->warn("No plugin found to handle {}", id.getVlnv()); continue; } else { loggerStatic->debug("Using {} for IP {}", - ipCoreFactory->getName(), id.getVlnv()); + CoreFactory->getName(), id.getVlnv()); } - auto logger = ipCoreFactory->getLogger(); + auto logger = CoreFactory->getLogger(); // Create new IP instance. Since this function is virtual, it will // construct the right, specialized type without knowing it here // because we have already picked the right factory. // If something goes wrong with initialization, the shared_ptr will - // take care to desctruct the IpCore again as it is not pushed to + // take care to desctruct the Core again as it is not pushed to // the list and will run out of scope. - auto ip = std::unique_ptr(ipCoreFactory->create()); + auto ip = std::unique_ptr(CoreFactory->create()); if (ip == nullptr) { logger->warn("Cannot create an instance of {}", - ipCoreFactory->getName()); + CoreFactory->getName()); continue; } @@ -255,7 +255,7 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips) } // IP-specific setup via JSON config - if (not ipCoreFactory->configureJson(*ip, json_ip)) { + if (not CoreFactory->configureJson(*ip, json_ip)) { logger->warn("Cannot configure IP from JSON"); continue; } @@ -318,7 +318,7 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips) void -IpCore::dump() +Core::dump() { logger->info("IP: {}", *this); for (auto& [num, irq] : irqs) { @@ -332,10 +332,10 @@ IpCore::dump() } -IpCoreFactory* -IpCoreFactory::lookup(const Vlnv &vlnv) +CoreFactory* +CoreFactory::lookup(const Vlnv &vlnv) { - for (auto& ip : plugin::Registry::lookup()) { + for (auto& ip : plugin::Registry::lookup()) { if (ip->getCompatibleVlnv() == vlnv) return ip; } @@ -345,7 +345,7 @@ IpCoreFactory::lookup(const Vlnv &vlnv) uintptr_t -IpCore::getLocalAddr(const MemoryBlockName& block, uintptr_t address) const +Core::getLocalAddr(const MemoryBlockName& block, uintptr_t address) const { // throws exception if block not present auto& translation = addressTranslations.at(block); @@ -355,7 +355,7 @@ IpCore::getLocalAddr(const MemoryBlockName& block, uintptr_t address) const InterruptController* -IpCore::getInterruptController(const std::string& interruptName) const +Core::getInterruptController(const std::string& interruptName) const { try { const IrqPort irq = irqs.at(interruptName); diff --git a/fpga/lib/ips/bram.cpp b/fpga/lib/ips/bram.cpp index 89c73bc82..3894e39c3 100644 --- a/fpga/lib/ips/bram.cpp +++ b/fpga/lib/ips/bram.cpp @@ -29,7 +29,7 @@ namespace ip { static BramFactory factory; bool -BramFactory::configureJson(IpCore& ip, json_t* json_ip) +BramFactory::configureJson(Core& ip, json_t* json_ip) { auto& bram = dynamic_cast(ip); diff --git a/fpga/lib/ips/dma.cpp b/fpga/lib/ips/dma.cpp index 8ae5a2908..f5aabd3e9 100644 --- a/fpga/lib/ips/dma.cpp +++ b/fpga/lib/ips/dma.cpp @@ -394,7 +394,7 @@ Dma::isMemoryBlockAccesible(const MemoryBlock& mem, const std::string& interface void Dma::dump() { - IpCore::dump(); + Core::dump(); logger->info("S2MM_DMACR: {:x}", XAxiDma_ReadReg(xDma.RegBase, XAXIDMA_RX_OFFSET + XAXIDMA_CR_OFFSET)); logger->info("S2MM_DMASR: {:x}", XAxiDma_ReadReg(xDma.RegBase, XAXIDMA_RX_OFFSET + XAXIDMA_SR_OFFSET)); diff --git a/fpga/lib/ips/pcie.cpp b/fpga/lib/ips/pcie.cpp index 571df3b22..3db756801 100644 --- a/fpga/lib/ips/pcie.cpp +++ b/fpga/lib/ips/pcie.cpp @@ -122,7 +122,7 @@ AxiPciExpressBridge::init() } bool -AxiPciExpressBridgeFactory::configureJson(IpCore& ip, json_t* json_ip) +AxiPciExpressBridgeFactory::configureJson(Core& ip, json_t* json_ip) { auto logger = getLogger(); auto& pcie = dynamic_cast(ip); diff --git a/fpga/lib/ips/switch.cpp b/fpga/lib/ips/switch.cpp index e731f31b5..d788ecc18 100644 --- a/fpga/lib/ips/switch.cpp +++ b/fpga/lib/ips/switch.cpp @@ -136,9 +136,9 @@ AxiStreamSwitch::portNameToNum(const std::string& portName) } bool -AxiStreamSwitchFactory::configureJson(IpCore& ip, json_t* json_ip) +AxiStreamSwitchFactory::configureJson(Core& ip, json_t* json_ip) { - if (not IpNodeFactory::configureJson(ip, json_ip)) + if (not NodeFactory::configureJson(ip, json_ip)) return false; auto logger = getLogger(); diff --git a/fpga/lib/ip_node.cpp b/fpga/lib/node.cpp similarity index 86% rename from fpga/lib/ip_node.cpp rename to fpga/lib/node.cpp index f7febce3d..a7ca3892c 100644 --- a/fpga/lib/ip_node.cpp +++ b/fpga/lib/node.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include namespace villas { @@ -36,12 +36,12 @@ namespace ip { StreamGraph -IpNode::streamGraph; +Node::streamGraph; bool -IpNodeFactory::configureJson(IpCore& ip, json_t* json_ip) +NodeFactory::configureJson(Core& ip, json_t* json_ip) { - auto& ipNode = dynamic_cast(ip); + auto& Node = dynamic_cast(ip); auto logger = getLogger(); json_t* json_ports = json_object_get(json_ip, "ports"); @@ -77,23 +77,23 @@ IpNodeFactory::configureJson(IpCore& ip, json_t* json_ip) const std::string role(role_raw); const bool isMaster = (role == "master" or role == "initiator"); - auto thisVertex = IpNode::streamGraph.getOrCreateStreamVertex( + auto thisVertex = Node::streamGraph.getOrCreateStreamVertex( ip.getInstanceName(), name_raw, isMaster); - auto connectedVertex = IpNode::streamGraph.getOrCreateStreamVertex( + auto connectedVertex = Node::streamGraph.getOrCreateStreamVertex( tokens[0], tokens[1], not isMaster); if (isMaster) { - IpNode::streamGraph.addDefaultEdge(thisVertex->getIdentifier(), + Node::streamGraph.addDefaultEdge(thisVertex->getIdentifier(), connectedVertex->getIdentifier()); - ipNode.portsMaster[name_raw] = thisVertex; + Node.portsMaster[name_raw] = thisVertex; } else /* slave */ { - ipNode.portsSlave[name_raw] = thisVertex; + Node.portsSlave[name_raw] = thisVertex; } } @@ -101,7 +101,7 @@ IpNodeFactory::configureJson(IpCore& ip, json_t* json_ip) } std::pair -IpNode::getLoopbackPorts() const +Node::getLoopbackPorts() const { for (auto& [masterName, masterVertex] : portsMaster) { for (auto& [slaveName, slaveVertex] : portsSlave) { @@ -115,7 +115,7 @@ IpNode::getLoopbackPorts() const return { "", "" }; } -bool IpNode::connect(const StreamVertex& from, const StreamVertex& to) +bool Node::connect(const StreamVertex& from, const StreamVertex& to) { if (from.nodeName != getInstanceName()) { logger->error("Cannot connect from a foreign StreamVertex: {}", from); @@ -158,7 +158,7 @@ bool IpNode::connect(const StreamVertex& from, const StreamVertex& to) nextHopNode = secondHopNode; } - auto nextHopNodeIp = std::dynamic_pointer_cast + auto nextHopNodeIp = std::dynamic_pointer_cast (card->lookupIp(nextHopNode->nodeName)); if (nextHopNodeIp == nullptr) { @@ -171,28 +171,28 @@ bool IpNode::connect(const StreamVertex& from, const StreamVertex& to) } const StreamVertex& -IpNode::getDefaultSlavePort() const +Node::getDefaultSlavePort() const { logger->error("No default slave port available"); throw std::exception(); } const StreamVertex& -IpNode::getDefaultMasterPort() const +Node::getDefaultMasterPort() const { logger->error("No default master port available"); throw std::exception(); } bool -IpNode::loopbackPossible() const +Node::loopbackPossible() const { auto ports = getLoopbackPorts(); return (not ports.first.empty()) and (not ports.second.empty()); } bool -IpNode::connectInternal(const std::string& slavePort, +Node::connectInternal(const std::string& slavePort, const std::string& masterPort) { (void) slavePort; @@ -203,7 +203,7 @@ IpNode::connectInternal(const std::string& slavePort, } bool -IpNode::connectLoopback() +Node::connectLoopback() { auto ports = getLoopbackPorts(); const auto& portMaster = portsMaster[ports.first]; diff --git a/fpga/src/villas-fpga-pipe.cpp b/fpga/src/villas-fpga-pipe.cpp index 34e1b62c1..9a49e41e1 100644 --- a/fpga/src/villas-fpga-pipe.cpp +++ b/fpga/src/villas-fpga-pipe.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include diff --git a/fpga/tests/dma.cpp b/fpga/tests/dma.cpp index 2c71c1aeb..f462c663f 100644 --- a/fpga/tests/dma.cpp +++ b/fpga/tests/dma.cpp @@ -105,5 +105,5 @@ Test(fpga, dma, .description = "DMA") cr_assert(count > 0, "No DMA found"); MemoryManager::get().getGraph().dump(); - fpga::ip::IpNode::getGraph().dump(); + fpga::ip::Node::getGraph().dump(); } diff --git a/fpga/tests/fpga.cpp b/fpga/tests/fpga.cpp index 67885175a..31a2806a8 100644 --- a/fpga/tests/fpga.cpp +++ b/fpga/tests/fpga.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/fpga/tests/hls.c b/fpga/tests/hls.c index b4c445787..b8bf12960 100644 --- a/fpga/tests/hls.c +++ b/fpga/tests/hls.c @@ -26,7 +26,7 @@ #include #include -#include +#include extern struct fpga_card *card; diff --git a/fpga/tests/intc.c b/fpga/tests/intc.c index 3f024f81f..2fe860176 100644 --- a/fpga/tests/intc.c +++ b/fpga/tests/intc.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include