PerfectSwitch.cc (9230:33eb3c8a98b9) PerfectSwitch.cc (9274:ba635023d4bb)
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 <algorithm>
30
31#include "base/cast.hh"
32#include "debug/RubyNetwork.hh"
33#include "mem/ruby/buffers/MessageBuffer.hh"
34#include "mem/ruby/network/simple/PerfectSwitch.hh"
35#include "mem/ruby/network/simple/SimpleNetwork.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 <algorithm>
30
31#include "base/cast.hh"
32#include "debug/RubyNetwork.hh"
33#include "mem/ruby/buffers/MessageBuffer.hh"
34#include "mem/ruby/network/simple/PerfectSwitch.hh"
35#include "mem/ruby/network/simple/SimpleNetwork.hh"
36#include "mem/ruby/profiler/Profiler.hh"
36#include "mem/ruby/network/simple/Switch.hh"
37#include "mem/ruby/slicc_interface/NetworkMessage.hh"
37#include "mem/ruby/slicc_interface/NetworkMessage.hh"
38#include "mem/ruby/system/System.hh"
39
40using namespace std;
41
42const int PRIORITY_SWITCH_LIMIT = 128;
43
44// Operator for helper class
45bool
46operator<(const LinkOrder& l1, const LinkOrder& l2)
47{
48 return (l1.m_value < l2.m_value);
49}
50
38
39using namespace std;
40
41const int PRIORITY_SWITCH_LIMIT = 128;
42
43// Operator for helper class
44bool
45operator<(const LinkOrder& l1, const LinkOrder& l2)
46{
47 return (l1.m_value < l2.m_value);
48}
49
51PerfectSwitch::PerfectSwitch(SwitchID sid, SimpleNetwork* network_ptr)
52 : Consumer(network_ptr)
50PerfectSwitch::PerfectSwitch(SwitchID sid, Switch *sw, uint32_t virt_nets)
51 : Consumer(sw)
53{
52{
54 m_virtual_networks = network_ptr->getNumberOfVirtualNetworks();
55 m_switch_id = sid;
56 m_round_robin_start = 0;
53 m_switch_id = sid;
54 m_round_robin_start = 0;
57 m_network_ptr = network_ptr;
58 m_wakeups_wo_switch = 0;
55 m_wakeups_wo_switch = 0;
56 m_virtual_networks = virt_nets;
57}
59
58
59void
60PerfectSwitch::init(SimpleNetwork *network_ptr)
61{
62 m_network_ptr = network_ptr;
63
60 for(int i = 0;i < m_virtual_networks;++i)
61 {
62 m_pending_message_count.push_back(0);
63 }
64}
65
66void
67PerfectSwitch::addInPort(const vector<MessageBuffer*>& in)

--- 275 unchanged lines hidden ---
64 for(int i = 0;i < m_virtual_networks;++i)
65 {
66 m_pending_message_count.push_back(0);
67 }
68}
69
70void
71PerfectSwitch::addInPort(const vector<MessageBuffer*>& in)

--- 275 unchanged lines hidden ---