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); 71 72 for (int i = 0; i < in.size(); i++) { 73 in[i]->setReceiver(this); 74 } |
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 |
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 |
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); |
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 |
110 throttle_ptr->addLinks(intermediateBuffers, out); |
111} 112 113void 114Switch::clearRoutingTables() 115{ 116 m_perfect_switch_ptr->clearRoutingTables(); 117} 118 --- 140 unchanged lines hidden --- |