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; --- 19 unchanged lines hidden (view full) --- 28 29#include <numeric> 30 31#include "base/stl_helpers.hh" 32#include "mem/protocol/MessageSizeType.hh" 33#include "mem/protocol/Protocol.hh" 34#include "mem/ruby/buffers/MessageBuffer.hh" 35#include "mem/ruby/network/simple/PerfectSwitch.hh" |
36#include "mem/ruby/network/simple/SimpleNetwork.hh" |
37#include "mem/ruby/network/simple/Switch.hh" 38#include "mem/ruby/network/simple/Throttle.hh" |
39 40using namespace std; 41using m5::stl_helpers::deletePointers; 42using m5::stl_helpers::operator<<; 43 44Switch::Switch(SwitchID sid, SimpleNetwork* network_ptr) 45{ 46 m_perfect_switch_ptr = new PerfectSwitch(sid, network_ptr); --- 17 unchanged lines hidden (view full) --- 64 m_perfect_switch_ptr->addInPort(in); 65} 66 67void 68Switch::addOutPort(const vector<MessageBuffer*>& out, 69 const NetDest& routing_table_entry, int link_latency, int bw_multiplier) 70{ 71 Throttle* throttle_ptr = NULL; |
72 SimpleNetwork* net_ptr = 73 safe_cast<SimpleNetwork*>(RubySystem::getNetwork()); |
74 75 // Create a throttle 76 throttle_ptr = new Throttle(m_switch_id, m_throttles.size(), link_latency, |
77 bw_multiplier, net_ptr->getEndpointBandwidth()); |
78 m_throttles.push_back(throttle_ptr); 79 80 // Create one buffer per vnet (these are intermediaryQueues) 81 vector<MessageBuffer*> intermediateBuffers; 82 for (int i = 0; i < out.size(); i++) { 83 MessageBuffer* buffer_ptr = new MessageBuffer; 84 // Make these queues ordered 85 buffer_ptr->setOrdering(true); |
86 if (net_ptr->getBufferSize() > 0) { 87 buffer_ptr->resize(net_ptr->getBufferSize()); 88 } 89 intermediateBuffers.push_back(buffer_ptr); 90 m_buffers_to_free.push_back(buffer_ptr); 91 } 92 93 // Hook the queues to the PerfectSwitch --- 134 unchanged lines hidden --- |