summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/garnet
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2012-09-18 22:46:34 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2012-09-18 22:46:34 -0500
commit86b1c0fd540b57c1e7bba948ad0417f22f90eb41 (patch)
treec4dc42939158c13b5eeff2f6809fa800c99e490b /src/mem/ruby/network/garnet
parentd2b57a7473768e8aff3707916b40b264cab6821c (diff)
downloadgem5-86b1c0fd540b57c1e7bba948ad0417f22f90eb41.tar.xz
ruby: avoid using g_system_ptr for event scheduling
This patch removes the use of g_system_ptr for event scheduling. Each consumer object now needs to specify upfront an EventManager object it would use for scheduling events. This makes the ruby memory system more amenable for a multi-threaded simulation.
Diffstat (limited to 'src/mem/ruby/network/garnet')
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc1
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc1
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc1
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc1
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc1
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh1
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc1
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc4
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/Router.cc2
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc1
12 files changed, 13 insertions, 5 deletions
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
index adafa4d24..62b8cd574 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
@@ -35,7 +35,7 @@
using namespace std;
using m5::stl_helpers::deletePointers;
-InputUnit_d::InputUnit_d(int id, Router_d *router)
+InputUnit_d::InputUnit_d(int id, Router_d *router) : Consumer(router)
{
m_id = id;
m_router = router;
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 4bdce2a34..b0538d19f 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
@@ -44,6 +44,7 @@ using m5::stl_helpers::deletePointers;
NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks,
GarnetNetwork_d *network_ptr)
+ : Consumer(network_ptr)
{
m_id = id;
m_net_ptr = network_ptr;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
index ac41263e3..432097a91 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
@@ -32,7 +32,7 @@
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
NetworkLink_d::NetworkLink_d(const Params *p)
- : SimObject(p)
+ : SimObject(p), Consumer(this)
{
m_latency = p->link_latency;
channel_width = p->channel_width;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
index 429ff4d91..33d1583e1 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
@@ -36,6 +36,7 @@ using namespace std;
using m5::stl_helpers::deletePointers;
OutputUnit_d::OutputUnit_d(int id, Router_d *router)
+ : Consumer(router)
{
m_id = id;
m_router = router;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
index 530e8f1b2..41ff8d482 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
@@ -35,6 +35,7 @@
#include "mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh"
SWallocator_d::SWallocator_d(Router_d *router)
+ : Consumer(router)
{
m_router = router;
m_num_vcs = m_router->get_num_vcs();
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
index 12c00d9d0..1cb31c3e3 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
@@ -37,6 +37,7 @@
using m5::stl_helpers::deletePointers;
Switch_d::Switch_d(Router_d *router)
+ : Consumer(router)
{
m_router = router;
m_num_vcs = m_router->get_num_vcs();
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
index 3940e1d6a..75533fb10 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
@@ -35,6 +35,7 @@
#include "mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh"
VCallocator_d::VCallocator_d(Router_d *router)
+ : Consumer(router)
{
m_router = router;
m_num_vcs = m_router->get_num_vcs();
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
index 04a4ac95a..a2d6db60b 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
@@ -38,6 +38,7 @@
class FlexibleConsumer : public Consumer
{
public:
+ FlexibleConsumer(EventManager *em) : Consumer(em) {}
virtual bool isBufferNotFull(int vc, int inport) { return true; }
virtual void grant_vc(int out_port, int vc, Time grant_time) {}
virtual void release_vc(int out_port, int vc, Time release_time) {}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
index cc7dd7146..824acce80 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -44,6 +44,7 @@ using m5::stl_helpers::deletePointers;
NetworkInterface::NetworkInterface(int id, int virtual_networks,
GarnetNetwork *network_ptr)
+ : FlexibleConsumer(network_ptr)
{
m_id = id;
m_net_ptr = network_ptr;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
index fb7c9bd44..3908d34c3 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
@@ -32,7 +32,7 @@
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
NetworkLink::NetworkLink(const Params *p)
- : SimObject(p)
+ : SimObject(p), FlexibleConsumer(this)
{
linkBuffer = new flitBuffer();
m_in_port = 0;
@@ -140,7 +140,7 @@ NetworkLink::wakeup()
flit *t_flit = link_srcQueue->getTopFlit();
t_flit->set_time(g_system_ptr->getTime() + m_latency);
linkBuffer->insert(t_flit);
- link_consumer->scheduleEvent(this, m_latency);
+ link_consumer->scheduleEvent(m_latency);
m_link_utilized++;
m_vc_load[t_flit->get_vc()]++;
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
index 28e9fc497..88361d35a 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
@@ -41,7 +41,7 @@ using namespace std;
using m5::stl_helpers::deletePointers;
Router::Router(const Params *p)
- : BasicRouter(p)
+ : BasicRouter(p), FlexibleConsumer(this)
{
m_id = p->router_id;
m_virtual_networks = p->virt_nets;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc
index e68e1b12f..5ed336699 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc
@@ -32,6 +32,7 @@
#include "mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh"
VCarbiter::VCarbiter(Router *router)
+ : Consumer(router)
{
m_router = router;
}