SimpleNetwork.cc (9593:9441ca79f3c8) SimpleNetwork.cc (9799:5aed42e54180)
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;

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

91void
92SimpleNetwork::init()
93{
94 Network::init();
95
96 // The topology pointer should have already been initialized in
97 // the parent class network constructor.
98 assert(m_topology_ptr != NULL);
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;

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

91void
92SimpleNetwork::init()
93{
94 Network::init();
95
96 // The topology pointer should have already been initialized in
97 // the parent class network constructor.
98 assert(m_topology_ptr != NULL);
99 // false because this isn't a reconfiguration
100 m_topology_ptr->createLinks(this, false);
99 m_topology_ptr->createLinks(this);
101}
102
103void
104SimpleNetwork::reset()
105{
106 for (int node = 0; node < m_nodes; node++) {
107 for (int j = 0; j < m_virtual_networks; j++) {
108 m_toNetQueues[node][j]->clear();

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

125 deletePointers(m_buffers_to_free);
126 // delete m_topology_ptr;
127}
128
129// From a switch to an endpoint node
130void
131SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
132 LinkDirection direction,
100}
101
102void
103SimpleNetwork::reset()
104{
105 for (int node = 0; node < m_nodes; node++) {
106 for (int j = 0; j < m_virtual_networks; j++) {
107 m_toNetQueues[node][j]->clear();

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

124 deletePointers(m_buffers_to_free);
125 // delete m_topology_ptr;
126}
127
128// From a switch to an endpoint node
129void
130SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
131 LinkDirection direction,
133 const NetDest& routing_table_entry,
134 bool isReconfiguration)
132 const NetDest& routing_table_entry)
135{
136 assert(dest < m_nodes);
137 assert(src < m_switch_ptr_vector.size());
138 assert(m_switch_ptr_vector[src] != NULL);
139
133{
134 assert(dest < m_nodes);
135 assert(src < m_switch_ptr_vector.size());
136 assert(m_switch_ptr_vector[src] != NULL);
137
140 if (isReconfiguration) {
141 m_switch_ptr_vector[src]->reconfigureOutPort(routing_table_entry);
142 return;
143 }
144
145 SimpleExtLink *simple_link = safe_cast<SimpleExtLink*>(link);
146
147 m_switch_ptr_vector[src]->addOutPort(m_fromNetQueues[dest],
148 routing_table_entry,
149 simple_link->m_latency,
150 simple_link->m_bw_multiplier);
151
152 m_endpoint_switches[dest] = m_switch_ptr_vector[src];
153}
154
155// From an endpoint node to a switch
156void
157SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
158 LinkDirection direction,
138 SimpleExtLink *simple_link = safe_cast<SimpleExtLink*>(link);
139
140 m_switch_ptr_vector[src]->addOutPort(m_fromNetQueues[dest],
141 routing_table_entry,
142 simple_link->m_latency,
143 simple_link->m_bw_multiplier);
144
145 m_endpoint_switches[dest] = m_switch_ptr_vector[src];
146}
147
148// From an endpoint node to a switch
149void
150SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
151 LinkDirection direction,
159 const NetDest& routing_table_entry,
160 bool isReconfiguration)
152 const NetDest& routing_table_entry)
161{
162 assert(src < m_nodes);
153{
154 assert(src < m_nodes);
163 if (isReconfiguration) {
164 // do nothing
165 return;
166 }
167
168 m_switch_ptr_vector[dest]->addInPort(m_toNetQueues[src]);
169}
170
171// From a switch to a switch
172void
173SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
174 LinkDirection direction,
155 m_switch_ptr_vector[dest]->addInPort(m_toNetQueues[src]);
156}
157
158// From a switch to a switch
159void
160SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
161 LinkDirection direction,
175 const NetDest& routing_table_entry,
176 bool isReconfiguration)
162 const NetDest& routing_table_entry)
177{
163{
178 if (isReconfiguration) {
179 m_switch_ptr_vector[src]->reconfigureOutPort(routing_table_entry);
180 return;
181 }
182
183 // Create a set of new MessageBuffers
184 std::vector<MessageBuffer*> queues;
185 for (int i = 0; i < m_virtual_networks; i++) {
186 // allocate a buffer
187 MessageBuffer* buffer_ptr = new MessageBuffer;
188 buffer_ptr->setOrdering(true);
189 if (m_buffer_size > 0) {
190 buffer_ptr->resize(m_buffer_size);

--- 174 unchanged lines hidden ---
164 // Create a set of new MessageBuffers
165 std::vector<MessageBuffer*> queues;
166 for (int i = 0; i < m_virtual_networks; i++) {
167 // allocate a buffer
168 MessageBuffer* buffer_ptr = new MessageBuffer;
169 buffer_ptr->setOrdering(true);
170 if (m_buffer_size > 0) {
171 buffer_ptr->resize(m_buffer_size);

--- 174 unchanged lines hidden ---