SimpleNetwork.cc (8255:73089f793a0a) SimpleNetwork.cc (8257:7226aebb77b4)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 21 unchanged lines hidden (view full) ---

30#include <numeric>
31
32#include "base/stl_helpers.hh"
33#include "mem/protocol/MachineType.hh"
34#include "mem/protocol/Protocol.hh"
35#include "mem/protocol/TopologyType.hh"
36#include "mem/ruby/buffers/MessageBuffer.hh"
37#include "mem/ruby/common/NetDest.hh"
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 21 unchanged lines hidden (view full) ---

30#include <numeric>
31
32#include "base/stl_helpers.hh"
33#include "mem/protocol/MachineType.hh"
34#include "mem/protocol/Protocol.hh"
35#include "mem/protocol/TopologyType.hh"
36#include "mem/ruby/buffers/MessageBuffer.hh"
37#include "mem/ruby/common/NetDest.hh"
38#include "mem/ruby/network/BasicLink.hh"
38#include "mem/ruby/network/simple/SimpleNetwork.hh"
39#include "mem/ruby/network/simple/Switch.hh"
40#include "mem/ruby/network/simple/Throttle.hh"
41#include "mem/ruby/network/Topology.hh"
42#include "mem/ruby/profiler/Profiler.hh"
43#include "mem/ruby/system/System.hh"
44
45using namespace std;

--- 82 unchanged lines hidden (view full) ---

128 }
129 deletePointers(m_switch_ptr_vector);
130 deletePointers(m_buffers_to_free);
131 // delete m_topology_ptr;
132}
133
134// From a switch to an endpoint node
135void
39#include "mem/ruby/network/simple/SimpleNetwork.hh"
40#include "mem/ruby/network/simple/Switch.hh"
41#include "mem/ruby/network/simple/Throttle.hh"
42#include "mem/ruby/network/Topology.hh"
43#include "mem/ruby/profiler/Profiler.hh"
44#include "mem/ruby/system/System.hh"
45
46using namespace std;

--- 82 unchanged lines hidden (view full) ---

129 }
130 deletePointers(m_switch_ptr_vector);
131 deletePointers(m_buffers_to_free);
132 // delete m_topology_ptr;
133}
134
135// From a switch to an endpoint node
136void
136SimpleNetwork::makeOutLink(SwitchID src, NodeID dest,
137 const NetDest& routing_table_entry, int link_latency, int link_weight,
138 int bw_multiplier, bool isReconfiguration)
137SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
138 LinkDirection direction,
139 const NetDest& routing_table_entry,
140 bool isReconfiguration)
139{
140 assert(dest < m_nodes);
141 assert(src < m_switch_ptr_vector.size());
142 assert(m_switch_ptr_vector[src] != NULL);
143
144 if (isReconfiguration) {
145 m_switch_ptr_vector[src]->reconfigureOutPort(routing_table_entry);
146 return;
147 }
148
149 m_switch_ptr_vector[src]->addOutPort(m_fromNetQueues[dest],
141{
142 assert(dest < m_nodes);
143 assert(src < m_switch_ptr_vector.size());
144 assert(m_switch_ptr_vector[src] != NULL);
145
146 if (isReconfiguration) {
147 m_switch_ptr_vector[src]->reconfigureOutPort(routing_table_entry);
148 return;
149 }
150
151 m_switch_ptr_vector[src]->addOutPort(m_fromNetQueues[dest],
150 routing_table_entry, link_latency, bw_multiplier);
152 routing_table_entry,
153 link->m_latency,
154 link->m_bw_multiplier);
155
151 m_endpoint_switches[dest] = m_switch_ptr_vector[src];
152}
153
154// From an endpoint node to a switch
155void
156 m_endpoint_switches[dest] = m_switch_ptr_vector[src];
157}
158
159// From an endpoint node to a switch
160void
156SimpleNetwork::makeInLink(NodeID src, SwitchID dest,
157 const NetDest& routing_table_entry, int link_latency, int bw_multiplier,
158 bool isReconfiguration)
161SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
162 LinkDirection direction,
163 const NetDest& routing_table_entry,
164 bool isReconfiguration)
159{
160 assert(src < m_nodes);
161 if (isReconfiguration) {
162 // do nothing
163 return;
164 }
165
166 m_switch_ptr_vector[dest]->addInPort(m_toNetQueues[src]);
167}
168
169// From a switch to a switch
170void
165{
166 assert(src < m_nodes);
167 if (isReconfiguration) {
168 // do nothing
169 return;
170 }
171
172 m_switch_ptr_vector[dest]->addInPort(m_toNetQueues[src]);
173}
174
175// From a switch to a switch
176void
171SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest,
172 const NetDest& routing_table_entry, int link_latency, int link_weight,
173 int bw_multiplier, bool isReconfiguration)
177SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
178 LinkDirection direction,
179 const NetDest& routing_table_entry,
180 bool isReconfiguration)
174{
175 if (isReconfiguration) {
176 m_switch_ptr_vector[src]->reconfigureOutPort(routing_table_entry);
177 return;
178 }
179
180 // Create a set of new MessageBuffers
181 std::vector<MessageBuffer*> queues;

--- 6 unchanged lines hidden (view full) ---

188 }
189 queues.push_back(buffer_ptr);
190 // remember to deallocate it
191 m_buffers_to_free.push_back(buffer_ptr);
192 }
193 // Connect it to the two switches
194 m_switch_ptr_vector[dest]->addInPort(queues);
195 m_switch_ptr_vector[src]->addOutPort(queues, routing_table_entry,
181{
182 if (isReconfiguration) {
183 m_switch_ptr_vector[src]->reconfigureOutPort(routing_table_entry);
184 return;
185 }
186
187 // Create a set of new MessageBuffers
188 std::vector<MessageBuffer*> queues;

--- 6 unchanged lines hidden (view full) ---

195 }
196 queues.push_back(buffer_ptr);
197 // remember to deallocate it
198 m_buffers_to_free.push_back(buffer_ptr);
199 }
200 // Connect it to the two switches
201 m_switch_ptr_vector[dest]->addInPort(queues);
202 m_switch_ptr_vector[src]->addOutPort(queues, routing_table_entry,
196 link_latency, bw_multiplier);
203 link->m_latency,
204 link->m_bw_multiplier);
197}
198
199void
200SimpleNetwork::checkNetworkAllocation(NodeID id, bool ordered, int network_num)
201{
202 assert(id < m_nodes);
203 assert(network_num < m_virtual_networks);
204

--- 150 unchanged lines hidden ---
205}
206
207void
208SimpleNetwork::checkNetworkAllocation(NodeID id, bool ordered, int network_num)
209{
210 assert(id < m_nodes);
211 assert(network_num < m_virtual_networks);
212

--- 150 unchanged lines hidden ---