SimpleLink.hh revision 6493
112027Sjungma@eit.uni-kl.de 212027Sjungma@eit.uni-kl.de/* 312027Sjungma@eit.uni-kl.de * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 412027Sjungma@eit.uni-kl.de * All rights reserved. 512027Sjungma@eit.uni-kl.de * 612027Sjungma@eit.uni-kl.de * Redistribution and use in source and binary forms, with or without 712027Sjungma@eit.uni-kl.de * modification, are permitted provided that the following conditions are 812027Sjungma@eit.uni-kl.de * met: redistributions of source code must retain the above copyright 912027Sjungma@eit.uni-kl.de * notice, this list of conditions and the following disclaimer; 1012027Sjungma@eit.uni-kl.de * redistributions in binary form must reproduce the above copyright 1112027Sjungma@eit.uni-kl.de * notice, this list of conditions and the following disclaimer in the 1212027Sjungma@eit.uni-kl.de * documentation and/or other materials provided with the distribution; 1312027Sjungma@eit.uni-kl.de * neither the name of the copyright holders nor the names of its 1412027Sjungma@eit.uni-kl.de * contributors may be used to endorse or promote products derived from 1512027Sjungma@eit.uni-kl.de * this software without specific prior written permission. 1612027Sjungma@eit.uni-kl.de * 1712027Sjungma@eit.uni-kl.de * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1812027Sjungma@eit.uni-kl.de * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1912027Sjungma@eit.uni-kl.de * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2012027Sjungma@eit.uni-kl.de * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2112027Sjungma@eit.uni-kl.de * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2212027Sjungma@eit.uni-kl.de * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2312027Sjungma@eit.uni-kl.de * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2412027Sjungma@eit.uni-kl.de * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2512027Sjungma@eit.uni-kl.de * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2612027Sjungma@eit.uni-kl.de * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2712027Sjungma@eit.uni-kl.de * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2812027Sjungma@eit.uni-kl.de */ 2912027Sjungma@eit.uni-kl.de 3012027Sjungma@eit.uni-kl.de/* 3112027Sjungma@eit.uni-kl.de * Network.hh 3212027Sjungma@eit.uni-kl.de * 3312027Sjungma@eit.uni-kl.de * Description: The Network class is the base class for classes that 3412027Sjungma@eit.uni-kl.de * implement the interconnection network between components 3512027Sjungma@eit.uni-kl.de * (processor/cache components and memory/directory components). The 3612027Sjungma@eit.uni-kl.de * interconnection network as described here is not a physical 3712027Sjungma@eit.uni-kl.de * network, but a programming concept used to implement all 3812027Sjungma@eit.uni-kl.de * communication between components. Thus parts of this 'network' 3912027Sjungma@eit.uni-kl.de * will model the on-chip connections between cache controllers and 4012027Sjungma@eit.uni-kl.de * directory controllers as well as the links between chip and network 4112027Sjungma@eit.uni-kl.de * switches. 4212027Sjungma@eit.uni-kl.de * 4312027Sjungma@eit.uni-kl.de * $Id$ 4412027Sjungma@eit.uni-kl.de * */ 4512027Sjungma@eit.uni-kl.de 4612027Sjungma@eit.uni-kl.de#ifndef NETWORK_H 4712027Sjungma@eit.uni-kl.de#define NETWORK_H 4812027Sjungma@eit.uni-kl.de 4912027Sjungma@eit.uni-kl.de#include "mem/ruby/common/Global.hh" 5012027Sjungma@eit.uni-kl.de#include "mem/ruby/system/NodeID.hh" 5112027Sjungma@eit.uni-kl.de#include "mem/protocol/MessageSizeType.hh" 5212027Sjungma@eit.uni-kl.de#include "mem/ruby/system/System.hh" 5312027Sjungma@eit.uni-kl.de 5412027Sjungma@eit.uni-kl.declass NetDest; 5512027Sjungma@eit.uni-kl.declass MessageBuffer; 5612027Sjungma@eit.uni-kl.declass Throttle; 5712027Sjungma@eit.uni-kl.declass Topology; 5812027Sjungma@eit.uni-kl.de 5912027Sjungma@eit.uni-kl.declass Network { 6012027Sjungma@eit.uni-kl.depublic: 6112027Sjungma@eit.uni-kl.de // Constructors 6212027Sjungma@eit.uni-kl.de Network(const string & name); 6312027Sjungma@eit.uni-kl.de virtual void init(const vector<string> & argv); 6412027Sjungma@eit.uni-kl.de 6512027Sjungma@eit.uni-kl.de // Destructor 6612027Sjungma@eit.uni-kl.de virtual ~Network() {} 6712027Sjungma@eit.uni-kl.de 6812027Sjungma@eit.uni-kl.de // Public Methods 6912027Sjungma@eit.uni-kl.de int getBufferSize() { return m_buffer_size; } 7012027Sjungma@eit.uni-kl.de int getNumberOfVirtualNetworks() { return m_virtual_networks; } 7112027Sjungma@eit.uni-kl.de int getEndpointBandwidth() { return m_endpoint_bandwidth; } 7212027Sjungma@eit.uni-kl.de bool getAdaptiveRouting() {return m_adaptive_routing; } 7312027Sjungma@eit.uni-kl.de int getLinkLatency() { return m_link_latency; } 7412027Sjungma@eit.uni-kl.de int MessageSizeType_to_int(MessageSizeType size_type); 7512027Sjungma@eit.uni-kl.de 7612027Sjungma@eit.uni-kl.de 7712027Sjungma@eit.uni-kl.de // returns the queue requested for the given component 7812027Sjungma@eit.uni-kl.de virtual MessageBuffer* getToNetQueue(NodeID id, bool ordered, int netNumber) = 0; 7912027Sjungma@eit.uni-kl.de virtual MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int netNumber) = 0; 8012027Sjungma@eit.uni-kl.de virtual const Vector<Throttle*>* getThrottles(NodeID id) const { return NULL; } 8112027Sjungma@eit.uni-kl.de 8212027Sjungma@eit.uni-kl.de virtual int getNumNodes() {return 1;} 8312027Sjungma@eit.uni-kl.de 8412027Sjungma@eit.uni-kl.de virtual void makeOutLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration) = 0; 8512027Sjungma@eit.uni-kl.de virtual void makeInLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int bw_multiplier, bool isReconfiguration) = 0; 8612027Sjungma@eit.uni-kl.de virtual void makeInternalLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration) = 0; 8712027Sjungma@eit.uni-kl.de 8812027Sjungma@eit.uni-kl.de virtual void reset() = 0; 8912027Sjungma@eit.uni-kl.de 9012027Sjungma@eit.uni-kl.de virtual void printStats(ostream& out) const = 0; 9112027Sjungma@eit.uni-kl.de virtual void clearStats() = 0; 9212027Sjungma@eit.uni-kl.de virtual void printConfig(ostream& out) const = 0; 9312027Sjungma@eit.uni-kl.de virtual void print(ostream& out) const = 0; 9412027Sjungma@eit.uni-kl.de 9512027Sjungma@eit.uni-kl.deprotected: 9612027Sjungma@eit.uni-kl.de 9712027Sjungma@eit.uni-kl.de // Private Methods 9812027Sjungma@eit.uni-kl.de // Private copy constructor and assignment operator 9912027Sjungma@eit.uni-kl.de Network(const Network& obj); 10012027Sjungma@eit.uni-kl.de Network& operator=(const Network& obj); 10112027Sjungma@eit.uni-kl.de 10212027Sjungma@eit.uni-kl.de // Data Members (m_ prefix) 10312027Sjungma@eit.uni-kl.deprotected: 10412027Sjungma@eit.uni-kl.de const string m_name; 10512027Sjungma@eit.uni-kl.de int m_nodes; 10612027Sjungma@eit.uni-kl.de int m_virtual_networks; 10712027Sjungma@eit.uni-kl.de int m_buffer_size; 10812027Sjungma@eit.uni-kl.de int m_endpoint_bandwidth; 10912027Sjungma@eit.uni-kl.de Topology* m_topology_ptr; 11012027Sjungma@eit.uni-kl.de bool m_adaptive_routing; 11112027Sjungma@eit.uni-kl.de int m_link_latency; 11212027Sjungma@eit.uni-kl.de int m_control_msg_size; 11312027Sjungma@eit.uni-kl.de int m_data_msg_size; 11412027Sjungma@eit.uni-kl.de}; 11512027Sjungma@eit.uni-kl.de 11612027Sjungma@eit.uni-kl.de// Output operator declaration 11712027Sjungma@eit.uni-kl.deostream& operator<<(ostream& out, const Network& obj); 11812027Sjungma@eit.uni-kl.de 11912027Sjungma@eit.uni-kl.de// ******************* Definitions ******************* 12012027Sjungma@eit.uni-kl.de 12112027Sjungma@eit.uni-kl.de// Output operator definition 12212027Sjungma@eit.uni-kl.deextern inline 12312027Sjungma@eit.uni-kl.deostream& operator<<(ostream& out, const Network& obj) 12412027Sjungma@eit.uni-kl.de{ 125 obj.print(out); 126 out << flush; 127 return out; 128} 129 130#endif //NETWORK_H 131