summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-01-14 10:04:21 -0600
committerNilay Vaish <nilay@cs.wisc.edu>2013-01-14 10:04:21 -0600
commitcf232de4615f0fe9435d6e92a1d6319c972a8c88 (patch)
tree539c365baf0b078b2fdbf820feeb89c1afee8726 /src/mem/ruby/network
parentcbbc4c7f6b4cb718cc3907b955f7ae527d2d0274 (diff)
downloadgem5-cf232de4615f0fe9435d6e92a1d6319c972a8c88.tar.xz
Ruby: use ClockedObject in Consumer class
Many Ruby structures inherit from the Consumer, which is used for scheduling events. The Consumer used to relay on an Event Manager for scheduling events and on g_system_ptr for time. With this patch, the Consumer will now use a ClockedObject to schedule events and to query for current time. This resulted in several structures being converted from SimObjects to ClockedObjects. Also, the MessageBuffer class now requires a pointer to a ClockedObject so as to query for time.
Diffstat (limited to 'src/mem/ruby/network')
-rw-r--r--src/mem/ruby/network/BasicRouter.cc2
-rw-r--r--src/mem/ruby/network/BasicRouter.hh4
-rw-r--r--src/mem/ruby/network/BasicRouter.py4
-rw-r--r--src/mem/ruby/network/Network.cc2
-rw-r--r--src/mem/ruby/network/Network.hh4
-rw-r--r--src/mem/ruby/network/Network.py3
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py4
-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/NetworkLink_d.hh4
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh2
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py4
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc1
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc2
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh4
-rw-r--r--src/mem/ruby/network/simple/PerfectSwitch.cc4
-rw-r--r--src/mem/ruby/network/simple/PerfectSwitch.hh2
-rw-r--r--src/mem/ruby/network/simple/Switch.cc4
-rw-r--r--src/mem/ruby/network/simple/Throttle.cc13
-rw-r--r--src/mem/ruby/network/simple/Throttle.hh9
20 files changed, 42 insertions, 33 deletions
diff --git a/src/mem/ruby/network/BasicRouter.cc b/src/mem/ruby/network/BasicRouter.cc
index a6972afe2..96564ad0f 100644
--- a/src/mem/ruby/network/BasicRouter.cc
+++ b/src/mem/ruby/network/BasicRouter.cc
@@ -29,7 +29,7 @@
#include "mem/ruby/network/BasicRouter.hh"
BasicRouter::BasicRouter(const Params *p)
- : SimObject(p)
+ : ClockedObject(p)
{
m_id = p->router_id;
}
diff --git a/src/mem/ruby/network/BasicRouter.hh b/src/mem/ruby/network/BasicRouter.hh
index 220d3527a..fa0a417cc 100644
--- a/src/mem/ruby/network/BasicRouter.hh
+++ b/src/mem/ruby/network/BasicRouter.hh
@@ -34,9 +34,9 @@
#include <vector>
#include "params/BasicRouter.hh"
-#include "sim/sim_object.hh"
+#include "sim/clocked_object.hh"
-class BasicRouter : public SimObject
+class BasicRouter : public ClockedObject
{
public:
typedef BasicRouterParams Params;
diff --git a/src/mem/ruby/network/BasicRouter.py b/src/mem/ruby/network/BasicRouter.py
index 0c8e5cb54..c487e8632 100644
--- a/src/mem/ruby/network/BasicRouter.py
+++ b/src/mem/ruby/network/BasicRouter.py
@@ -28,9 +28,9 @@
# Brad Beckmann
from m5.params import *
-from m5.SimObject import SimObject
+from ClockedObject import ClockedObject
-class BasicRouter(SimObject):
+class BasicRouter(ClockedObject):
type = 'BasicRouter'
cxx_header = "mem/ruby/network/BasicRouter.hh"
router_id = Param.Int("ID in relation to other routers")
diff --git a/src/mem/ruby/network/Network.cc b/src/mem/ruby/network/Network.cc
index 5c025db2a..c681dc5fe 100644
--- a/src/mem/ruby/network/Network.cc
+++ b/src/mem/ruby/network/Network.cc
@@ -37,7 +37,7 @@ uint32_t Network::m_control_msg_size;
uint32_t Network::m_data_msg_size;
Network::Network(const Params *p)
- : SimObject(p)
+ : ClockedObject(p)
{
m_virtual_networks = p->number_of_virtual_networks;
m_topology_ptr = p->topology;
diff --git a/src/mem/ruby/network/Network.hh b/src/mem/ruby/network/Network.hh
index 9236a2207..a59caebbd 100644
--- a/src/mem/ruby/network/Network.hh
+++ b/src/mem/ruby/network/Network.hh
@@ -49,14 +49,14 @@
#include "mem/protocol/MessageSizeType.hh"
#include "mem/ruby/common/TypeDefines.hh"
#include "params/RubyNetwork.hh"
-#include "sim/sim_object.hh"
+#include "sim/clocked_object.hh"
class NetDest;
class MessageBuffer;
class Throttle;
class Topology;
-class Network : public SimObject
+class Network : public ClockedObject
{
public:
typedef RubyNetworkParams Params;
diff --git a/src/mem/ruby/network/Network.py b/src/mem/ruby/network/Network.py
index 4bc35b30c..a1313a841 100644
--- a/src/mem/ruby/network/Network.py
+++ b/src/mem/ruby/network/Network.py
@@ -29,6 +29,7 @@
from m5.params import *
from m5.SimObject import SimObject
+from ClockedObject import ClockedObject
from BasicLink import BasicLink
class Topology(SimObject):
@@ -42,7 +43,7 @@ class Topology(SimObject):
print_config = Param.Bool(False,
"display topology config in the stats file")
-class RubyNetwork(SimObject):
+class RubyNetwork(ClockedObject):
type = 'RubyNetwork'
cxx_class = 'Network'
cxx_header = "mem/ruby/network/Network.hh"
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py
index e5de4ecaf..bbd785e2c 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py
@@ -30,10 +30,10 @@
from m5.params import *
from m5.proxy import *
-from m5.SimObject import SimObject
+from ClockedObject import ClockedObject
from BasicLink import BasicIntLink, BasicExtLink
-class NetworkLink_d(SimObject):
+class NetworkLink_d(ClockedObject):
type = 'NetworkLink_d'
cxx_header = "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
link_id = Param.Int(Parent.link_id, "link id")
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 b0538d19f..62bee1850 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
@@ -116,6 +116,7 @@ NetworkInterface_d::addNode(vector<MessageBuffer *>& in,
// the protocol injects messages into the NI
inNode_ptr[j]->setConsumer(this);
+ inNode_ptr[j]->setClockObj(m_net_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 432097a91..6d12fc30e 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), Consumer(this)
+ : ClockedObject(p), Consumer(this)
{
m_latency = p->link_latency;
channel_width = p->channel_width;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
index 61dfe5c52..f27e60757 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
@@ -39,11 +39,11 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/orion/NetworkPower.hh"
#include "params/NetworkLink_d.hh"
-#include "sim/sim_object.hh"
+#include "sim/clocked_object.hh"
class GarnetNetwork_d;
-class NetworkLink_d : public SimObject, public Consumer
+class NetworkLink_d : public ClockedObject, public Consumer
{
public:
typedef NetworkLink_dParams Params;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
index a2d6db60b..23a1a91be 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
@@ -38,7 +38,7 @@
class FlexibleConsumer : public Consumer
{
public:
- FlexibleConsumer(EventManager *em) : Consumer(em) {}
+ FlexibleConsumer(ClockedObject *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/GarnetLink.py b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py
index d5b55c1ec..41049884f 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py
@@ -30,10 +30,10 @@
from m5.params import *
from m5.proxy import *
-from m5.SimObject import SimObject
+from ClockedObject import ClockedObject
from BasicLink import BasicIntLink, BasicExtLink
-class NetworkLink(SimObject):
+class NetworkLink(ClockedObject):
type = 'NetworkLink'
cxx_header = "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
link_id = Param.Int(Parent.link_id, "link id")
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
index 99cb44871..9e4c1ef9a 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -106,6 +106,7 @@ NetworkInterface::addNode(vector<MessageBuffer*>& in,
// protocol injects messages into the NI
for (int j = 0; j < m_virtual_networks; j++) {
inNode_ptr[j]->setConsumer(this);
+ inNode_ptr[j]->setClockObj(m_net_ptr);
}
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
index 86f44b918..2d94f6484 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), FlexibleConsumer(this)
+ : ClockedObject(p), FlexibleConsumer(this)
{
linkBuffer = new flitBuffer();
m_in_port = 0;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
index d28fd27fc..45dbe7f52 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
@@ -39,11 +39,11 @@
#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "params/NetworkLink.hh"
-#include "sim/sim_object.hh"
+#include "sim/clocked_object.hh"
class GarnetNetwork;
-class NetworkLink : public SimObject, public FlexibleConsumer
+class NetworkLink : public ClockedObject, public FlexibleConsumer
{
public:
typedef NetworkLinkParams Params;
diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc
index b38b6d539..37035f95f 100644
--- a/src/mem/ruby/network/simple/PerfectSwitch.cc
+++ b/src/mem/ruby/network/simple/PerfectSwitch.cc
@@ -68,7 +68,7 @@ PerfectSwitch::init(SimpleNetwork *network_ptr)
}
void
-PerfectSwitch::addInPort(const vector<MessageBuffer*>& in)
+PerfectSwitch::addInPort(const vector<MessageBuffer*>& in, Switch *sw)
{
assert(in.size() == m_virtual_networks);
NodeID port = m_in.size();
@@ -76,6 +76,8 @@ PerfectSwitch::addInPort(const vector<MessageBuffer*>& in)
for (int j = 0; j < m_virtual_networks; j++) {
m_in[port][j]->setConsumer(this);
+ m_in[port][j]->setClockObj(sw);
+
string desc = csprintf("[Queue from port %s %s %s to PerfectSwitch]",
to_string(m_switch_id), to_string(port), to_string(j));
m_in[port][j]->setDescription(desc);
diff --git a/src/mem/ruby/network/simple/PerfectSwitch.hh b/src/mem/ruby/network/simple/PerfectSwitch.hh
index 695c848bc..ffd1f84ba 100644
--- a/src/mem/ruby/network/simple/PerfectSwitch.hh
+++ b/src/mem/ruby/network/simple/PerfectSwitch.hh
@@ -63,7 +63,7 @@ class PerfectSwitch : public Consumer
{ return csprintf("PerfectSwitch-%i", m_switch_id); }
void init(SimpleNetwork *);
- void addInPort(const std::vector<MessageBuffer*>& in);
+ void addInPort(const std::vector<MessageBuffer*>& in, Switch *);
void addOutPort(const std::vector<MessageBuffer*>& out,
const NetDest& routing_table_entry);
void clearRoutingTables();
diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc
index 1bb944f91..d9abc4cc7 100644
--- a/src/mem/ruby/network/simple/Switch.cc
+++ b/src/mem/ruby/network/simple/Switch.cc
@@ -67,7 +67,7 @@ Switch::init()
void
Switch::addInPort(const vector<MessageBuffer*>& in)
{
- m_perfect_switch_ptr->addInPort(in);
+ m_perfect_switch_ptr->addInPort(in, this);
}
void
@@ -97,7 +97,7 @@ Switch::addOutPort(const vector<MessageBuffer*>& out,
m_perfect_switch_ptr->addOutPort(intermediateBuffers, routing_table_entry);
// Hook the queues to the Throttle
- throttle_ptr->addLinks(intermediateBuffers, out);
+ throttle_ptr->addLinks(intermediateBuffers, out, this);
}
void
diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc
index 653791c29..b591cc81b 100644
--- a/src/mem/ruby/network/simple/Throttle.cc
+++ b/src/mem/ruby/network/simple/Throttle.cc
@@ -50,7 +50,7 @@ static int network_message_to_size(NetworkMessage* net_msg_ptr);
Throttle::Throttle(int sID, NodeID node, int link_latency,
int link_bandwidth_multiplier, int endpoint_bandwidth,
- EventManager *em)
+ ClockedObject *em)
: Consumer(em)
{
init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
@@ -59,7 +59,7 @@ Throttle::Throttle(int sID, NodeID node, int link_latency,
Throttle::Throttle(NodeID node, int link_latency,
int link_bandwidth_multiplier, int endpoint_bandwidth,
- EventManager *em)
+ ClockedObject *em)
: Consumer(em)
{
init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
@@ -93,11 +93,11 @@ Throttle::clear()
void
Throttle::addLinks(const std::vector<MessageBuffer*>& in_vec,
- const std::vector<MessageBuffer*>& out_vec)
+ const std::vector<MessageBuffer*>& out_vec, ClockedObject *em)
{
assert(in_vec.size() == out_vec.size());
for (int i=0; i<in_vec.size(); i++) {
- addVirtualNetwork(in_vec[i], out_vec[i]);
+ addVirtualNetwork(in_vec[i], out_vec[i], em);
}
m_message_counters.resize(MessageSizeType_NUM);
@@ -110,7 +110,8 @@ Throttle::addLinks(const std::vector<MessageBuffer*>& in_vec,
}
void
-Throttle::addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr)
+Throttle::addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr,
+ ClockedObject *em)
{
m_units_remaining.push_back(0);
m_in.push_back(in_ptr);
@@ -118,6 +119,8 @@ Throttle::addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr)
// Set consumer and description
m_in[m_vnets]->setConsumer(this);
+ m_in[m_vnets]->setClockObj(em);
+
string desc = "[Queue to Throttle " + to_string(m_sID) + " " +
to_string(m_node) + "]";
m_in[m_vnets]->setDescription(desc);
diff --git a/src/mem/ruby/network/simple/Throttle.hh b/src/mem/ruby/network/simple/Throttle.hh
index b86a247d2..077382041 100644
--- a/src/mem/ruby/network/simple/Throttle.hh
+++ b/src/mem/ruby/network/simple/Throttle.hh
@@ -54,16 +54,16 @@ class Throttle : public Consumer
public:
Throttle(int sID, NodeID node, int link_latency,
int link_bandwidth_multiplier, int endpoint_bandwidth,
- EventManager *em);
+ ClockedObject *em);
Throttle(NodeID node, int link_latency, int link_bandwidth_multiplier,
- int endpoint_bandwidth, EventManager *em);
+ int endpoint_bandwidth, ClockedObject *em);
~Throttle() {}
std::string name()
{ return csprintf("Throttle-%i", m_sID); }
void addLinks(const std::vector<MessageBuffer*>& in_vec,
- const std::vector<MessageBuffer*>& out_vec);
+ const std::vector<MessageBuffer*>& out_vec, ClockedObject *em);
void wakeup();
void printStats(std::ostream& out) const;
@@ -90,7 +90,8 @@ class Throttle : public Consumer
private:
void init(NodeID node, int link_latency, int link_bandwidth_multiplier,
int endpoint_bandwidth);
- void addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr);
+ void addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr,
+ ClockedObject *em);
void linkUtilized(double ratio) { m_links_utilized += ratio; }
// Private copy constructor and assignment operator