PerfectSwitch.cc (7056:b66b558578bd) PerfectSwitch.cc (7453:1a5db3dd0f62)
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;

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

165 Vector<NetDest> output_link_destinations;
166
167 // Is there a message waiting?
168 while (m_in[incoming][vnet]->isReady()) {
169 DEBUG_EXPR(NETWORK_COMP, MedPrio, incoming);
170
171 // Peek at message
172 msg_ptr = m_in[incoming][vnet]->peekMsgPtr();
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;

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

165 Vector<NetDest> output_link_destinations;
166
167 // Is there a message waiting?
168 while (m_in[incoming][vnet]->isReady()) {
169 DEBUG_EXPR(NETWORK_COMP, MedPrio, incoming);
170
171 // Peek at message
172 msg_ptr = m_in[incoming][vnet]->peekMsgPtr();
173 net_msg_ptr = dynamic_cast<NetworkMessage*>(msg_ptr.ref());
173 net_msg_ptr = safe_cast<NetworkMessage*>(msg_ptr.get());
174 DEBUG_EXPR(NETWORK_COMP, MedPrio, *net_msg_ptr);
175
176 output_links.clear();
177 output_link_destinations.clear();
178 NetDest msg_dsts =
179 net_msg_ptr->getInternalDestination();
180
181 // Unfortunately, the token-protocol sends some

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

267 // one link (size>1), we need to make a copy of
268 // the message so each branch can have a different
269 // internal destination we need to create an
270 // unmodified MsgPtr because the MessageBuffer
271 // enqueue func will modify the message
272
273 // This magic line creates a private copy of the
274 // message
174 DEBUG_EXPR(NETWORK_COMP, MedPrio, *net_msg_ptr);
175
176 output_links.clear();
177 output_link_destinations.clear();
178 NetDest msg_dsts =
179 net_msg_ptr->getInternalDestination();
180
181 // Unfortunately, the token-protocol sends some

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

267 // one link (size>1), we need to make a copy of
268 // the message so each branch can have a different
269 // internal destination we need to create an
270 // unmodified MsgPtr because the MessageBuffer
271 // enqueue func will modify the message
272
273 // This magic line creates a private copy of the
274 // message
275 unmodified_msg_ptr = *(msg_ptr.ref());
275 unmodified_msg_ptr = msg_ptr->clone();
276 }
277
278 // Enqueue it - for all outgoing queues
279 for (int i=0; i<output_links.size(); i++) {
280 int outgoing = output_links[i];
281
282 if (i > 0) {
283 // create a private copy of the unmodified
284 // message
276 }
277
278 // Enqueue it - for all outgoing queues
279 for (int i=0; i<output_links.size(); i++) {
280 int outgoing = output_links[i];
281
282 if (i > 0) {
283 // create a private copy of the unmodified
284 // message
285 msg_ptr = *(unmodified_msg_ptr.ref());
285 msg_ptr = unmodified_msg_ptr->clone();
286 }
287
288 // Change the internal destination set of the
289 // message so it knows which destinations this
290 // link is responsible for.
286 }
287
288 // Change the internal destination set of the
289 // message so it knows which destinations this
290 // link is responsible for.
291 net_msg_ptr = safe_cast<NetworkMessage*>(msg_ptr.ref());
291 net_msg_ptr = safe_cast<NetworkMessage*>(msg_ptr.get());
292 net_msg_ptr->getInternalDestination() =
293 output_link_destinations[i];
294
295 // Enqeue msg
296 DEBUG_NEWLINE(NETWORK_COMP,HighPrio);
297 DEBUG_MSG(NETWORK_COMP, HighPrio,
298 csprintf("switch: %d enqueuing net msg from "
299 "inport[%d][%d] to outport [%d][%d] time: %d.",

--- 36 unchanged lines hidden ---
292 net_msg_ptr->getInternalDestination() =
293 output_link_destinations[i];
294
295 // Enqeue msg
296 DEBUG_NEWLINE(NETWORK_COMP,HighPrio);
297 DEBUG_MSG(NETWORK_COMP, HighPrio,
298 csprintf("switch: %d enqueuing net msg from "
299 "inport[%d][%d] to outport [%d][%d] time: %d.",

--- 36 unchanged lines hidden ---