summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/simple/Topology.cc
diff options
context:
space:
mode:
authorBrad Beckmann <Brad.Beckmann@amd.com>2010-01-29 20:29:18 -0800
committerBrad Beckmann <Brad.Beckmann@amd.com>2010-01-29 20:29:18 -0800
commit42bebab77973114c5d81a37b50faf521b6f0a029 (patch)
tree40d031d2689ed11500f6027ffb36eaafdd4e35f4 /src/mem/ruby/network/simple/Topology.cc
parenta8ea70dac6592b63cf957acd33a938189f1712af (diff)
downloadgem5-42bebab77973114c5d81a37b50faf521b6f0a029.tar.xz
ruby: connects sm queues to the network
Diffstat (limited to 'src/mem/ruby/network/simple/Topology.cc')
-rw-r--r--src/mem/ruby/network/simple/Topology.cc60
1 files changed, 29 insertions, 31 deletions
diff --git a/src/mem/ruby/network/simple/Topology.cc b/src/mem/ruby/network/simple/Topology.cc
index 84185ef92..15c94d97d 100644
--- a/src/mem/ruby/network/simple/Topology.cc
+++ b/src/mem/ruby/network/simple/Topology.cc
@@ -68,54 +68,41 @@ Topology::Topology(const Params *p)
{
m_print_config = p->print_config;
m_number_of_switches = p->num_int_nodes;
- // initialize component latencies record
- m_component_latencies.setSize(0);
- m_component_inter_switches.setSize(0);
-}
-
-void Topology::init()
-{
- // need to defer this until init, to guarantee that constructors
- // for all the controller objects have been called.
+ // initialize component latencies record
+ m_component_latencies.setSize(0);
+ m_component_inter_switches.setSize(0);
+
+ //
+ // Total nodes/controllers in network
+ // Must make sure this is called after the State Machine constructors
+ //
m_nodes = MachineType_base_number(MachineType_NUM);
-}
+ assert(m_nodes > 1);
-void Topology::makeTopology()
-{
if (m_nodes != params()->ext_links.size()) {
fatal("m_nodes (%d) != ext_links vector length (%d)\n",
m_nodes != params()->ext_links.size());
}
-
-
- /*
- if (m_nodes == 1) {
- SwitchID id = newSwitchID();
- addLink(0, id, m_network_ptr->getOffChipLinkLatency());
- addLink(id, 1, m_network_ptr->getOffChipLinkLatency());
- return;
- }
- */
- assert(m_nodes > 1);
-
- Vector< Vector < SwitchID > > nodePairs; // node pairs extracted from the file
- Vector<int> latencies; // link latencies for each link extracted
- Vector<int> bw_multis; // bw multipliers for each link extracted
- Vector<int> weights; // link weights used to enfore e-cube deadlock free routing
- Vector< SwitchID > int_network_switches; // internal switches extracted from the file
- Vector<bool> endpointConnectionExist; // used to ensure all endpoints are connected to the network
-
+ //
+ // First create the links between the endpoints (i.e. controllers) and the
+ // network.
+ //
for (vector<ExtLink*>::const_iterator i = params()->ext_links.begin();
i != params()->ext_links.end(); ++i)
{
const ExtLinkParams *p = (*i)->params();
AbstractController *c = p->ext_node;
+
+ // Store the controller pointers for later
+ m_controller_vector.insertAtBottom(c);
+
int ext_idx1 =
MachineType_base_number(c->getMachineType()) + c->getVersion();
int ext_idx2 = ext_idx1 + m_nodes;
int int_idx = p->int_node + 2*m_nodes;
+ // create the links in both directions
addLink(ext_idx1, int_idx, p->latency, p->bw_multiplier, p->weight);
addLink(int_idx, ext_idx2, p->latency, p->bw_multiplier, p->weight);
}
@@ -126,12 +113,23 @@ void Topology::makeTopology()
const IntLinkParams *p = (*i)->params();
int a = p->node_a + 2*m_nodes;
int b = p->node_b + 2*m_nodes;
+
+ // create the links in both directions
addLink(a, b, p->latency, p->bw_multiplier, p->weight);
addLink(b, a, p->latency, p->bw_multiplier, p->weight);
}
}
+void Topology::initNetworkPtr(Network* net_ptr)
+{
+ for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++)
+ {
+ m_controller_vector[cntrl]->initNetworkPtr(net_ptr);
+ }
+}
+
+
void Topology::createLinks(Network *net, bool isReconfiguration)
{
// Find maximum switchID