diff options
Diffstat (limited to 'src')
10 files changed, 47 insertions, 75 deletions
diff --git a/src/mem/ruby/network/Network.cc b/src/mem/ruby/network/Network.cc index 6e8437160..60531a423 100644 --- a/src/mem/ruby/network/Network.cc +++ b/src/mem/ruby/network/Network.cc @@ -49,6 +49,35 @@ Network::Network(const Params *p) m_topology_ptr = new Topology(p->routers.size(), p->ext_links, p->int_links); + + // Allocate to and from queues + // Queues that are getting messages from protocol + m_toNetQueues.resize(m_nodes); + + // Queues that are feeding the protocol + m_fromNetQueues.resize(m_nodes); + + for (int node = 0; node < m_nodes; node++) { + // Setting number of virtual message buffers per Network Queue + m_toNetQueues[node].resize(m_virtual_networks); + m_fromNetQueues[node].resize(m_virtual_networks); + + // Instantiating the Message Buffers that + // interact with the coherence protocol + for (int j = 0; j < m_virtual_networks; j++) { + m_toNetQueues[node][j] = new MessageBuffer(); + m_fromNetQueues[node][j] = new MessageBuffer(); + } + } + + m_in_use.resize(m_virtual_networks); + m_ordered.resize(m_virtual_networks); + + for (int i = 0; i < m_virtual_networks; i++) { + m_in_use[i] = false; + m_ordered[i] = false; + } + p->ruby_system->registerNetwork(this); // Initialize the controller's network pointers @@ -63,6 +92,19 @@ Network::Network(const Params *p) Stats::registerDumpCallback(new StatsCallback(this)); } +Network::~Network() +{ + for (int node = 0; node < m_nodes; node++) { + // Delete the Message Buffers + for (int j = 0; j < m_virtual_networks; j++) { + delete m_toNetQueues[node][j]; + delete m_fromNetQueues[node][j]; + } + } + + delete m_topology_ptr; +} + void Network::init() { diff --git a/src/mem/ruby/network/Network.hh b/src/mem/ruby/network/Network.hh index 9ddf5c8e6..dcdd791e7 100644 --- a/src/mem/ruby/network/Network.hh +++ b/src/mem/ruby/network/Network.hh @@ -60,13 +60,15 @@ class Network : public ClockedObject public: typedef RubyNetworkParams Params; Network(const Params *p); - virtual ~Network() {} const Params * params() const { return dynamic_cast<const Params *>(_params);} + virtual ~Network(); virtual void init(); static uint32_t getNumberOfVirtualNetworks() { return m_virtual_networks; } + int getNumNodes() const { return m_nodes; } + static uint32_t MessageSizeType_to_int(MessageSizeType size_type); // returns the queue requested for the given component @@ -74,7 +76,7 @@ class Network : public ClockedObject int netNumber, std::string vnet_type) = 0; virtual MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int netNumber, std::string vnet_type) = 0; - virtual int getNumNodes() {return 1;} + virtual void makeOutLink(SwitchID src, NodeID dest, BasicLink* link, LinkDirection direction, diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc index 01f1b80ed..92e45c36d 100644 --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc @@ -58,34 +58,6 @@ BaseGarnetNetwork::BaseGarnetNetwork(const Params *p) fatal("Garnet only supports uniform bw across all links and NIs\n"); } } - - // Allocate to and from queues - - // Queues that are getting messages from protocol - m_toNetQueues.resize(m_nodes); - - // Queues that are feeding the protocol - m_fromNetQueues.resize(m_nodes); - - m_in_use.resize(m_virtual_networks); - m_ordered.resize(m_virtual_networks); - for (int i = 0; i < m_virtual_networks; i++) { - m_in_use[i] = false; - m_ordered[i] = false; - } - - for (int node = 0; node < m_nodes; node++) { - // Setting number of virtual message buffers per Network Queue - m_toNetQueues[node].resize(m_virtual_networks); - m_fromNetQueues[node].resize(m_virtual_networks); - - // Instantiating the Message Buffers that - // interact with the coherence protocol - for (int j = 0; j < m_virtual_networks; j++) { - m_toNetQueues[node][j] = new MessageBuffer(); - m_fromNetQueues[node][j] = new MessageBuffer(); - } - } } void diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc index 6de60b285..baf6a9687 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -108,15 +108,10 @@ GarnetNetwork_d::init() GarnetNetwork_d::~GarnetNetwork_d() { - for (int i = 0; i < m_nodes; i++) { - deletePointers(m_toNetQueues[i]); - deletePointers(m_fromNetQueues[i]); - } deletePointers(m_routers); deletePointers(m_nis); deletePointers(m_links); deletePointers(m_creditlinks); - delete m_topology_ptr; } /* diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh index 5aef42f3a..507d8bbd6 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh @@ -52,11 +52,8 @@ class GarnetNetwork_d : public BaseGarnetNetwork GarnetNetwork_d(const Params *p); ~GarnetNetwork_d(); - void init(); - int getNumNodes() { return m_nodes; } - int getBuffersPerDataVC() {return m_buffers_per_data_vc; } int getBuffersPerCtrlVC() {return m_buffers_per_ctrl_vc; } 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 db71c9974..2f1b5ee46 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -114,8 +114,8 @@ NetworkInterface_d::addNode(vector<MessageBuffer *>& in, assert(in.size() == m_virtual_networks); inNode_ptr = in; outNode_ptr = out; - for (int j = 0; j < m_virtual_networks; j++) { + for (int j = 0; j < m_virtual_networks; j++) { // the protocol injects messages into the NI inNode_ptr[j]->setConsumer(this); inNode_ptr[j]->setReceiver(this); diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc index 280917bab..07d5412d0 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -88,14 +88,9 @@ GarnetNetwork::init() GarnetNetwork::~GarnetNetwork() { - for (int i = 0; i < m_nodes; i++) { - deletePointers(m_toNetQueues[i]); - deletePointers(m_fromNetQueues[i]); - } deletePointers(m_routers); deletePointers(m_nis); deletePointers(m_links); - delete m_topology_ptr; } void diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh index bd273b0c8..906e7eb3a 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh @@ -50,12 +50,10 @@ class GarnetNetwork : public BaseGarnetNetwork GarnetNetwork(const Params *p); ~GarnetNetwork(); - void init(); int getBufferSize() { return m_buffer_size; } int getNumPipeStages() {return m_number_of_pipe_stages; } - int getNumNodes(){ return m_nodes; } void collateStats(); void regStats(); diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc index 9eca157f6..2d08f9fa4 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.cc +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc @@ -53,30 +53,8 @@ SimpleNetwork::SimpleNetwork(const Params *p) // Note: the parent Network Object constructor is called before the // SimpleNetwork child constructor. Therefore, the member variables // used below should already be initialized. - m_endpoint_switches.resize(m_nodes); - m_in_use.resize(m_virtual_networks); - m_ordered.resize(m_virtual_networks); - for (int i = 0; i < m_virtual_networks; i++) { - m_in_use[i] = false; - m_ordered[i] = false; - } - - // Allocate to and from queues - m_toNetQueues.resize(m_nodes); - m_fromNetQueues.resize(m_nodes); - for (int node = 0; node < m_nodes; node++) { - m_toNetQueues[node].resize(m_virtual_networks); - m_fromNetQueues[node].resize(m_virtual_networks); - for (int j = 0; j < m_virtual_networks; j++) { - m_toNetQueues[node][j] = - new MessageBuffer(csprintf("toNet node %d j %d", node, j)); - m_fromNetQueues[node][j] = - new MessageBuffer(csprintf("fromNet node %d j %d", node, j)); - } - } - // record the routers for (vector<BasicRouter*>::const_iterator i = p->routers.begin(); i != p->routers.end(); ++i) { @@ -99,13 +77,8 @@ SimpleNetwork::init() SimpleNetwork::~SimpleNetwork() { - for (int i = 0; i < m_nodes; i++) { - deletePointers(m_toNetQueues[i]); - deletePointers(m_fromNetQueues[i]); - } deletePointers(m_switches); deletePointers(m_buffers_to_free); - // delete m_topology_ptr; } // From a switch to an endpoint node diff --git a/src/mem/ruby/network/simple/SimpleNetwork.hh b/src/mem/ruby/network/simple/SimpleNetwork.hh index 335ba15a0..90560c267 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.hh +++ b/src/mem/ruby/network/simple/SimpleNetwork.hh @@ -63,8 +63,6 @@ class SimpleNetwork : public Network bool isVNetOrdered(int vnet) { return m_ordered[vnet]; } bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; } - int getNumNodes() {return m_nodes; } - // Methods used by Topology to setup the network void makeOutLink(SwitchID src, NodeID dest, BasicLink* link, LinkDirection direction, |