From: Tushar Krishna Date: Tue, 31 May 2011 06:55:14 +0000 (-0400) Subject: garnet: added network ptr to links to be used by orion X-Git-Tag: stable_2012_02_02~295 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=36899dc197c17a87077c59604e00482b6f63a2a8;p=gem5.git garnet: added network ptr to links to be used by orion --- 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 7ba2e561a..1fa4abbac 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -90,6 +90,13 @@ GarnetNetwork_d::init() } // false because this isn't a reconfiguration m_topology_ptr->createLinks(this, false); + + // initialize the link's network pointers + for (vector::const_iterator i = m_link_ptr_vector.begin(); + i != m_link_ptr_vector.end(); ++i) { + NetworkLink_d* net_link = safe_cast(*i); + net_link->init_net_ptr(this); + } } GarnetNetwork_d::~GarnetNetwork_d() 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 5da006c4d..61dfe5c52 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh @@ -65,12 +65,17 @@ class NetworkLink_d : public SimObject, public Consumer inline bool isReady() { return linkBuffer->isReady(); } inline flit_d* peekLink() { return linkBuffer->peekTopFlit(); } inline flit_d* consumeLink() { return linkBuffer->getTopFlit(); } + void init_net_ptr(GarnetNetwork_d* net_ptr) + { + m_net_ptr = net_ptr; + } protected: int m_id; int m_latency; - int channel_width; + + GarnetNetwork_d *m_net_ptr; flitBuffer_d *linkBuffer; Consumer *link_consumer; flitBuffer_d *link_srcQueue; diff --git a/src/mem/ruby/network/orion/NetworkPower.cc b/src/mem/ruby/network/orion/NetworkPower.cc index 73d60697a..af163ac29 100644 --- a/src/mem/ruby/network/orion/NetworkPower.cc +++ b/src/mem/ruby/network/orion/NetworkPower.cc @@ -245,13 +245,9 @@ NetworkLink_d::calculate_power() channel_width /* channel width */, orion_cfg_ptr); -// -// NOTE! I believe this calculation will be moved to McPAT, thus this -// reference to the net_ptr can be removed -// // // Dynamic Power - double sim_cycles = 0.0; -// (double)(g_eventQueue_ptr->getTime() - m_net_ptr->getRubyStartTime()); + double sim_cycles = + (double)(g_eventQueue_ptr->getTime() - m_net_ptr->getRubyStartTime()); double Plink_dyn = orion_link_ptr->calc_dynamic_energy(channel_width/2)* (m_link_utilized/ sim_cycles)*freq_Hz;