Switch.cc (8229:78bf55f23338) Switch.cc (8259:36987780169e)
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"
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"
36#include "mem/ruby/network/simple/Switch.hh"
37#include "mem/ruby/network/simple/Throttle.hh"
37#include "mem/ruby/network/simple/Switch.hh"
38#include "mem/ruby/network/simple/Throttle.hh"
38#include "mem/ruby/network/Network.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;
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());
72
73 // Create a throttle
74 throttle_ptr = new Throttle(m_switch_id, m_throttles.size(), link_latency,
74
75 // Create a throttle
76 throttle_ptr = new Throttle(m_switch_id, m_throttles.size(), link_latency,
75 bw_multiplier);
77 bw_multiplier, net_ptr->getEndpointBandwidth());
76 m_throttles.push_back(throttle_ptr);
77
78 // Create one buffer per vnet (these are intermediaryQueues)
79 vector<MessageBuffer*> intermediateBuffers;
80 for (int i = 0; i < out.size(); i++) {
81 MessageBuffer* buffer_ptr = new MessageBuffer;
82 // Make these queues ordered
83 buffer_ptr->setOrdering(true);
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);
84 Network* net_ptr = RubySystem::getNetwork();
85 if (net_ptr->getBufferSize() > 0) {
86 buffer_ptr->resize(net_ptr->getBufferSize());
87 }
88 intermediateBuffers.push_back(buffer_ptr);
89 m_buffers_to_free.push_back(buffer_ptr);
90 }
91
92 // Hook the queues to the PerfectSwitch

--- 134 unchanged lines hidden ---
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 ---