Switch.cc (11049:dfb0aa3f0649) Switch.cc (11111:6da33e720481)
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;

--- 55 unchanged lines hidden (view full) ---

64 BasicRouter::init();
65 m_perfect_switch->init(m_network_ptr);
66}
67
68void
69Switch::addInPort(const vector<MessageBuffer*>& in)
70{
71 m_perfect_switch->addInPort(in);
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;

--- 55 unchanged lines hidden (view full) ---

64 BasicRouter::init();
65 m_perfect_switch->init(m_network_ptr);
66}
67
68void
69Switch::addInPort(const vector<MessageBuffer*>& in)
70{
71 m_perfect_switch->addInPort(in);
72
73 for (auto& it : in) {
74 if (it != nullptr) {
75 it->setReceiver(this);
76 }
77 }
78}
79
80void
81Switch::addOutPort(const vector<MessageBuffer*>& out,
82 const NetDest& routing_table_entry,
83 Cycles link_latency, int bw_multiplier)
84{
85 // Create a throttle

--- 4 unchanged lines hidden (view full) ---

90 this);
91
92 m_throttles.push_back(throttle_ptr);
93
94 // Create one buffer per vnet (these are intermediaryQueues)
95 vector<MessageBuffer*> intermediateBuffers;
96
97 for (int i = 0; i < out.size(); ++i) {
72}
73
74void
75Switch::addOutPort(const vector<MessageBuffer*>& out,
76 const NetDest& routing_table_entry,
77 Cycles link_latency, int bw_multiplier)
78{
79 // Create a throttle

--- 4 unchanged lines hidden (view full) ---

84 this);
85
86 m_throttles.push_back(throttle_ptr);
87
88 // Create one buffer per vnet (these are intermediaryQueues)
89 vector<MessageBuffer*> intermediateBuffers;
90
91 for (int i = 0; i < out.size(); ++i) {
98 if (out[i] != nullptr) {
99 out[i]->setSender(this);
100 }
101
102 assert(m_num_connected_buffers < m_port_buffers.size());
103 MessageBuffer* buffer_ptr = m_port_buffers[m_num_connected_buffers];
104 m_num_connected_buffers++;
105 intermediateBuffers.push_back(buffer_ptr);
92 assert(m_num_connected_buffers < m_port_buffers.size());
93 MessageBuffer* buffer_ptr = m_port_buffers[m_num_connected_buffers];
94 m_num_connected_buffers++;
95 intermediateBuffers.push_back(buffer_ptr);
106
107 buffer_ptr->setSender(this);
108 buffer_ptr->setReceiver(this);
109 }
110
111 // Hook the queues to the PerfectSwitch
112 m_perfect_switch->addOutPort(intermediateBuffers, routing_table_entry);
113
114 // Hook the queues to the Throttle
115 throttle_ptr->addLinks(intermediateBuffers, out);
116}

--- 95 unchanged lines hidden ---
96 }
97
98 // Hook the queues to the PerfectSwitch
99 m_perfect_switch->addOutPort(intermediateBuffers, routing_table_entry);
100
101 // Hook the queues to the Throttle
102 throttle_ptr->addLinks(intermediateBuffers, out);
103}

--- 95 unchanged lines hidden ---