Deleted Added
sdiff udiff text old ( 10301:44839e8febbd ) new ( 10311:ad9c042dce54 )
full compact
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;

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

59void
60Switch::init()
61{
62 BasicRouter::init();
63 m_perfect_switch->init(m_network_ptr);
64}
65
66void
67Switch::addInPort(const vector<MessageBuffer*>& in)
68{
69 m_perfect_switch->addInPort(in);
70
71 for (int i = 0; i < in.size(); i++) {
72 in[i]->setReceiver(this);
73 }
74}
75
76void
77Switch::addOutPort(const vector<MessageBuffer*>& out,
78 const NetDest& routing_table_entry, Cycles link_latency, int bw_multiplier)
79{
80 // Create a throttle
81 Throttle* throttle_ptr = new Throttle(m_id, m_throttles.size(),
82 link_latency, bw_multiplier, m_network_ptr->getEndpointBandwidth(),
83 this);
84 m_throttles.push_back(throttle_ptr);
85
86 // Create one buffer per vnet (these are intermediaryQueues)
87 vector<MessageBuffer*> intermediateBuffers;
88 for (int i = 0; i < out.size(); i++) {
89 out[i]->setSender(this);
90
91 MessageBuffer* buffer_ptr = new MessageBuffer;
92 // Make these queues ordered
93 buffer_ptr->setOrdering(true);
94 if (m_network_ptr->getBufferSize() > 0) {
95 buffer_ptr->resize(m_network_ptr->getBufferSize());
96 }
97
98 intermediateBuffers.push_back(buffer_ptr);
99 m_buffers_to_free.push_back(buffer_ptr);
100
101 buffer_ptr->setSender(this);
102 buffer_ptr->setReceiver(this);
103 }
104
105 // Hook the queues to the PerfectSwitch
106 m_perfect_switch->addOutPort(intermediateBuffers, routing_table_entry);

--- 99 unchanged lines hidden ---