diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2014-09-01 16:55:47 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2014-09-01 16:55:47 -0500 |
commit | 7a0d5aafe4b845a2d1cff6210d7c6ee66e8aba61 (patch) | |
tree | 6ef6157a33d226688f2909998b71936976ee755b /src/mem/ruby/network/garnet/fixed-pipeline | |
parent | 00286fc5cbb7b8635d56eb335fed11d1499e2552 (diff) | |
download | gem5-7a0d5aafe4b845a2d1cff6210d7c6ee66e8aba61.tar.xz |
ruby: message buffers: significant changes
This patch is the final patch in a series of patches. The aim of the series
is to make ruby more configurable than it was. More specifically, the
connections between controllers are not at all possible (unless one is ready
to make significant changes to the coherence protocol). Moreover the buffers
themselves are magically connected to the network inside the slicc code.
These connections are not part of the configuration file.
This patch makes changes so that these connections will now be made in the
python configuration files associated with the protocols. This requires
each state machine to expose the message buffers it uses for input and output.
So, the patch makes these buffers configurable members of the machines.
The patch drops the slicc code that usd to connect these buffers to the
network. Now these buffers are exposed to the python configuration system
as Master and Slave ports. In the configuration files, any master port
can be connected any slave port. The file pyobject.cc has been modified to
take care of allocating the actual message buffer. This is inline with how
other port connections work.
Diffstat (limited to 'src/mem/ruby/network/garnet/fixed-pipeline')
-rw-r--r-- | src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc | 36 | ||||
-rw-r--r-- | src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh | 9 |
2 files changed, 26 insertions, 19 deletions
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc index 2f1b5ee46..7384cc6a7 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -53,8 +53,6 @@ NetworkInterface_d::NetworkInterface_d(const Params *p) m_vc_round_robin = 0; m_ni_buffers.resize(m_num_vcs); m_ni_enqueue_time.resize(m_num_vcs); - inNode_ptr.resize(m_virtual_networks); - outNode_ptr.resize(m_virtual_networks); creditQueue = new flitBuffer_d(); // instantiating the NI flit buffers @@ -108,18 +106,20 @@ NetworkInterface_d::addOutPort(NetworkLink_d *out_link, } void -NetworkInterface_d::addNode(vector<MessageBuffer *>& in, - vector<MessageBuffer *>& out) +NetworkInterface_d::addNode(map<int, MessageBuffer *>& in, + map<int, MessageBuffer *>& out) { - assert(in.size() == m_virtual_networks); inNode_ptr = in; outNode_ptr = out; - for (int j = 0; j < m_virtual_networks; j++) { + for (auto& it : in) { // the protocol injects messages into the NI - inNode_ptr[j]->setConsumer(this); - inNode_ptr[j]->setReceiver(this); - outNode_ptr[j]->setSender(this); + it.second->setConsumer(this); + it.second->setReceiver(this); + } + + for (auto& it : out) { + it.second->setSender(this); } } @@ -223,11 +223,14 @@ NetworkInterface_d::wakeup() // Checking for messages coming from the protocol // can pick up a message/cycle for each virtual net - for (int vnet = 0; vnet < m_virtual_networks; vnet++) { - while (inNode_ptr[vnet]->isReady()) { // Is there a message waiting - msg_ptr = inNode_ptr[vnet]->peekMsgPtr(); + for (auto it = inNode_ptr.begin(); it != inNode_ptr.end(); ++it) { + int vnet = (*it).first; + MessageBuffer *b = (*it).second; + + while (b->isReady()) { // Is there a message waiting + msg_ptr = b->peekMsgPtr(); if (flitisizeMessage(msg_ptr, vnet)) { - inNode_ptr[vnet]->dequeue(); + b->dequeue(); } else { break; } @@ -351,12 +354,15 @@ NetworkInterface_d::get_vnet(int vc) void NetworkInterface_d::checkReschedule() { - for (int vnet = 0; vnet < m_virtual_networks; vnet++) { - if (inNode_ptr[vnet]->isReady()) { // Is there a message waiting + for (const auto& it : inNode_ptr) { + MessageBuffer *b = it.second; + + while (b->isReady()) { // Is there a message waiting scheduleEvent(Cycles(1)); return; } } + for (int vc = 0; vc < m_num_vcs; vc++) { if (m_ni_buffers[vc]->isReady(curCycle() + Cycles(1))) { scheduleEvent(Cycles(1)); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh index 05142cd28..2494d05d1 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh @@ -60,8 +60,9 @@ class NetworkInterface_d : public ClockedObject, public Consumer void addOutPort(NetworkLink_d *out_link, CreditLink_d *credit_link); void wakeup(); - void addNode(std::vector<MessageBuffer *> &inNode, - std::vector<MessageBuffer *> &outNode); + void addNode(std::map<int, MessageBuffer *> &inNode, + std::map<int, MessageBuffer *> &outNode); + void print(std::ostream& out) const; int get_vnet(int vc); void init_net_ptr(GarnetNetwork_d *net_ptr) { m_net_ptr = net_ptr; } @@ -89,9 +90,9 @@ class NetworkInterface_d : public ClockedObject, public Consumer std::vector<Cycles> m_ni_enqueue_time; // The Message buffers that takes messages from the protocol - std::vector<MessageBuffer *> inNode_ptr; + std::map<int, MessageBuffer *> inNode_ptr; // The Message buffers that provides messages to the protocol - std::vector<MessageBuffer *> outNode_ptr; + std::map<int, MessageBuffer *> outNode_ptr; bool flitisizeMessage(MsgPtr msg_ptr, int vnet); int calculateVC(int vnet); |