Switch.cc (9499:b03b556a8fbb) | Switch.cc (9508:dde110931867) |
---|---|
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; --- 53 unchanged lines hidden (view full) --- 62{ 63 BasicRouter::init(); 64 m_perfect_switch_ptr->init(m_network_ptr); 65} 66 67void 68Switch::addInPort(const vector<MessageBuffer*>& in) 69{ | 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; --- 53 unchanged lines hidden (view full) --- 62{ 63 BasicRouter::init(); 64 m_perfect_switch_ptr->init(m_network_ptr); 65} 66 67void 68Switch::addInPort(const vector<MessageBuffer*>& in) 69{ |
70 m_perfect_switch_ptr->addInPort(in, this); | 70 m_perfect_switch_ptr->addInPort(in); 71 72 for (int i = 0; i < in.size(); i++) { 73 in[i]->setReceiver(this); 74 } |
71} 72 73void 74Switch::addOutPort(const vector<MessageBuffer*>& out, 75 const NetDest& routing_table_entry, Cycles link_latency, int bw_multiplier) 76{ 77 // Create a throttle 78 Throttle* throttle_ptr = new Throttle(m_id, m_throttles.size(), 79 link_latency, bw_multiplier, m_network_ptr->getEndpointBandwidth(), 80 this); 81 m_throttles.push_back(throttle_ptr); 82 83 // Create one buffer per vnet (these are intermediaryQueues) 84 vector<MessageBuffer*> intermediateBuffers; 85 for (int i = 0; i < out.size(); i++) { | 75} 76 77void 78Switch::addOutPort(const vector<MessageBuffer*>& out, 79 const NetDest& routing_table_entry, Cycles link_latency, int bw_multiplier) 80{ 81 // Create a throttle 82 Throttle* throttle_ptr = new Throttle(m_id, m_throttles.size(), 83 link_latency, bw_multiplier, m_network_ptr->getEndpointBandwidth(), 84 this); 85 m_throttles.push_back(throttle_ptr); 86 87 // Create one buffer per vnet (these are intermediaryQueues) 88 vector<MessageBuffer*> intermediateBuffers; 89 for (int i = 0; i < out.size(); i++) { |
90 out[i]->setSender(this); 91 |
|
86 MessageBuffer* buffer_ptr = new MessageBuffer; 87 // Make these queues ordered 88 buffer_ptr->setOrdering(true); 89 if (m_network_ptr->getBufferSize() > 0) { 90 buffer_ptr->resize(m_network_ptr->getBufferSize()); 91 } | 92 MessageBuffer* buffer_ptr = new MessageBuffer; 93 // Make these queues ordered 94 buffer_ptr->setOrdering(true); 95 if (m_network_ptr->getBufferSize() > 0) { 96 buffer_ptr->resize(m_network_ptr->getBufferSize()); 97 } |
98 |
|
92 intermediateBuffers.push_back(buffer_ptr); 93 m_buffers_to_free.push_back(buffer_ptr); | 99 intermediateBuffers.push_back(buffer_ptr); 100 m_buffers_to_free.push_back(buffer_ptr); |
101 102 buffer_ptr->setSender(this); 103 buffer_ptr->setReceiver(this); |
|
94 } 95 96 // Hook the queues to the PerfectSwitch 97 m_perfect_switch_ptr->addOutPort(intermediateBuffers, routing_table_entry); 98 99 // Hook the queues to the Throttle | 104 } 105 106 // Hook the queues to the PerfectSwitch 107 m_perfect_switch_ptr->addOutPort(intermediateBuffers, routing_table_entry); 108 109 // Hook the queues to the Throttle |
100 throttle_ptr->addLinks(intermediateBuffers, out, this); | 110 throttle_ptr->addLinks(intermediateBuffers, out); |
101} 102 103void 104Switch::clearRoutingTables() 105{ 106 m_perfect_switch_ptr->clearRoutingTables(); 107} 108 --- 140 unchanged lines hidden --- | 111} 112 113void 114Switch::clearRoutingTables() 115{ 116 m_perfect_switch_ptr->clearRoutingTables(); 117} 118 --- 140 unchanged lines hidden --- |