Network.hh revision 7055
16145Snate@binkert.org/* 26145Snate@binkert.org * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 36145Snate@binkert.org * All rights reserved. 46145Snate@binkert.org * 56145Snate@binkert.org * Redistribution and use in source and binary forms, with or without 66145Snate@binkert.org * modification, are permitted provided that the following conditions are 76145Snate@binkert.org * met: redistributions of source code must retain the above copyright 86145Snate@binkert.org * notice, this list of conditions and the following disclaimer; 96145Snate@binkert.org * redistributions in binary form must reproduce the above copyright 106145Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 116145Snate@binkert.org * documentation and/or other materials provided with the distribution; 126145Snate@binkert.org * neither the name of the copyright holders nor the names of its 136145Snate@binkert.org * contributors may be used to endorse or promote products derived from 146145Snate@binkert.org * this software without specific prior written permission. 156145Snate@binkert.org * 166145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176145Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186145Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196145Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206145Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216145Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226145Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236145Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246145Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256145Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266145Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276145Snate@binkert.org */ 286145Snate@binkert.org 296145Snate@binkert.org/* 307054Snate@binkert.org * The Network class is the base class for classes that implement the 317054Snate@binkert.org * interconnection network between components (processor/cache 327054Snate@binkert.org * components and memory/directory components). The interconnection 337054Snate@binkert.org * network as described here is not a physical network, but a 347054Snate@binkert.org * programming concept used to implement all communication between 357054Snate@binkert.org * components. Thus parts of this 'network' will model the on-chip 367054Snate@binkert.org * connections between cache controllers and directory controllers as 377054Snate@binkert.org * well as the links between chip and network switches. 387054Snate@binkert.org */ 396145Snate@binkert.org 407054Snate@binkert.org#ifndef __MEM_RUBY_NETWORK_NETWORK_HH__ 417054Snate@binkert.org#define __MEM_RUBY_NETWORK_NETWORK_HH__ 426145Snate@binkert.org 437055Snate@binkert.org#include <iostream> 447055Snate@binkert.org#include <string> 457055Snate@binkert.org 467054Snate@binkert.org#include "mem/protocol/MessageSizeType.hh" 476154Snate@binkert.org#include "mem/ruby/common/Global.hh" 486154Snate@binkert.org#include "mem/ruby/system/NodeID.hh" 496285Snate@binkert.org#include "mem/ruby/system/System.hh" 507054Snate@binkert.org#include "params/RubyNetwork.hh" 516876Ssteve.reinhardt@amd.com#include "sim/sim_object.hh" 526145Snate@binkert.org 536145Snate@binkert.orgclass NetDest; 546145Snate@binkert.orgclass MessageBuffer; 556145Snate@binkert.orgclass Throttle; 566285Snate@binkert.orgclass Topology; 576145Snate@binkert.org 587054Snate@binkert.orgclass Network : public SimObject 597054Snate@binkert.org{ 607054Snate@binkert.org public: 616876Ssteve.reinhardt@amd.com typedef RubyNetworkParams Params; 626876Ssteve.reinhardt@amd.com Network(const Params *p); 637054Snate@binkert.org virtual ~Network() {} 646145Snate@binkert.org 657054Snate@binkert.org virtual void init(); 666145Snate@binkert.org 677054Snate@binkert.org int getBufferSize() { return m_buffer_size; } 687054Snate@binkert.org int getNumberOfVirtualNetworks() { return m_virtual_networks; } 697054Snate@binkert.org int getEndpointBandwidth() { return m_endpoint_bandwidth; } 707054Snate@binkert.org bool getAdaptiveRouting() {return m_adaptive_routing; } 717054Snate@binkert.org int getLinkLatency() { return m_link_latency; } 727054Snate@binkert.org int MessageSizeType_to_int(MessageSizeType size_type); 736493STushar.Krishna@amd.com 747054Snate@binkert.org // returns the queue requested for the given component 757054Snate@binkert.org virtual MessageBuffer* getToNetQueue(NodeID id, bool ordered, 767054Snate@binkert.org int netNumber) = 0; 777054Snate@binkert.org virtual MessageBuffer* getFromNetQueue(NodeID id, bool ordered, 787054Snate@binkert.org int netNumber) = 0; 797054Snate@binkert.org virtual const Vector<Throttle*>* getThrottles(NodeID id) const; 807054Snate@binkert.org virtual int getNumNodes() {return 1;} 816145Snate@binkert.org 827054Snate@binkert.org virtual void makeOutLink(SwitchID src, NodeID dest, 837054Snate@binkert.org const NetDest& routing_table_entry, int link_latency, int link_weight, 847054Snate@binkert.org int bw_multiplier, bool isReconfiguration) = 0; 857054Snate@binkert.org virtual void makeInLink(SwitchID src, NodeID dest, 867054Snate@binkert.org const NetDest& routing_table_entry, int link_latency, 877054Snate@binkert.org int bw_multiplier, bool isReconfiguration) = 0; 887054Snate@binkert.org virtual void makeInternalLink(SwitchID src, NodeID dest, 897054Snate@binkert.org const NetDest& routing_table_entry, int link_latency, int link_weight, 907054Snate@binkert.org int bw_multiplier, bool isReconfiguration) = 0; 916145Snate@binkert.org 927054Snate@binkert.org virtual void reset() = 0; 936145Snate@binkert.org 947055Snate@binkert.org virtual void printStats(std::ostream& out) const = 0; 957054Snate@binkert.org virtual void clearStats() = 0; 967055Snate@binkert.org virtual void printConfig(std::ostream& out) const = 0; 977055Snate@binkert.org virtual void print(std::ostream& out) const = 0; 986145Snate@binkert.org 997054Snate@binkert.org protected: 1007054Snate@binkert.org // Private copy constructor and assignment operator 1017054Snate@binkert.org Network(const Network& obj); 1027054Snate@binkert.org Network& operator=(const Network& obj); 1036145Snate@binkert.org 1047054Snate@binkert.org protected: 1057055Snate@binkert.org const std::string m_name; 1067054Snate@binkert.org int m_nodes; 1077054Snate@binkert.org int m_virtual_networks; 1087054Snate@binkert.org int m_buffer_size; 1097054Snate@binkert.org int m_endpoint_bandwidth; 1107054Snate@binkert.org Topology* m_topology_ptr; 1117054Snate@binkert.org bool m_adaptive_routing; 1127054Snate@binkert.org int m_link_latency; 1137054Snate@binkert.org int m_control_msg_size; 1147054Snate@binkert.org int m_data_msg_size; 1156145Snate@binkert.org}; 1166145Snate@binkert.org 1177055Snate@binkert.orginline std::ostream& 1187055Snate@binkert.orgoperator<<(std::ostream& out, const Network& obj) 1196145Snate@binkert.org{ 1207054Snate@binkert.org obj.print(out); 1217055Snate@binkert.org out << std::flush; 1227054Snate@binkert.org return out; 1236145Snate@binkert.org} 1246145Snate@binkert.org 1257054Snate@binkert.org#endif // __MEM_RUBY_NETWORK_NETWORK_HH__ 126