PerfectSwitch.cc (10348:c91b23c72d5e) | PerfectSwitch.cc (10370:4466307b8a2a) |
---|---|
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; --- 54 unchanged lines hidden (view full) --- 63 m_network_ptr = network_ptr; 64 65 for(int i = 0;i < m_virtual_networks;++i) { 66 m_pending_message_count.push_back(0); 67 } 68} 69 70void | 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; --- 54 unchanged lines hidden (view full) --- 63 m_network_ptr = network_ptr; 64 65 for(int i = 0;i < m_virtual_networks;++i) { 66 m_pending_message_count.push_back(0); 67 } 68} 69 70void |
71PerfectSwitch::addInPort(const map<int, MessageBuffer*>& in) | 71PerfectSwitch::addInPort(const vector<MessageBuffer*>& in) |
72{ 73 NodeID port = m_in.size(); 74 m_in.push_back(in); 75 | 72{ 73 NodeID port = m_in.size(); 74 m_in.push_back(in); 75 |
76 for (auto& it : in) { 77 it.second->setConsumer(this); | 76 for (int i = 0; i < in.size(); ++i) { 77 if (in[i] != nullptr) { 78 in[i]->setConsumer(this); |
78 | 79 |
79 string desc = csprintf("[Queue from port %s %s %s to PerfectSwitch]", 80 to_string(m_switch_id), to_string(port), to_string(it.first)); | 80 string desc = 81 csprintf("[Queue from port %s %s %s to PerfectSwitch]", 82 to_string(m_switch_id), to_string(port), 83 to_string(i)); |
81 | 84 |
82 it.second->setDescription(desc); 83 it.second->setIncomingLink(port); 84 it.second->setVnet(it.first); | 85 in[i]->setDescription(desc); 86 in[i]->setIncomingLink(port); 87 in[i]->setVnet(i); 88 } |
85 } 86} 87 88void | 89 } 90} 91 92void |
89PerfectSwitch::addOutPort(const map<int, MessageBuffer*>& out, 90 const NetDest& routing_table_entry) | 93PerfectSwitch::addOutPort(const vector<MessageBuffer*>& out, 94 const NetDest& routing_table_entry) |
91{ 92 // Setup link order 93 LinkOrder l; 94 l.m_value = 0; 95 l.m_link = m_out.size(); 96 m_link_order.push_back(l); 97 98 // Add to routing table --- 27 unchanged lines hidden (view full) --- 126 incoming = 0; 127 } 128 129 // temporary vectors to store the routing results 130 vector<LinkID> output_links; 131 vector<NetDest> output_link_destinations; 132 133 // Is there a message waiting? | 95{ 96 // Setup link order 97 LinkOrder l; 98 l.m_value = 0; 99 l.m_link = m_out.size(); 100 m_link_order.push_back(l); 101 102 // Add to routing table --- 27 unchanged lines hidden (view full) --- 130 incoming = 0; 131 } 132 133 // temporary vectors to store the routing results 134 vector<LinkID> output_links; 135 vector<NetDest> output_link_destinations; 136 137 // Is there a message waiting? |
134 auto it = m_in[incoming].find(vnet); 135 if (it == m_in[incoming].end()) | 138 if (m_in[incoming].size() <= vnet) { |
136 continue; | 139 continue; |
137 MessageBuffer *buffer = (*it).second; | 140 } |
138 | 141 |
142 MessageBuffer *buffer = m_in[incoming][vnet]; 143 if (buffer == nullptr) { 144 continue; 145 } 146 |
|
139 while (buffer->isReady()) { 140 DPRINTF(RubyNetwork, "incoming: %d\n", incoming); 141 142 // Peek at message 143 msg_ptr = buffer->peekMsgPtr(); 144 net_msg_ptr = safe_cast<NetworkMessage*>(msg_ptr.get()); 145 DPRINTF(RubyNetwork, "Message: %s\n", (*net_msg_ptr)); 146 --- 174 unchanged lines hidden --- | 147 while (buffer->isReady()) { 148 DPRINTF(RubyNetwork, "incoming: %d\n", incoming); 149 150 // Peek at message 151 msg_ptr = buffer->peekMsgPtr(); 152 net_msg_ptr = safe_cast<NetworkMessage*>(msg_ptr.get()); 153 DPRINTF(RubyNetwork, "Message: %s\n", (*net_msg_ptr)); 154 --- 174 unchanged lines hidden --- |