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; --- 82 unchanged lines hidden (view full) --- 91void 92SimpleNetwork::init() 93{ 94 Network::init(); 95 96 // The topology pointer should have already been initialized in 97 // the parent class network constructor. 98 assert(m_topology_ptr != NULL); |
99 m_topology_ptr->createLinks(this); |
100} 101 102void 103SimpleNetwork::reset() 104{ 105 for (int node = 0; node < m_nodes; node++) { 106 for (int j = 0; j < m_virtual_networks; j++) { 107 m_toNetQueues[node][j]->clear(); --- 16 unchanged lines hidden (view full) --- 124 deletePointers(m_buffers_to_free); 125 // delete m_topology_ptr; 126} 127 128// From a switch to an endpoint node 129void 130SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link, 131 LinkDirection direction, |
132 const NetDest& routing_table_entry) |
133{ 134 assert(dest < m_nodes); 135 assert(src < m_switch_ptr_vector.size()); 136 assert(m_switch_ptr_vector[src] != NULL); 137 |
138 SimpleExtLink *simple_link = safe_cast<SimpleExtLink*>(link); 139 140 m_switch_ptr_vector[src]->addOutPort(m_fromNetQueues[dest], 141 routing_table_entry, 142 simple_link->m_latency, 143 simple_link->m_bw_multiplier); 144 145 m_endpoint_switches[dest] = m_switch_ptr_vector[src]; 146} 147 148// From an endpoint node to a switch 149void 150SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link, 151 LinkDirection direction, |
152 const NetDest& routing_table_entry) |
153{ 154 assert(src < m_nodes); |
155 m_switch_ptr_vector[dest]->addInPort(m_toNetQueues[src]); 156} 157 158// From a switch to a switch 159void 160SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, 161 LinkDirection direction, |
162 const NetDest& routing_table_entry) |
163{ |
164 // Create a set of new MessageBuffers 165 std::vector<MessageBuffer*> queues; 166 for (int i = 0; i < m_virtual_networks; i++) { 167 // allocate a buffer 168 MessageBuffer* buffer_ptr = new MessageBuffer; 169 buffer_ptr->setOrdering(true); 170 if (m_buffer_size > 0) { 171 buffer_ptr->resize(m_buffer_size); --- 174 unchanged lines hidden --- |