From eccc86e8095995d49326a9fffc3a1088b97b03fc Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Fri, 22 Mar 2013 15:53:23 -0500 Subject: ruby: connect two controllers using only message buffers This patch modifies ruby so that two controllers can be connected to each other with only message buffers in between. Before this patch, all the controllers had to be connected to the network for them to communicate with each other. With this patch, one can have protocols where a controller is not connected to the network, but communicates with another controller through a message buffer. --- src/mem/ruby/slicc_interface/AbstractController.cc | 7 +++++++ src/mem/ruby/slicc_interface/AbstractController.hh | 16 ++++++++++++++++ src/mem/ruby/slicc_interface/Controller.py | 4 +++- 3 files changed, 26 insertions(+), 1 deletion(-) (limited to 'src/mem/ruby') diff --git a/src/mem/ruby/slicc_interface/AbstractController.cc b/src/mem/ruby/slicc_interface/AbstractController.cc index 9a0ee2b2b..1615f8c1d 100644 --- a/src/mem/ruby/slicc_interface/AbstractController.cc +++ b/src/mem/ruby/slicc_interface/AbstractController.cc @@ -79,3 +79,10 @@ AbstractController::profileMsgDelay(uint32_t virtualNetwork, Cycles delay) m_delayHistogram.add(delay); m_delayVCHistogram[virtualNetwork].add(delay); } + +void +AbstractController::connectWithPeer(AbstractController *c) +{ + getQueuesFromPeer(c); + c->getQueuesFromPeer(this); +} diff --git a/src/mem/ruby/slicc_interface/AbstractController.hh b/src/mem/ruby/slicc_interface/AbstractController.hh index ba0c4b683..81ef3c52b 100644 --- a/src/mem/ruby/slicc_interface/AbstractController.hh +++ b/src/mem/ruby/slicc_interface/AbstractController.hh @@ -97,12 +97,25 @@ class AbstractController : public ClockedObject, public Consumer Histogram& getDelayVCHist(uint32_t index) { return m_delayVCHistogram[index]; } + MessageBuffer *getPeerQueue(uint32_t pid) + { + std::map::iterator it = + peerQueueMap.find(pid); + assert(it != peerQueueMap.end()); + return (*it).second; + } + protected: //! Profiles original cache requests including PUTs void profileRequest(const std::string &request); //! Profiles the delay associated with messages. void profileMsgDelay(uint32_t virtualNetwork, Cycles delay); + //! Function for connecting peer controllers + void connectWithPeer(AbstractController *); + virtual void getQueuesFromPeer(AbstractController *) + { fatal("getQueuesFromPeer() should be called only if implemented!"); } + protected: int m_transitions_per_cycle; int m_buffer_size; @@ -120,6 +133,9 @@ class AbstractController : public ClockedObject, public Consumer int m_cur_in_port_rank; int m_number_of_TBEs; + //! Map from physical network number to the Message Buffer. + std::map peerQueueMap; + //! Counter for the number of cycles when the transitions carried out //! were equal to the maximum allowed uint64_t m_fully_busy_cycles; diff --git a/src/mem/ruby/slicc_interface/Controller.py b/src/mem/ruby/slicc_interface/Controller.py index 5c2fd9b71..f8242322e 100644 --- a/src/mem/ruby/slicc_interface/Controller.py +++ b/src/mem/ruby/slicc_interface/Controller.py @@ -42,4 +42,6 @@ class RubyController(ClockedObject): buffer_size = Param.Int(0, "max buffer size 0 means infinite") recycle_latency = Param.Cycles(10, "") number_of_TBEs = Param.Int(256, "") - ruby_system = Param.RubySystem(""); + ruby_system = Param.RubySystem("") + + peer = Param.RubyController(NULL, "") -- cgit v1.2.3