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" |
42 43using namespace std; 44using m5::stl_helpers::deletePointers; 45 46SimpleNetwork::SimpleNetwork(const Params *p) |
47 : Network(p) |
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 |
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]; |
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 |
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} |