summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/garnet/fixed-pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby/network/garnet/fixed-pipeline')
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc25
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py27
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_d.py44
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc68
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh11
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/SConscript1
6 files changed, 81 insertions, 95 deletions
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 2a9d37e3e..6de60b285 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
@@ -60,6 +60,17 @@ GarnetNetwork_d::GarnetNetwork_d(const Params *p)
i != p->routers.end(); ++i) {
Router_d* router = safe_cast<Router_d*>(*i);
m_routers.push_back(router);
+
+ // initialize the router's network pointers
+ router->init_net_ptr(this);
+ }
+
+ // record the network interfaces
+ for (vector<ClockedObject*>::const_iterator i = p->netifs.begin();
+ i != p->netifs.end(); ++i) {
+ NetworkInterface_d *ni = safe_cast<NetworkInterface_d *>(*i);
+ m_nis.push_back(ni);
+ ni->init_net_ptr(this);
}
}
@@ -68,23 +79,13 @@ GarnetNetwork_d::init()
{
BaseGarnetNetwork::init();
- // initialize the router's network pointers
- for (vector<Router_d*>::const_iterator i = m_routers.begin();
- i != m_routers.end(); ++i) {
- Router_d* router = safe_cast<Router_d*>(*i);
- router->init_net_ptr(this);
+ for (int i=0; i < m_nodes; i++) {
+ m_nis[i]->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
}
// The topology pointer should have already been initialized in the
// parent network constructor
assert(m_topology_ptr != NULL);
-
- for (int i=0; i < m_nodes; i++) {
- NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks,
- this);
- ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
- m_nis.push_back(ni);
- }
m_topology_ptr->createLinks(this);
// FaultModel: declare each router to the fault model
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py
index 6ebf94e04..0191d45af 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py
@@ -29,10 +29,33 @@
# Brad Beckmann
from m5.params import *
+from m5.proxy import *
from BaseGarnetNetwork import BaseGarnetNetwork
+from BasicRouter import BasicRouter
+from ClockedObject import ClockedObject
+
+class GarnetRouter_d(BasicRouter):
+ type = 'GarnetRouter_d'
+ cxx_class = 'Router_d'
+ cxx_header = "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
+ vcs_per_vnet = Param.UInt32(Parent.vcs_per_vnet,
+ "virtual channels per virtual network")
+ virt_nets = Param.UInt32(Parent.number_of_virtual_networks,
+ "number of virtual networks")
+
+class GarnetNetworkInterface_d(ClockedObject):
+ type = 'GarnetNetworkInterface_d'
+ cxx_class = 'NetworkInterface_d'
+ cxx_header = "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh"
+
+ id = Param.UInt32("ID in relation to other network interfaces")
+ vcs_per_vnet = Param.UInt32(Parent.vcs_per_vnet,
+ "virtual channels per virtual network")
+ virt_nets = Param.UInt32(Parent.number_of_virtual_networks,
+ "number of virtual networks")
class GarnetNetwork_d(BaseGarnetNetwork):
type = 'GarnetNetwork_d'
cxx_header = "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
- buffers_per_data_vc = Param.Int(4, "buffers per data virtual channel");
- buffers_per_ctrl_vc = Param.Int(1, "buffers per ctrl virtual channel");
+ buffers_per_data_vc = Param.UInt32(4, "buffers per data virtual channel");
+ buffers_per_ctrl_vc = Param.UInt32(1, "buffers per ctrl virtual channel");
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_d.py b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_d.py
deleted file mode 100644
index cd009a807..000000000
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_d.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2008 Princeton University
-# Copyright (c) 2009 Advanced Micro Devices, Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met: redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer;
-# redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution;
-# neither the name of the copyright holders nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors: Steve Reinhardt
-# Brad Beckmann
-
-from m5.params import *
-from m5.proxy import *
-from BasicRouter import BasicRouter
-
-class GarnetRouter_d(BasicRouter):
- type = 'GarnetRouter_d'
- cxx_class = 'Router_d'
- cxx_header = "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
- vcs_per_vnet = Param.Int(Parent.vcs_per_vnet,
- "virtual channels per virtual network")
- virt_nets = Param.Int(Parent.number_of_virtual_networks,
- "number of virtual networks")
-
-
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 c4c64b5ea..3e4088038 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
@@ -42,14 +42,12 @@
using namespace std;
using m5::stl_helpers::deletePointers;
-NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks,
- GarnetNetwork_d *network_ptr)
- : Consumer(network_ptr)
+NetworkInterface_d::NetworkInterface_d(const Params *p)
+ : ClockedObject(p), Consumer(this)
{
- m_id = id;
- m_net_ptr = network_ptr;
- m_virtual_networks = virtual_networks;
- m_vc_per_vnet = m_net_ptr->getVCsPerVnet();
+ m_id = p->id;
+ m_virtual_networks = p->virt_nets;
+ m_vc_per_vnet = p->vcs_per_vnet;
m_num_vcs = m_vc_per_vnet*m_virtual_networks;
m_vc_round_robin = 0;
@@ -64,11 +62,16 @@ NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks,
m_ni_buffers[i] = new flitBuffer_d();
m_ni_enqueue_time[i] = INFINITE_;
}
+
m_vc_allocator.resize(m_virtual_networks); // 1 allocator per vnet
for (int i = 0; i < m_virtual_networks; i++) {
m_vc_allocator[i] = 0;
}
+}
+void
+NetworkInterface_d::init()
+{
for (int i = 0; i < m_num_vcs; i++) {
m_out_vc_state.push_back(new OutVcState_d(i, m_net_ptr));
}
@@ -115,9 +118,8 @@ NetworkInterface_d::addNode(vector<MessageBuffer *>& in,
// the protocol injects messages into the NI
inNode_ptr[j]->setConsumer(this);
- inNode_ptr[j]->setReceiver(m_net_ptr);
-
- outNode_ptr[j]->setSender(m_net_ptr);
+ inNode_ptr[j]->setReceiver(this);
+ outNode_ptr[j]->setSender(this);
}
}
@@ -172,15 +174,14 @@ NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet)
for (int i = 0; i < num_flits; i++) {
m_net_ptr->increment_injected_flits(vnet);
flit_d *fl = new flit_d(i, vc, vnet, num_flits, new_msg_ptr,
- m_net_ptr->curCycle());
+ curCycle());
- fl->set_delay(m_net_ptr->curCycle() -
- m_net_ptr->ticksToCycles(msg_ptr->getTime()));
+ fl->set_delay(curCycle() - ticksToCycles(msg_ptr->getTime()));
m_ni_buffers[vc]->insert(fl);
}
- m_ni_enqueue_time[vc] = m_net_ptr->curCycle();
- m_out_vc_state[vc]->setState(ACTIVE_, m_net_ptr->curCycle());
+ m_ni_enqueue_time[vc] = curCycle();
+ m_out_vc_state[vc]->setState(ACTIVE_, curCycle());
}
return true ;
}
@@ -196,7 +197,7 @@ NetworkInterface_d::calculateVC(int vnet)
m_vc_allocator[vnet] = 0;
if (m_out_vc_state[(vnet*m_vc_per_vnet) + delta]->isInState(
- IDLE_, m_net_ptr->curCycle())) {
+ IDLE_, curCycle())) {
return ((vnet*m_vc_per_vnet) + delta);
}
}
@@ -216,8 +217,7 @@ NetworkInterface_d::calculateVC(int vnet)
void
NetworkInterface_d::wakeup()
{
- DPRINTF(RubyNetwork, "m_id: %d woke up at time: %lld",
- m_id, m_net_ptr->curCycle());
+ DPRINTF(RubyNetwork, "m_id: %d woke up at time: %lld", m_id, curCycle());
MsgPtr msg_ptr;
@@ -239,7 +239,7 @@ NetworkInterface_d::wakeup()
/*********** Picking messages destined for this NI **********/
- if (inNetLink->isReady(m_net_ptr->curCycle())) {
+ if (inNetLink->isReady(curCycle())) {
flit_d *t_flit = inNetLink->consumeLink();
bool free_signal = false;
if (t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) {
@@ -251,15 +251,14 @@ NetworkInterface_d::wakeup()
// Simply send a credit back since we are not buffering
// this flit in the NI
flit_d *credit_flit = new flit_d(t_flit->get_vc(), free_signal,
- m_net_ptr->curCycle());
+ curCycle());
creditQueue->insert(credit_flit);
m_ni_credit_link->
- scheduleEventAbsolute(m_net_ptr->clockEdge(Cycles(1)));
+ scheduleEventAbsolute(clockEdge(Cycles(1)));
int vnet = t_flit->get_vnet();
m_net_ptr->increment_received_flits(vnet);
- Cycles network_delay = m_net_ptr->curCycle() -
- t_flit->get_enqueue_time();
+ Cycles network_delay = curCycle() - t_flit->get_enqueue_time();
Cycles queueing_delay = t_flit->get_delay();
m_net_ptr->increment_network_latency(network_delay, vnet);
@@ -269,12 +268,11 @@ NetworkInterface_d::wakeup()
/****************** Checking for credit link *******/
- if (m_credit_link->isReady(m_net_ptr->curCycle())) {
+ if (m_credit_link->isReady(curCycle())) {
flit_d *t_flit = m_credit_link->consumeLink();
m_out_vc_state[t_flit->get_vc()]->increment_credit();
if (t_flit->is_free_signal()) {
- m_out_vc_state[t_flit->get_vc()]->setState(IDLE_,
- m_net_ptr->curCycle());
+ m_out_vc_state[t_flit->get_vc()]->setState(IDLE_, curCycle());
}
delete t_flit;
}
@@ -300,7 +298,7 @@ NetworkInterface_d::scheduleOutputLink()
vc = 0;
// model buffer backpressure
- if (m_ni_buffers[vc]->isReady(m_net_ptr->curCycle()) &&
+ if (m_ni_buffers[vc]->isReady(curCycle()) &&
m_out_vc_state[vc]->has_credits()) {
bool is_candidate_vc = true;
@@ -311,7 +309,7 @@ NetworkInterface_d::scheduleOutputLink()
for (int vc_offset = 0; vc_offset < m_vc_per_vnet;
vc_offset++) {
int t_vc = vc_base + vc_offset;
- if (m_ni_buffers[t_vc]->isReady(m_net_ptr->curCycle())) {
+ if (m_ni_buffers[t_vc]->isReady(curCycle())) {
if (m_ni_enqueue_time[t_vc] < m_ni_enqueue_time[vc]) {
is_candidate_vc = false;
break;
@@ -325,11 +323,10 @@ NetworkInterface_d::scheduleOutputLink()
m_out_vc_state[vc]->decrement_credit();
// Just removing the flit
flit_d *t_flit = m_ni_buffers[vc]->getTopFlit();
- t_flit->set_time(m_net_ptr->curCycle() + Cycles(1));
+ t_flit->set_time(curCycle() + Cycles(1));
outSrcQueue->insert(t_flit);
// schedule the out link
- outNetLink->
- scheduleEventAbsolute(m_net_ptr->clockEdge(Cycles(1)));
+ outNetLink->scheduleEventAbsolute(clockEdge(Cycles(1)));
if (t_flit->get_type() == TAIL_ ||
t_flit->get_type() == HEAD_TAIL_) {
@@ -361,7 +358,7 @@ NetworkInterface_d::checkReschedule()
}
}
for (int vc = 0; vc < m_num_vcs; vc++) {
- if (m_ni_buffers[vc]->isReady(m_net_ptr->curCycle() + Cycles(1))) {
+ if (m_ni_buffers[vc]->isReady(curCycle() + Cycles(1))) {
scheduleEvent(Cycles(1));
return;
}
@@ -385,3 +382,10 @@ NetworkInterface_d::functionalWrite(Packet *pkt)
num_functional_writes += outSrcQueue->functionalWrite(pkt);
return num_functional_writes;
}
+
+NetworkInterface_d *
+GarnetNetworkInterface_dParams::create()
+{
+ return new NetworkInterface_d(this);
+}
+
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 e064b8650..0b8b9f12f 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh
@@ -41,19 +41,21 @@
#include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh"
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/slicc_interface/Message.hh"
+#include "params/GarnetNetworkInterface_d.hh"
class NetworkMessage;
class MessageBuffer;
class flitBuffer_d;
-class NetworkInterface_d : public Consumer
+class NetworkInterface_d : public ClockedObject, public Consumer
{
public:
- NetworkInterface_d(int id, int virtual_networks,
- GarnetNetwork_d* network_ptr);
-
+ typedef GarnetNetworkInterface_dParams Params;
+ NetworkInterface_d(const Params *p);
~NetworkInterface_d();
+ void init();
+
void addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link);
void addOutPort(NetworkLink_d *out_link, CreditLink_d *credit_link);
@@ -62,6 +64,7 @@ class NetworkInterface_d : public Consumer
std::vector<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; }
uint32_t functionalWrite(Packet *);
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SConscript b/src/mem/ruby/network/garnet/fixed-pipeline/SConscript
index 82d11cb01..534fdc884 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/SConscript
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/SConscript
@@ -35,7 +35,6 @@ if env['PROTOCOL'] == 'None':
SimObject('GarnetLink_d.py')
SimObject('GarnetNetwork_d.py')
-SimObject('GarnetRouter_d.py')
Source('GarnetLink_d.cc')
Source('GarnetNetwork_d.cc')