1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

ip/node: rename OtherIpNode to StreamPort and other to to

This commit is contained in:
daniel-k 2018-01-09 10:23:04 +01:00
parent 4d3e4dd931
commit f94476b716
3 changed files with 25 additions and 26 deletions

View file

@ -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" } ]
}
}
}

View file

@ -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<int, OtherIpNode> portsMaster;
std::map<int, OtherIpNode> portsSlave;
std::map<int, StreamPort> portsMaster;
std::map<int, StreamPort> portsSlave;
};
class IpNodeFactory : public IpCoreFactory {
@ -69,7 +69,7 @@ public:
virtual bool configureJson(IpCore& ip, json_t *json_ip);
private:
bool populatePorts(std::map<int, IpNode::OtherIpNode>& portMap, json_t* json);
bool populatePorts(std::map<int, IpNode::StreamPort>& portMap, json_t* json);
};
/** @} */

View file

@ -45,36 +45,35 @@ IpNodeFactory::configureJson(IpCore& ip, json_t* json_ip)
}
bool
IpNodeFactory::populatePorts(std::map<int, IpNode::OtherIpNode>& portMap, json_t* json)
IpNodeFactory::populatePorts(std::map<int, IpNode::StreamPort>& 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<int, IpNode::OtherIpNode>& portMap, json_t
return false;
}
cpp_debug << "Adding port mapping: " << myPortNum << ":" << other;
cpp_debug << "Adding port mapping: " << myPortNum << ":" << to;
portMap[myPortNum] = { otherPortNum, tokens[0] };
}