From f94476b716966e28e3426afec300ac6110ef8c4b Mon Sep 17 00:00:00 2001 From: daniel-k Date: Tue, 9 Jan 2018 10:23:04 +0100 Subject: [PATCH] ip/node: rename `OtherIpNode` to `StreamPort` and `other` to `to` --- fpga/etc/fpga.json | 24 ++++++++++++------------ fpga/include/villas/fpga/ip_node.hpp | 14 +++++++------- fpga/lib/ip_node.cpp | 13 ++++++------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/fpga/etc/fpga.json b/fpga/etc/fpga.json index aaac01297..de9e93980 100644 --- a/fpga/etc/fpga.json +++ b/fpga/etc/fpga.json @@ -48,8 +48,8 @@ "vlnv": "xilinx.com:ip:axi_dma:7.1", "baseaddr": 8192, "ports": { - "master": [ { "num": 0, "other": "switch_0:6" } ], - "slave": [ { "num": 0, "other": "switch_0:6" } ] + "master": [ { "num": 0, "to": "switch_0:6" } ], + "slave": [ { "num": 0, "to": "switch_0:6" } ] }, "irqs": [ "axi_pcie_intc_0:3" ] }, @@ -58,8 +58,8 @@ "baseaddr": 24576, "baseaddr_axi4": 49152, "ports": { - "master": [ { "num": 0, "other": "switch_0:2" } ], - "slave": [ { "num": 0, "other": "switch_0:2" } ] + "master": [ { "num": 0, "to": "switch_0:2" } ], + "slave": [ { "num": 0, "to": "switch_0:2" } ] }, "irqs": [ "axi_pcie_intc_0:2" ] }, @@ -67,8 +67,8 @@ "vlnv": "acs.eonerc.rwth-aachen.de:user:rtds_axis:1.0", "baseaddr": 32768, "ports": { - "master": [ { "num": 0, "other": "switch_0:0" } ], - "slave": [ { "num": 0, "other": "switch_0:0" } ] + "master": [ { "num": 0, "to": "switch_0:0" } ], + "slave": [ { "num": 0, "to": "switch_0:0" } ] }, "irqs": [ "axi_pcie_intc_0:5", "axi_pcie_intc_0:6" ] }, @@ -76,8 +76,8 @@ "vlnv": "acs.eonerc.rwth-aachen.de:hls:hls_dft:1.0", "baseaddr": 36864, "ports": { - "master": [ { "num": 0, "other": "switch_0:5" } ], - "slave": [ { "num": 0, "other": "switch_0:5" } ] + "master": [ { "num": 0, "to": "switch_0:5" } ], + "slave": [ { "num": 0, "to": "switch_0:5" } ] }, "irqs": [ "axi_pcie_intc_0:1" ], "period": 400, @@ -93,8 +93,8 @@ "axis_data_fifo_0": { "vlnv": "xilinx.com:ip:axis_data_fifo:1.1", "ports": { - "master": [ { "num": 0, "other": "switch_0:3" } ], - "slave": [ { "num": 0, "other": "switch_0:3" } ] + "master": [ { "num": 0, "to": "switch_0:3" } ], + "slave": [ { "num": 0, "to": "switch_0:3" } ] } }, "switch_0": { @@ -130,8 +130,8 @@ "axis_data_fifo_1": { "vlnv": "xilinx.com:ip:axis_data_fifo:1.1", "ports": { - "master": [ { "num": 0, "other": "switch_0:6" } ], - "slave": [ { "num": 0, "other": "switch_0:6" } ] + "master": [ { "num": 0, "to": "switch_0:6" } ], + "slave": [ { "num": 0, "to": "switch_0:6" } ] } } } diff --git a/fpga/include/villas/fpga/ip_node.hpp b/fpga/include/villas/fpga/ip_node.hpp index 0548988d9..3a319a27d 100644 --- a/fpga/include/villas/fpga/ip_node.hpp +++ b/fpga/include/villas/fpga/ip_node.hpp @@ -49,17 +49,17 @@ public: friend class IpNodeFactory; - struct OtherIpNode { - int otherPortNum; - std::string otherName; + struct StreamPort { + int portNumber; + std::string nodeName; }; - bool connectTo(int port, const OtherIpNode& other); + bool connect(int port, const StreamPort& to); bool disconnect(int port); protected: - std::map portsMaster; - std::map portsSlave; + std::map portsMaster; + std::map portsSlave; }; class IpNodeFactory : public IpCoreFactory { @@ -69,7 +69,7 @@ public: virtual bool configureJson(IpCore& ip, json_t *json_ip); private: - bool populatePorts(std::map& portMap, json_t* json); + bool populatePorts(std::map& portMap, json_t* json); }; /** @} */ diff --git a/fpga/lib/ip_node.cpp b/fpga/lib/ip_node.cpp index cca7fc579..31503e31a 100644 --- a/fpga/lib/ip_node.cpp +++ b/fpga/lib/ip_node.cpp @@ -45,36 +45,35 @@ IpNodeFactory::configureJson(IpCore& ip, json_t* json_ip) } bool -IpNodeFactory::populatePorts(std::map& portMap, json_t* json) +IpNodeFactory::populatePorts(std::map& portMap, json_t* json) { size_t index; json_t* json_port; json_array_foreach(json, index, json_port) { int myPortNum; - const char* other = nullptr; + const char* to = nullptr; int ret = json_unpack(json_port, "{ s : i, s? : s}", "num", &myPortNum, - "other", &other); + "to", &to); if(ret != 0) { cpp_error << "Port definition required field 'num'"; return false; } - if(other == nullptr) { + if(to == nullptr) { cpp_warn << "Nothing connected to port " << myPortNum; portMap[myPortNum] = {}; continue; } - const auto tokens = utils::tokenize(other, ":"); + const auto tokens = utils::tokenize(to, ":"); if(tokens.size() != 2) { cpp_error << "Too many tokens in property 'other'"; return false; } int otherPortNum; - try { otherPortNum = std::stoi(tokens[1]); } catch(const std::invalid_argument&) { @@ -82,7 +81,7 @@ IpNodeFactory::populatePorts(std::map& portMap, json_t return false; } - cpp_debug << "Adding port mapping: " << myPortNum << ":" << other; + cpp_debug << "Adding port mapping: " << myPortNum << ":" << to; portMap[myPortNum] = { otherPortNum, tokens[0] }; }