gem5  v20.1.0.0
SimpleNetwork.hh
Go to the documentation of this file.
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;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__
30 #define __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__
31 
32 #include <iostream>
33 #include <vector>
34 
36 #include "params/SimpleNetwork.hh"
37 
38 class NetDest;
39 class MessageBuffer;
40 class Throttle;
41 class Switch;
42 
43 class SimpleNetwork : public Network
44 {
45  public:
46  typedef SimpleNetworkParams Params;
47  SimpleNetwork(const Params *p);
48  ~SimpleNetwork() = default;
49 
50  void init();
51 
52  int getBufferSize() { return m_buffer_size; }
55 
56  void collateStats();
57  void regStats();
58 
59  bool isVNetOrdered(int vnet) const { return m_ordered[vnet]; }
60 
61  // Methods used by Topology to setup the network
62  void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
63  std::vector<NetDest>& routing_table_entry);
64  void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
65  std::vector<NetDest>& routing_table_entry);
66  void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
67  std::vector<NetDest>& routing_table_entry,
68  PortDirection src_outport,
69  PortDirection dst_inport);
70 
71  void print(std::ostream& out) const;
72 
73  bool functionalRead(Packet *pkt);
74  uint32_t functionalWrite(Packet *pkt);
75 
76  private:
77  void addLink(SwitchID src, SwitchID dest, int link_latency);
78  void makeLink(SwitchID src, SwitchID dest,
79  const NetDest& routing_table_entry, int link_latency);
80  void makeTopology();
81 
82  // Private copy constructor and assignment operator
83  SimpleNetwork(const SimpleNetwork& obj);
85 
89  const int m_buffer_size;
91  const bool m_adaptive_routing;
92 
93  //Statistical variables
94  Stats::Formula m_msg_counts[MessageSizeType_NUM];
95  Stats::Formula m_msg_bytes[MessageSizeType_NUM];
96 };
97 
98 inline std::ostream&
99 operator<<(std::ostream& out, const SimpleNetwork& obj)
100 {
101  obj.print(out);
102  out << std::flush;
103  return out;
104 }
105 
106 #endif // __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__
SimpleNetwork::makeExtInLink
void makeExtInLink(NodeID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
Definition: SimpleNetwork.cc:105
SimpleNetwork::collateStats
void collateStats()
Definition: SimpleNetwork.cc:169
SimpleNetwork::m_buffer_size
const int m_buffer_size
Definition: SimpleNetwork.hh:89
Network::Params
RubyNetworkParams Params
Definition: Network.hh:79
SimpleNetwork::addLink
void addLink(SwitchID src, SwitchID dest, int link_latency)
SimpleNetwork::m_endpoint_bandwidth
const int m_endpoint_bandwidth
Definition: SimpleNetwork.hh:90
std::vector< NetDest >
Switch
Definition: Switch.hh:59
SimpleNetwork::SimpleNetwork
SimpleNetwork(const Params *p)
Definition: SimpleNetwork.cc:57
SimpleNetwork::init
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: SimpleNetwork.cc:75
SimpleNetwork::Params
SimpleNetworkParams Params
Definition: SimpleNetwork.hh:46
SimpleNetwork::isVNetOrdered
bool isVNetOrdered(int vnet) const
Definition: SimpleNetwork.hh:59
SimpleNetwork::m_msg_counts
Stats::Formula m_msg_counts[MessageSizeType_NUM]
Definition: SimpleNetwork.hh:94
Throttle
Definition: Throttle.hh:52
SimpleNetwork::getAdaptiveRouting
bool getAdaptiveRouting()
Definition: SimpleNetwork.hh:54
SimpleNetwork::functionalRead
bool functionalRead(Packet *pkt)
Definition: SimpleNetwork.cc:194
SimpleNetwork::m_num_connected_buffers
int m_num_connected_buffers
Definition: SimpleNetwork.hh:88
SimpleNetwork::m_int_link_buffers
std::vector< MessageBuffer * > m_int_link_buffers
Definition: SimpleNetwork.hh:87
SimpleNetwork
Definition: SimpleNetwork.hh:43
operator<<
std::ostream & operator<<(std::ostream &out, const SimpleNetwork &obj)
Definition: SimpleNetwork.hh:99
SimpleNetwork::makeInternalLink
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry, PortDirection src_outport, PortDirection dst_inport)
Definition: SimpleNetwork.cc:115
SimpleNetwork::makeLink
void makeLink(SwitchID src, SwitchID dest, const NetDest &routing_table_entry, int link_latency)
SimpleNetwork::m_msg_bytes
Stats::Formula m_msg_bytes[MessageSizeType_NUM]
Definition: SimpleNetwork.hh:95
SimpleNetwork::makeExtOutLink
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
Definition: SimpleNetwork.cc:87
Network::m_ordered
std::vector< bool > m_ordered
Definition: Network.hh:160
SimpleNetwork::m_adaptive_routing
const bool m_adaptive_routing
Definition: SimpleNetwork.hh:91
SimpleNetwork::print
void print(std::ostream &out) const
Definition: SimpleNetwork.cc:177
Network
Definition: Network.hh:76
SimpleNetwork::makeTopology
void makeTopology()
SimpleNetwork::operator=
SimpleNetwork & operator=(const SimpleNetwork &obj)
SimpleNetwork::getEndpointBandwidth
int getEndpointBandwidth()
Definition: SimpleNetwork.hh:53
Network.hh
SimpleNetwork::functionalWrite
uint32_t functionalWrite(Packet *pkt)
Definition: SimpleNetwork.cc:209
Stats::Formula
A formula for statistics that is calculated when printed.
Definition: statistics.hh:3037
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
SimpleNetwork::m_switches
std::vector< Switch * > m_switches
Definition: SimpleNetwork.hh:86
SimpleNetwork::~SimpleNetwork
~SimpleNetwork()=default
PortDirection
std::string PortDirection
Definition: Topology.hh:62
NodeID
unsigned int NodeID
Definition: TypeDefines.hh:34
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
MessageBuffer
Definition: MessageBuffer.hh:68
SimpleNetwork::getBufferSize
int getBufferSize()
Definition: SimpleNetwork.hh:52
SimpleNetwork::regStats
void regStats()
Callback to set stat parameters.
Definition: SimpleNetwork.cc:141
NetDest
Definition: NetDest.hh:39
SwitchID
unsigned int SwitchID
Definition: TypeDefines.hh:35

Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17