Deleted Added
sdiff udiff text old ( 10303:71e0934af9f1 ) 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;

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

88 const NetDest& routing_table_entry)
89{
90 assert(dest < m_nodes);
91 assert(src < m_switches.size());
92 assert(m_switches[src] != NULL);
93
94 SimpleExtLink *simple_link = safe_cast<SimpleExtLink*>(link);
95
96 m_switches[src]->addOutPort(m_fromNetQueues[dest], routing_table_entry,
97 simple_link->m_latency,
98 simple_link->m_bw_multiplier);
99
100 m_endpoint_switches[dest] = m_switches[src];
101}
102
103// From an endpoint node to a switch
104void
105SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
106 LinkDirection direction,

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

112
113// From a switch to a switch
114void
115SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
116 LinkDirection direction,
117 const NetDest& routing_table_entry)
118{
119 // Create a set of new MessageBuffers
120 std::map<int, MessageBuffer*> queues;
121 for (int i = 0; i < m_virtual_networks; i++) {
122 // allocate a buffer
123 MessageBuffer* buffer_ptr = new MessageBuffer;
124 buffer_ptr->setOrdering(true);
125
126 if (m_buffer_size > 0) {
127 buffer_ptr->resize(m_buffer_size);
128 }
129
130 queues[i] = buffer_ptr;
131 // remember to deallocate it
132 m_buffers_to_free.push_back(buffer_ptr);
133 }
134
135 // Connect it to the two switches
136 SimpleIntLink *simple_link = safe_cast<SimpleIntLink*>(link);
137
138 m_switches[dest]->addInPort(queues);
139 m_switches[src]->addOutPort(queues, routing_table_entry,
140 simple_link->m_latency,
141 simple_link->m_bw_multiplier);
142}
143
144void
145SimpleNetwork::checkNetworkAllocation(NodeID id, bool ordered, int network_num)
146{
147 assert(id < m_nodes);
148 assert(network_num < m_virtual_networks);
149
150 if (ordered) {
151 m_ordered[network_num] = true;
152 }
153 m_in_use[network_num] = true;
154}
155
156void
157SimpleNetwork::setToNetQueue(NodeID id, bool ordered, int network_num,
158 std::string vnet_type, MessageBuffer *b)
159{
160 checkNetworkAllocation(id, ordered, network_num);
161 m_toNetQueues[id][network_num] = b;
162}
163
164void
165SimpleNetwork::setFromNetQueue(NodeID id, bool ordered, int network_num,
166 std::string vnet_type, MessageBuffer *b)
167{
168 checkNetworkAllocation(id, ordered, network_num);
169 m_fromNetQueues[id][network_num] = b;
170}
171
172void
173SimpleNetwork::regStats()
174{
175 for (MessageSizeType type = MessageSizeType_FIRST;
176 type < MessageSizeType_NUM; ++type) {
177 m_msg_counts[(unsigned int) type]

--- 77 unchanged lines hidden ---