BasicLink.hh revision 6493
1545SN/A 21762SN/A/* 3545SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 4545SN/A * All rights reserved. 5545SN/A * 6545SN/A * Redistribution and use in source and binary forms, with or without 7545SN/A * modification, are permitted provided that the following conditions are 8545SN/A * met: redistributions of source code must retain the above copyright 9545SN/A * notice, this list of conditions and the following disclaimer; 10545SN/A * redistributions in binary form must reproduce the above copyright 11545SN/A * notice, this list of conditions and the following disclaimer in the 12545SN/A * documentation and/or other materials provided with the distribution; 13545SN/A * neither the name of the copyright holders nor the names of its 14545SN/A * contributors may be used to endorse or promote products derived from 15545SN/A * this software without specific prior written permission. 16545SN/A * 17545SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18545SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19545SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20545SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21545SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22545SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23545SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24545SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25545SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26545SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272665Ssaidi@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu */ 292665Ssaidi@eecs.umich.edu 30545SN/A/* 31545SN/A * Network.hh 321310SN/A * 331310SN/A * Description: The Network class is the base class for classes that 34545SN/A * implement the interconnection network between components 352384SN/A * (processor/cache components and memory/directory components). The 362542SN/A * interconnection network as described here is not a physical 372592SN/A * network, but a programming concept used to implement all 382384SN/A * communication between components. Thus parts of this 'network' 392489SN/A * will model the on-chip connections between cache controllers and 40545SN/A * directory controllers as well as the links between chip and network 411310SN/A * switches. 422384SN/A * 432489SN/A * $Id$ 442522SN/A * */ 45545SN/A 462489SN/A#ifndef NETWORK_H 472489SN/A#define NETWORK_H 482489SN/A 492489SN/A#include "mem/ruby/common/Global.hh" 502489SN/A#include "mem/ruby/system/NodeID.hh" 512489SN/A#include "mem/protocol/MessageSizeType.hh" 522489SN/A#include "mem/ruby/system/System.hh" 532489SN/A 542489SN/Aclass NetDest; 552489SN/Aclass MessageBuffer; 562489SN/Aclass Throttle; 572384SN/Aclass Topology; 58545SN/A 59545SN/Aclass Network { 602489SN/Apublic: 612384SN/A // Constructors 622384SN/A Network(const string & name); 632489SN/A virtual void init(const vector<string> & argv); 642489SN/A 652497SN/A // Destructor 662489SN/A virtual ~Network() {} 672489SN/A 682489SN/A // Public Methods 692489SN/A int getBufferSize() { return m_buffer_size; } 702489SN/A int getNumberOfVirtualNetworks() { return m_virtual_networks; } 712489SN/A int getEndpointBandwidth() { return m_endpoint_bandwidth; } 722489SN/A bool getAdaptiveRouting() {return m_adaptive_routing; } 732489SN/A int getLinkLatency() { return m_link_latency; } 742630SN/A int MessageSizeType_to_int(MessageSizeType size_type); 752384SN/A 762630SN/A 772384SN/A // returns the queue requested for the given component 782630SN/A virtual MessageBuffer* getToNetQueue(NodeID id, bool ordered, int netNumber) = 0; 792384SN/A virtual MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int netNumber) = 0; 802489SN/A virtual const Vector<Throttle*>* getThrottles(NodeID id) const { return NULL; } 812489SN/A 822384SN/A virtual int getNumNodes() {return 1;} 832521SN/A 842384SN/A virtual void makeOutLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration) = 0; 852489SN/A virtual void makeInLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int bw_multiplier, bool isReconfiguration) = 0; 862489SN/A virtual void makeInternalLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration) = 0; 872489SN/A 882489SN/A virtual void reset() = 0; 892489SN/A 902384SN/A virtual void printStats(ostream& out) const = 0; 912384SN/A virtual void clearStats() = 0; 922384SN/A virtual void printConfig(ostream& out) const = 0; 932630SN/A virtual void print(ostream& out) const = 0; 942384SN/A 952630SN/Aprotected: 962631SN/A 972384SN/A // Private Methods 982384SN/A // Private copy constructor and assignment operator 992384SN/A Network(const Network& obj); 1002384SN/A Network& operator=(const Network& obj); 1012384SN/A 1022384SN/A // Data Members (m_ prefix) 1032384SN/Aprotected: 1042384SN/A const string m_name; 1052489SN/A int m_nodes; 1062489SN/A int m_virtual_networks; 1072489SN/A int m_buffer_size; 1082630SN/A int m_endpoint_bandwidth; 1092489SN/A Topology* m_topology_ptr; 1102489SN/A bool m_adaptive_routing; 1112657Ssaidi@eecs.umich.edu int m_link_latency; 1122657Ssaidi@eecs.umich.edu int m_control_msg_size; 1132657Ssaidi@eecs.umich.edu int m_data_msg_size; 1142384SN/A}; 1152384SN/A 1162489SN/A// Output operator declaration 1172384SN/Aostream& operator<<(ostream& out, const Network& obj); 1182489SN/A 1192384SN/A// ******************* Definitions ******************* 1202384SN/A 1212565SN/A// Output operator definition 1222384SN/Aextern inline 1232384SN/Aostream& operator<<(ostream& out, const Network& obj) 1242384SN/A{ 1252784Ssaidi@eecs.umich.edu obj.print(out); 1262784Ssaidi@eecs.umich.edu out << flush; 1272784Ssaidi@eecs.umich.edu return out; 1282784Ssaidi@eecs.umich.edu} 1292784Ssaidi@eecs.umich.edu 1302784Ssaidi@eecs.umich.edu#endif //NETWORK_H 1312784Ssaidi@eecs.umich.edu