PerfectSwitch.cc (7454:3a3e8e8cce1b) | PerfectSwitch.cc (7780:42da07116e12) |
---|---|
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; --- 109 unchanged lines hidden (view full) --- 118 119PerfectSwitch::~PerfectSwitch() 120{ 121} 122 123void 124PerfectSwitch::wakeup() 125{ | 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; --- 109 unchanged lines hidden (view full) --- 118 119PerfectSwitch::~PerfectSwitch() 120{ 121} 122 123void 124PerfectSwitch::wakeup() 125{ |
126 DEBUG_EXPR(NETWORK_COMP, MedPrio, m_switch_id); | 126 DPRINTF(RubyNetwork, "m_switch_id: %d\n",m_switch_id); |
127 128 MsgPtr msg_ptr; 129 130 // Give the highest numbered link priority most of the time 131 m_wakeups_wo_switch++; 132 int highest_prio_vnet = m_virtual_networks-1; 133 int lowest_prio_vnet = 0; 134 int decrementer = 1; --- 28 unchanged lines hidden (view full) --- 163 } 164 165 // temporary vectors to store the routing results 166 vector<LinkID> output_links; 167 vector<NetDest> output_link_destinations; 168 169 // Is there a message waiting? 170 while (m_in[incoming][vnet]->isReady()) { | 127 128 MsgPtr msg_ptr; 129 130 // Give the highest numbered link priority most of the time 131 m_wakeups_wo_switch++; 132 int highest_prio_vnet = m_virtual_networks-1; 133 int lowest_prio_vnet = 0; 134 int decrementer = 1; --- 28 unchanged lines hidden (view full) --- 163 } 164 165 // temporary vectors to store the routing results 166 vector<LinkID> output_links; 167 vector<NetDest> output_link_destinations; 168 169 // Is there a message waiting? 170 while (m_in[incoming][vnet]->isReady()) { |
171 DEBUG_EXPR(NETWORK_COMP, MedPrio, incoming); | 171 DPRINTF(RubyNetwork, "incoming: %d\n", incoming); |
172 173 // Peek at message 174 msg_ptr = m_in[incoming][vnet]->peekMsgPtr(); 175 net_msg_ptr = safe_cast<NetworkMessage*>(msg_ptr.get()); | 172 173 // Peek at message 174 msg_ptr = m_in[incoming][vnet]->peekMsgPtr(); 175 net_msg_ptr = safe_cast<NetworkMessage*>(msg_ptr.get()); |
176 DEBUG_EXPR(NETWORK_COMP, MedPrio, *net_msg_ptr); | 176 DPRINTF(RubyNetwork, "Message: %s\n", (*net_msg_ptr)); |
177 178 output_links.clear(); 179 output_link_destinations.clear(); 180 NetDest msg_dsts = 181 net_msg_ptr->getInternalDestination(); 182 183 // Unfortunately, the token-protocol sends some 184 // zero-destination messages, so this assert isn't valid --- 26 unchanged lines hidden (view full) --- 211 sort(m_link_order.begin(), m_link_order.end()); 212 } 213 } 214 215 for (int i = 0; i < m_routing_table.size(); i++) { 216 // pick the next link to look at 217 int link = m_link_order[i].m_link; 218 NetDest dst = m_routing_table[link]; | 177 178 output_links.clear(); 179 output_link_destinations.clear(); 180 NetDest msg_dsts = 181 net_msg_ptr->getInternalDestination(); 182 183 // Unfortunately, the token-protocol sends some 184 // zero-destination messages, so this assert isn't valid --- 26 unchanged lines hidden (view full) --- 211 sort(m_link_order.begin(), m_link_order.end()); 212 } 213 } 214 215 for (int i = 0; i < m_routing_table.size(); i++) { 216 // pick the next link to look at 217 int link = m_link_order[i].m_link; 218 NetDest dst = m_routing_table[link]; |
219 DEBUG_EXPR(NETWORK_COMP, MedPrio, dst); | 219 DPRINTF(RubyNetwork, "dst: %s\n", dst); |
220 221 if (!msg_dsts.intersectionIsNotEmpty(dst)) 222 continue; 223 224 // Remember what link we're using 225 output_links.push_back(link); 226 227 // Need to remember which destinations need this --- 13 unchanged lines hidden (view full) --- 241 //assert(output_links.size() > 0); 242 243 // Check for resources - for all outgoing queues 244 bool enough = true; 245 for (int i = 0; i < output_links.size(); i++) { 246 int outgoing = output_links[i]; 247 if (!m_out[outgoing][vnet]->areNSlotsAvailable(1)) 248 enough = false; | 220 221 if (!msg_dsts.intersectionIsNotEmpty(dst)) 222 continue; 223 224 // Remember what link we're using 225 output_links.push_back(link); 226 227 // Need to remember which destinations need this --- 13 unchanged lines hidden (view full) --- 241 //assert(output_links.size() > 0); 242 243 // Check for resources - for all outgoing queues 244 bool enough = true; 245 for (int i = 0; i < output_links.size(); i++) { 246 int outgoing = output_links[i]; 247 if (!m_out[outgoing][vnet]->areNSlotsAvailable(1)) 248 enough = false; |
249 DEBUG_MSG(NETWORK_COMP, HighPrio, 250 "checking if node is blocked"); 251 DEBUG_EXPR(NETWORK_COMP, HighPrio, outgoing); 252 DEBUG_EXPR(NETWORK_COMP, HighPrio, vnet); 253 DEBUG_EXPR(NETWORK_COMP, HighPrio, enough); | 249 DPRINTF(RubyNetwork, "Checking if node is blocked\n" 250 "outgoing: %d, vnet: %d, enough: %d\n", 251 outgoing, vnet, enough); |
254 } 255 256 // There were not enough resources 257 if (!enough) { 258 g_eventQueue_ptr->scheduleEvent(this, 1); | 252 } 253 254 // There were not enough resources 255 if (!enough) { 256 g_eventQueue_ptr->scheduleEvent(this, 1); |
259 DEBUG_MSG(NETWORK_COMP, HighPrio, 260 "Can't deliver message since a node is blocked"); 261 DEBUG_EXPR(NETWORK_COMP, HighPrio, *net_msg_ptr); | 257 DPRINTF(RubyNetwork, "Can't deliver message since a node " 258 "is blocked\n" 259 "Message: %s\n", (*net_msg_ptr)); |
262 break; // go to next incoming port 263 } 264 265 MsgPtr unmodified_msg_ptr; 266 267 if (output_links.size() > 1) { 268 // If we are sending this message down more than 269 // one link (size>1), we need to make a copy of --- 20 unchanged lines hidden (view full) --- 290 // Change the internal destination set of the 291 // message so it knows which destinations this 292 // link is responsible for. 293 net_msg_ptr = safe_cast<NetworkMessage*>(msg_ptr.get()); 294 net_msg_ptr->getInternalDestination() = 295 output_link_destinations[i]; 296 297 // Enqeue msg | 260 break; // go to next incoming port 261 } 262 263 MsgPtr unmodified_msg_ptr; 264 265 if (output_links.size() > 1) { 266 // If we are sending this message down more than 267 // one link (size>1), we need to make a copy of --- 20 unchanged lines hidden (view full) --- 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.get()); 292 net_msg_ptr->getInternalDestination() = 293 output_link_destinations[i]; 294 295 // Enqeue msg |
298 DEBUG_NEWLINE(NETWORK_COMP,HighPrio); 299 DEBUG_MSG(NETWORK_COMP, HighPrio, 300 csprintf("switch: %d enqueuing net msg from " 301 "inport[%d][%d] to outport [%d][%d] time: %d.", | 296 DPRINTF(RubyNetwork, "Switch: %d enqueuing net msg from " 297 "inport[%d][%d] to outport [%d][%d] time: %lld.\n", |
302 m_switch_id, incoming, vnet, outgoing, vnet, | 298 m_switch_id, incoming, vnet, outgoing, vnet, |
303 g_eventQueue_ptr->getTime())); 304 DEBUG_NEWLINE(NETWORK_COMP,HighPrio); | 299 g_eventQueue_ptr->getTime()); |
305 306 m_out[outgoing][vnet]->enqueue(msg_ptr); 307 } 308 309 // Dequeue msg 310 m_in[incoming][vnet]->pop(); 311 } 312 } --- 25 unchanged lines hidden --- | 300 301 m_out[outgoing][vnet]->enqueue(msg_ptr); 302 } 303 304 // Dequeue msg 305 m_in[incoming][vnet]->pop(); 306 } 307 } --- 25 unchanged lines hidden --- |