SimpleNetwork.cc (11047:dcf729f0bbfa) | SimpleNetwork.cc (11049:dfb0aa3f0649) |
---|---|
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; --- 24 unchanged lines hidden (view full) --- 33#include "base/stl_helpers.hh" 34#include "mem/ruby/common/NetDest.hh" 35#include "mem/ruby/network/MessageBuffer.hh" 36#include "mem/ruby/network/simple/SimpleLink.hh" 37#include "mem/ruby/network/simple/SimpleNetwork.hh" 38#include "mem/ruby/network/simple/Switch.hh" 39#include "mem/ruby/network/simple/Throttle.hh" 40#include "mem/ruby/profiler/Profiler.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; --- 24 unchanged lines hidden (view full) --- 33#include "base/stl_helpers.hh" 34#include "mem/ruby/common/NetDest.hh" 35#include "mem/ruby/network/MessageBuffer.hh" 36#include "mem/ruby/network/simple/SimpleLink.hh" 37#include "mem/ruby/network/simple/SimpleNetwork.hh" 38#include "mem/ruby/network/simple/Switch.hh" 39#include "mem/ruby/network/simple/Throttle.hh" 40#include "mem/ruby/profiler/Profiler.hh" |
41#include "mem/ruby/system/System.hh" |
|
41 42using namespace std; 43using m5::stl_helpers::deletePointers; 44 45SimpleNetwork::SimpleNetwork(const Params *p) | 42 43using namespace std; 44using m5::stl_helpers::deletePointers; 45 46SimpleNetwork::SimpleNetwork(const Params *p) |
46 : Network(p), m_buffer_size(p->buffer_size), 47 m_endpoint_bandwidth(p->endpoint_bandwidth), 48 m_adaptive_routing(p->adaptive_routing) | 47 : Network(p) |
49{ | 48{ |
49 m_buffer_size = p->buffer_size; 50 m_endpoint_bandwidth = p->endpoint_bandwidth; 51 m_adaptive_routing = p->adaptive_routing; 52 53 // Note: the parent Network Object constructor is called before the 54 // SimpleNetwork child constructor. Therefore, the member variables 55 // used below should already be initialized. 56 m_endpoint_switches.resize(m_nodes); 57 |
|
50 // record the routers 51 for (vector<BasicRouter*>::const_iterator i = p->routers.begin(); 52 i != p->routers.end(); ++i) { 53 Switch* s = safe_cast<Switch*>(*i); 54 m_switches.push_back(s); 55 s->init_net_ptr(this); 56 } 57 --- 28 unchanged lines hidden (view full) --- 86 assert(src < m_switches.size()); 87 assert(m_switches[src] != NULL); 88 89 SimpleExtLink *simple_link = safe_cast<SimpleExtLink*>(link); 90 91 m_switches[src]->addOutPort(m_fromNetQueues[dest], routing_table_entry, 92 simple_link->m_latency, 93 simple_link->m_bw_multiplier); | 58 // record the routers 59 for (vector<BasicRouter*>::const_iterator i = p->routers.begin(); 60 i != p->routers.end(); ++i) { 61 Switch* s = safe_cast<Switch*>(*i); 62 m_switches.push_back(s); 63 s->init_net_ptr(this); 64 } 65 --- 28 unchanged lines hidden (view full) --- 94 assert(src < m_switches.size()); 95 assert(m_switches[src] != NULL); 96 97 SimpleExtLink *simple_link = safe_cast<SimpleExtLink*>(link); 98 99 m_switches[src]->addOutPort(m_fromNetQueues[dest], routing_table_entry, 100 simple_link->m_latency, 101 simple_link->m_bw_multiplier); |
102 103 m_endpoint_switches[dest] = m_switches[src]; |
|
94} 95 96// From an endpoint node to a switch 97void 98SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link, 99 LinkDirection direction, 100 const NetDest& routing_table_entry) 101{ --- 116 unchanged lines hidden (view full) --- 218SimpleNetwork::functionalRead(Packet *pkt) 219{ 220 for (unsigned int i = 0; i < m_switches.size(); i++) { 221 if (m_switches[i]->functionalRead(pkt)) { 222 return true; 223 } 224 } 225 | 104} 105 106// From an endpoint node to a switch 107void 108SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link, 109 LinkDirection direction, 110 const NetDest& routing_table_entry) 111{ --- 116 unchanged lines hidden (view full) --- 228SimpleNetwork::functionalRead(Packet *pkt) 229{ 230 for (unsigned int i = 0; i < m_switches.size(); i++) { 231 if (m_switches[i]->functionalRead(pkt)) { 232 return true; 233 } 234 } 235 |
236 for (unsigned int i = 0; i < m_int_link_buffers.size(); ++i) { 237 if (m_int_link_buffers[i]->functionalRead(pkt)) { 238 return true; 239 } 240 } 241 |
|
226 return false; 227} 228 229uint32_t 230SimpleNetwork::functionalWrite(Packet *pkt) 231{ 232 uint32_t num_functional_writes = 0; 233 234 for (unsigned int i = 0; i < m_switches.size(); i++) { 235 num_functional_writes += m_switches[i]->functionalWrite(pkt); 236 } 237 238 for (unsigned int i = 0; i < m_int_link_buffers.size(); ++i) { 239 num_functional_writes += m_int_link_buffers[i]->functionalWrite(pkt); 240 } 241 return num_functional_writes; 242} | 242 return false; 243} 244 245uint32_t 246SimpleNetwork::functionalWrite(Packet *pkt) 247{ 248 uint32_t num_functional_writes = 0; 249 250 for (unsigned int i = 0; i < m_switches.size(); i++) { 251 num_functional_writes += m_switches[i]->functionalWrite(pkt); 252 } 253 254 for (unsigned int i = 0; i < m_int_link_buffers.size(); ++i) { 255 num_functional_writes += m_int_link_buffers[i]->functionalWrite(pkt); 256 } 257 return num_functional_writes; 258} |