gem5  v21.0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SimpleNetwork.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 ARM Limited
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__
42 #define __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__
43 
44 #include <iostream>
45 #include <vector>
46 
48 #include "params/SimpleNetwork.hh"
49 
50 class NetDest;
51 class MessageBuffer;
52 class Throttle;
53 class Switch;
54 
55 class SimpleNetwork : public Network
56 {
57  public:
58  typedef SimpleNetworkParams Params;
59  SimpleNetwork(const Params &p);
60  ~SimpleNetwork() = default;
61 
62  void init();
63 
64  int getBufferSize() { return m_buffer_size; }
67 
68  void collateStats();
69  void regStats();
70 
71  bool isVNetOrdered(int vnet) const { return m_ordered[vnet]; }
72 
73  // Methods used by Topology to setup the network
74  void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
75  std::vector<NetDest>& routing_table_entry);
76  void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
77  std::vector<NetDest>& routing_table_entry);
78  void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
79  std::vector<NetDest>& routing_table_entry,
80  PortDirection src_outport,
81  PortDirection dst_inport);
82 
83  void print(std::ostream& out) const;
84 
85  bool functionalRead(Packet *pkt);
86  bool functionalRead(Packet *pkt, WriteMask &mask);
87  uint32_t functionalWrite(Packet *pkt);
88 
89  private:
90  void addLink(SwitchID src, SwitchID dest, int link_latency);
91  void makeLink(SwitchID src, SwitchID dest,
92  const NetDest& routing_table_entry, int link_latency);
93  void makeTopology();
94 
95  // Private copy constructor and assignment operator
96  SimpleNetwork(const SimpleNetwork& obj);
98 
102  const int m_buffer_size;
104  const bool m_adaptive_routing;
105 
106 
107  struct NetworkStats : public Stats::Group
108  {
109  NetworkStats(Stats::Group *parent);
110 
111  //Statistical variables
112  Stats::Formula* m_msg_counts[MessageSizeType_NUM];
113  Stats::Formula* m_msg_bytes[MessageSizeType_NUM];
114  } networkStats;
115 };
116 
117 inline std::ostream&
118 operator<<(std::ostream& out, const SimpleNetwork& obj)
119 {
120  obj.print(out);
121  out << std::flush;
122  return out;
123 }
124 
125 #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:104
SimpleNetwork::collateStats
void collateStats()
Definition: SimpleNetwork.cc:173
SimpleNetwork::m_buffer_size
const int m_buffer_size
Definition: SimpleNetwork.hh:102
SimpleNetwork::addLink
void addLink(SwitchID src, SwitchID dest, int link_latency)
SimpleNetwork::m_endpoint_bandwidth
const int m_endpoint_bandwidth
Definition: SimpleNetwork.hh:103
std::vector< NetDest >
Switch
Definition: Switch.hh:71
SimpleNetwork::networkStats
SimpleNetwork::NetworkStats networkStats
SimpleNetwork::init
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: SimpleNetwork.cc:74
SimpleNetwork::Params
SimpleNetworkParams Params
Definition: SimpleNetwork.hh:58
SimpleNetwork::isVNetOrdered
bool isVNetOrdered(int vnet) const
Definition: SimpleNetwork.hh:71
Throttle
Definition: Throttle.hh:52
SimpleNetwork::getAdaptiveRouting
bool getAdaptiveRouting()
Definition: SimpleNetwork.hh:66
SimpleNetwork::functionalRead
bool functionalRead(Packet *pkt)
Definition: SimpleNetwork.cc:192
SimpleNetwork::m_num_connected_buffers
int m_num_connected_buffers
Definition: SimpleNetwork.hh:101
SimpleNetwork::m_int_link_buffers
std::vector< MessageBuffer * > m_int_link_buffers
Definition: SimpleNetwork.hh:100
SimpleNetwork
Definition: SimpleNetwork.hh:55
operator<<
std::ostream & operator<<(std::ostream &out, const SimpleNetwork &obj)
Definition: SimpleNetwork.hh:118
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:114
SimpleNetwork::makeLink
void makeLink(SwitchID src, SwitchID dest, const NetDest &routing_table_entry, int link_latency)
SimpleNetwork::makeExtOutLink
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
Definition: SimpleNetwork.cc:86
Network::m_ordered
std::vector< bool > m_ordered
Definition: Network.hh:159
SimpleNetwork::m_adaptive_routing
const bool m_adaptive_routing
Definition: SimpleNetwork.hh:104
SimpleNetwork::print
void print(std::ostream &out) const
Definition: SimpleNetwork.cc:181
Network
Definition: Network.hh:76
SimpleNetwork::makeTopology
void makeTopology()
SimpleNetwork::operator=
SimpleNetwork & operator=(const SimpleNetwork &obj)
SimpleNetwork::NetworkStats
Definition: SimpleNetwork.hh:107
SimpleNetwork::getEndpointBandwidth
int getEndpointBandwidth()
Definition: SimpleNetwork.hh:65
Network.hh
SimpleNetwork::functionalWrite
uint32_t functionalWrite(Packet *pkt)
Definition: SimpleNetwork.cc:222
Stats::Formula
A formula for statistics that is calculated when printed.
Definition: statistics.hh:2538
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:258
Stats::Group
Statistics container.
Definition: group.hh:87
SimpleNetwork::m_switches
std::vector< Switch * > m_switches
Definition: SimpleNetwork.hh:99
SimpleNetwork::SimpleNetwork
SimpleNetwork(const Params &p)
Definition: SimpleNetwork.cc:55
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::NetworkStats::m_msg_counts
Stats::Formula * m_msg_counts[MessageSizeType_NUM]
Definition: SimpleNetwork.hh:112
SimpleNetwork::NetworkStats::m_msg_bytes
Stats::Formula * m_msg_bytes[MessageSizeType_NUM]
Definition: SimpleNetwork.hh:113
SimpleNetwork::NetworkStats::NetworkStats
NetworkStats(Stats::Group *parent)
Definition: SimpleNetwork.cc:237
SimpleNetwork::getBufferSize
int getBufferSize()
Definition: SimpleNetwork.hh:64
SimpleNetwork::regStats
void regStats()
Callback to set stat parameters.
Definition: SimpleNetwork.cc:140
WriteMask
Definition: WriteMask.hh:53
NetDest
Definition: NetDest.hh:39
SwitchID
unsigned int SwitchID
Definition: TypeDefines.hh:35
ArmISA::mask
Bitfield< 28, 24 > mask
Definition: miscregs_types.hh:711

Generated on Tue Jun 22 2021 15:28:30 for gem5 by doxygen 1.8.17