gem5  v21.1.0.2
GarnetNetwork.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Advanced Micro Devices, Inc.
3  * Copyright (c) 2008 Princeton University
4  * Copyright (c) 2016 Georgia Institute of Technology
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met: redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer;
11  * redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution;
14  * neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 
32 #ifndef __MEM_RUBY_NETWORK_GARNET_0_GARNETNETWORK_HH__
33 #define __MEM_RUBY_NETWORK_GARNET_0_GARNETNETWORK_HH__
34 
35 #include <iostream>
36 #include <vector>
37 
41 #include "params/GarnetNetwork.hh"
42 
43 namespace gem5
44 {
45 
46 namespace ruby
47 {
48 
49 class FaultModel;
50 class NetDest;
51 
52 namespace garnet
53 {
54 
55 class NetworkInterface;
56 class Router;
57 class NetworkLink;
58 class CreditLink;
59 
60 class GarnetNetwork : public Network
61 {
62  public:
63  typedef GarnetNetworkParams Params;
64  GarnetNetwork(const Params &p);
65  ~GarnetNetwork() = default;
66 
67  void init();
68 
69  const char *garnetVersion = "3.0";
70 
71  // Configuration (set externally)
72 
73  // for 2D topology
74  int getNumRows() const { return m_num_rows; }
75  int getNumCols() { return m_num_cols; }
76 
77  // for network
78  uint32_t getNiFlitSize() const { return m_ni_flit_size; }
81  int getRoutingAlgorithm() const { return m_routing_algorithm; }
82 
83  bool isFaultModelEnabled() const { return m_enable_fault_model; }
85 
86 
87  // Internal configuration
88  bool isVNetOrdered(int vnet) const { return m_ordered[vnet]; }
89  VNET_type
90  get_vnet_type(int vnet)
91  {
92  return m_vnet_type[vnet];
93  }
94  int getNumRouters();
95  int get_router_id(int ni, int vnet);
96 
97 
98  // Methods used by Topology to setup the network
99  void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
100  std::vector<NetDest>& routing_table_entry);
101  void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
102  std::vector<NetDest>& routing_table_entry);
103  void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
104  std::vector<NetDest>& routing_table_entry,
105  PortDirection src_outport_dirn,
106  PortDirection dest_inport_dirn);
107 
110  uint32_t functionalWrite(Packet *pkt);
111 
112  // Stats
113  void collateStats();
114  void regStats();
115  void resetStats();
116  void print(std::ostream& out) const;
117 
118  // increment counters
119  void increment_injected_packets(int vnet) { m_packets_injected[vnet]++; }
120  void increment_received_packets(int vnet) { m_packets_received[vnet]++; }
121 
122  void
124  {
125  m_packet_network_latency[vnet] += latency;
126  }
127 
128  void
130  {
131  m_packet_queueing_latency[vnet] += latency;
132  }
133 
134  void increment_injected_flits(int vnet) { m_flits_injected[vnet]++; }
135  void increment_received_flits(int vnet) { m_flits_received[vnet]++; }
136 
137  void
139  {
140  m_flit_network_latency[vnet] += latency;
141  }
142 
143  void
145  {
146  m_flit_queueing_latency[vnet] += latency;
147  }
148 
149  void
151  {
152  m_total_hops += hops;
153  }
154 
156 
157  protected:
158  // Configuration
161  uint32_t m_ni_flit_size;
167 
168  // Statistical variables
173 
179 
184 
190 
196 
199 
202 
203  private:
204  GarnetNetwork(const GarnetNetwork& obj);
206 
208  std::vector<Router *> m_routers; // All Routers in Network
209  std::vector<NetworkLink *> m_networklinks; // All flit links in the network
210  std::vector<CreditLink *> m_creditlinks; // All credit links in the network
211  std::vector<NetworkInterface *> m_nis; // All NI's in Network
212 };
213 
214 inline std::ostream&
215 operator<<(std::ostream& out, const GarnetNetwork& obj)
216 {
217  obj.print(out);
218  out << std::flush;
219  return out;
220 }
221 
222 } // namespace garnet
223 } // namespace ruby
224 } // namespace gem5
225 
226 #endif //__MEM_RUBY_NETWORK_GARNET_0_GARNETNETWORK_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
gem5::ruby::garnet::GarnetNetwork::collateStats
void collateStats()
Definition: GarnetNetwork.cc:542
gem5::ruby::garnet::GarnetNetwork::m_routing_algorithm
int m_routing_algorithm
Definition: GarnetNetwork.hh:165
gem5::ruby::garnet::GarnetNetwork::m_avg_flit_network_latency
statistics::Formula m_avg_flit_network_latency
Definition: GarnetNetwork.hh:187
gem5::ruby::Network::m_ordered
std::vector< bool > m_ordered
Definition: Network.hh:165
gem5::ruby::garnet::GarnetNetwork::getBuffersPerCtrlVC
uint32_t getBuffersPerCtrlVC()
Definition: GarnetNetwork.hh:80
gem5::ruby::garnet::GarnetNetwork::fault_model
FaultModel * fault_model
Definition: GarnetNetwork.hh:84
gem5::ruby::PortDirection
std::string PortDirection
Definition: Topology.hh:68
gem5::ruby::garnet::GarnetNetwork::m_total_int_link_utilization
statistics::Scalar m_total_int_link_utilization
Definition: GarnetNetwork.hh:193
gem5::ruby::garnet::GarnetNetwork::m_vnet_type
std::vector< VNET_type > m_vnet_type
Definition: GarnetNetwork.hh:207
gem5::ruby::garnet::GarnetNetwork::m_avg_flit_queueing_latency
statistics::Formula m_avg_flit_queueing_latency
Definition: GarnetNetwork.hh:188
gem5::ruby::garnet::GarnetNetwork::m_packet_queueing_latency
statistics::Vector m_packet_queueing_latency
Definition: GarnetNetwork.hh:172
gem5::ruby::garnet::GarnetNetwork::m_total_ext_in_link_utilization
statistics::Scalar m_total_ext_in_link_utilization
Definition: GarnetNetwork.hh:191
gem5::ruby::garnet::GarnetNetwork::increment_flit_queueing_latency
void increment_flit_queueing_latency(Tick latency, int vnet)
Definition: GarnetNetwork.hh:144
gem5::ruby::garnet::GarnetNetwork::m_packets_injected
statistics::Vector m_packets_injected
Definition: GarnetNetwork.hh:170
gem5::ruby::garnet::VNET_type
VNET_type
Definition: CommonTypes.hh:50
gem5::ruby::Network
Definition: Network.hh:82
gem5::ruby::garnet::RouteInfo
Definition: CommonTypes.hh:56
gem5::ruby::garnet::GarnetNetwork::m_enable_fault_model
bool m_enable_fault_model
Definition: GarnetNetwork.hh:166
gem5::ruby::garnet::GarnetNetwork::m_networklinks
std::vector< NetworkLink * > m_networklinks
Definition: GarnetNetwork.hh:209
gem5::statistics::Vector
A vector of scalar stats.
Definition: statistics.hh:2003
gem5::statistics::Formula
A formula for statistics that is calculated when printed.
Definition: statistics.hh:2536
std::vector
STL vector class.
Definition: stl.hh:37
gem5::ruby::garnet::GarnetNetwork::increment_received_packets
void increment_received_packets(int vnet)
Definition: GarnetNetwork.hh:120
gem5::ruby::garnet::GarnetNetwork::m_num_cols
int m_num_cols
Definition: GarnetNetwork.hh:160
gem5::ruby::garnet::GarnetNetwork::m_routers
std::vector< Router * > m_routers
Definition: GarnetNetwork.hh:208
CommonTypes.hh
gem5::ruby::garnet::GarnetNetwork::increment_total_hops
void increment_total_hops(int hops)
Definition: GarnetNetwork.hh:150
gem5::ruby::garnet::GarnetNetwork::m_total_ext_out_link_utilization
statistics::Scalar m_total_ext_out_link_utilization
Definition: GarnetNetwork.hh:192
gem5::ruby::garnet::GarnetNetwork::m_total_hops
statistics::Scalar m_total_hops
Definition: GarnetNetwork.hh:197
gem5::ruby::garnet::GarnetNetwork::m_avg_hops
statistics::Formula m_avg_hops
Definition: GarnetNetwork.hh:198
gem5::ruby::garnet::GarnetNetwork::increment_received_flits
void increment_received_flits(int vnet)
Definition: GarnetNetwork.hh:135
gem5::ruby::garnet::GarnetNetwork::getNumCols
int getNumCols()
Definition: GarnetNetwork.hh:75
gem5::ruby::garnet::GarnetNetwork::m_buffers_per_data_vc
uint32_t m_buffers_per_data_vc
Definition: GarnetNetwork.hh:164
gem5::ruby::garnet::GarnetNetwork::m_nis
std::vector< NetworkInterface * > m_nis
Definition: GarnetNetwork.hh:211
gem5::ruby::garnet::GarnetNetwork::m_avg_packet_vqueue_latency
statistics::Formula m_avg_packet_vqueue_latency
Definition: GarnetNetwork.hh:175
gem5::ruby::garnet::GarnetNetwork::m_avg_flit_vnet_latency
statistics::Formula m_avg_flit_vnet_latency
Definition: GarnetNetwork.hh:185
gem5::ruby::garnet::operator<<
std::ostream & operator<<(std::ostream &out, const flit &obj)
Definition: flit.hh:132
gem5::ruby::garnet::GarnetNetwork::get_vnet_type
VNET_type get_vnet_type(int vnet)
Definition: GarnetNetwork.hh:90
gem5::ruby::garnet::GarnetNetwork::m_avg_packet_vnet_latency
statistics::Formula m_avg_packet_vnet_latency
Definition: GarnetNetwork.hh:174
gem5::ruby::garnet::GarnetNetwork::m_data_traffic_distribution
std::vector< std::vector< statistics::Scalar * > > m_data_traffic_distribution
Definition: GarnetNetwork.hh:200
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::ruby::garnet::GarnetNetwork::getNumRows
int getNumRows() const
Definition: GarnetNetwork.hh:74
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ruby::garnet::GarnetNetwork::GarnetNetwork
GarnetNetwork(const Params &p)
Definition: GarnetNetwork.cc:64
gem5::ruby::garnet::GarnetNetwork::init
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: GarnetNetwork.cc:110
gem5::ruby::garnet::GarnetNetwork::m_avg_packet_network_latency
statistics::Formula m_avg_packet_network_latency
Definition: GarnetNetwork.hh:176
gem5::ruby::garnet::GarnetNetwork::m_max_vcs_per_vnet
uint32_t m_max_vcs_per_vnet
Definition: GarnetNetwork.hh:162
gem5::ruby::garnet::GarnetNetwork::makeInternalLink
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry, PortDirection src_outport_dirn, PortDirection dest_inport_dirn)
Definition: GarnetNetwork.cc:299
gem5::ruby::garnet::GarnetNetwork::m_ni_flit_size
uint32_t m_ni_flit_size
Definition: GarnetNetwork.hh:161
gem5::ruby::garnet::GarnetNetwork::increment_packet_network_latency
void increment_packet_network_latency(Tick latency, int vnet)
Definition: GarnetNetwork.hh:123
gem5::ruby::garnet::GarnetNetwork::increment_packet_queueing_latency
void increment_packet_queueing_latency(Tick latency, int vnet)
Definition: GarnetNetwork.hh:129
gem5::ruby::garnet::GarnetNetwork::m_avg_packet_queueing_latency
statistics::Formula m_avg_packet_queueing_latency
Definition: GarnetNetwork.hh:177
gem5::ruby::garnet::GarnetNetwork::m_ctrl_traffic_distribution
std::vector< std::vector< statistics::Scalar * > > m_ctrl_traffic_distribution
Definition: GarnetNetwork.hh:201
gem5::ruby::garnet::GarnetNetwork::m_num_rows
int m_num_rows
Definition: GarnetNetwork.hh:159
gem5::ruby::garnet::GarnetNetwork::getNiFlitSize
uint32_t getNiFlitSize() const
Definition: GarnetNetwork.hh:78
gem5::ruby::garnet::GarnetNetwork::m_creditlinks
std::vector< CreditLink * > m_creditlinks
Definition: GarnetNetwork.hh:210
gem5::ruby::garnet::GarnetNetwork::operator=
GarnetNetwork & operator=(const GarnetNetwork &obj)
gem5::ruby::garnet::GarnetNetwork::garnetVersion
const char * garnetVersion
Definition: GarnetNetwork.hh:69
gem5::ruby::SwitchID
unsigned int SwitchID
Definition: TypeDefines.hh:41
gem5::ruby::garnet::GarnetNetwork::makeExtInLink
void makeExtInLink(NodeID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
Definition: GarnetNetwork.cc:162
gem5::ruby::garnet::GarnetNetwork::Params
GarnetNetworkParams Params
Definition: GarnetNetwork.hh:63
gem5::ruby::garnet::GarnetNetwork::getRoutingAlgorithm
int getRoutingAlgorithm() const
Definition: GarnetNetwork.hh:81
gem5::ruby::garnet::GarnetNetwork::m_flit_network_latency
statistics::Vector m_flit_network_latency
Definition: GarnetNetwork.hh:182
gem5::PowerISA::ni
Bitfield< 3 > ni
Definition: misc.hh:99
gem5::ruby::garnet::GarnetNetwork::getBuffersPerDataVC
uint32_t getBuffersPerDataVC()
Definition: GarnetNetwork.hh:79
gem5::ruby::garnet::GarnetNetwork::get_router_id
int get_router_id(int ni, int vnet)
Definition: GarnetNetwork.cc:365
gem5::ruby::garnet::GarnetNetwork::increment_injected_packets
void increment_injected_packets(int vnet)
Definition: GarnetNetwork.hh:119
FaultModel.hh
gem5::ruby::garnet::GarnetNetwork::m_flit_queueing_latency
statistics::Vector m_flit_queueing_latency
Definition: GarnetNetwork.hh:183
Network.hh
gem5::ruby::garnet::GarnetNetwork::m_avg_packet_latency
statistics::Formula m_avg_packet_latency
Definition: GarnetNetwork.hh:178
gem5::ruby::garnet::GarnetNetwork::m_packet_network_latency
statistics::Vector m_packet_network_latency
Definition: GarnetNetwork.hh:171
gem5::ruby::garnet::GarnetNetwork::increment_flit_network_latency
void increment_flit_network_latency(Tick latency, int vnet)
Definition: GarnetNetwork.hh:138
gem5::ruby::garnet::GarnetNetwork::m_avg_flit_latency
statistics::Formula m_avg_flit_latency
Definition: GarnetNetwork.hh:189
gem5::ruby::garnet::GarnetNetwork::m_flits_injected
statistics::Vector m_flits_injected
Definition: GarnetNetwork.hh:181
gem5::ruby::garnet::GarnetNetwork
Definition: GarnetNetwork.hh:60
gem5::ruby::garnet::GarnetNetwork::isFaultModelEnabled
bool isFaultModelEnabled() const
Definition: GarnetNetwork.hh:83
gem5::ruby::garnet::GarnetNetwork::m_average_vc_load
statistics::Vector m_average_vc_load
Definition: GarnetNetwork.hh:195
gem5::ruby::garnet::GarnetNetwork::getNumRouters
int getNumRouters()
Definition: GarnetNetwork.cc:358
gem5::ruby::garnet::GarnetNetwork::m_average_link_utilization
statistics::Scalar m_average_link_utilization
Definition: GarnetNetwork.hh:194
gem5::ruby::garnet::GarnetNetwork::m_flits_received
statistics::Vector m_flits_received
Definition: GarnetNetwork.hh:180
gem5::ruby::garnet::GarnetNetwork::m_buffers_per_ctrl_vc
uint32_t m_buffers_per_ctrl_vc
Definition: GarnetNetwork.hh:163
gem5::ruby::garnet::GarnetNetwork::print
void print(std::ostream &out) const
Definition: GarnetNetwork.cc:588
gem5::ruby::NodeID
unsigned int NodeID
Definition: TypeDefines.hh:40
gem5::ruby::garnet::GarnetNetwork::update_traffic_distribution
void update_traffic_distribution(RouteInfo route)
Definition: GarnetNetwork.cc:594
gem5::ruby::garnet::GarnetNetwork::increment_injected_flits
void increment_injected_flits(int vnet)
Definition: GarnetNetwork.hh:134
gem5::ruby::garnet::GarnetNetwork::makeExtOutLink
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
Definition: GarnetNetwork.cc:228
gem5::ruby::garnet::GarnetNetwork::functionalWrite
uint32_t functionalWrite(Packet *pkt)
Function for performing a functional write.
Definition: GarnetNetwork.cc:607
gem5::ruby::garnet::GarnetNetwork::~GarnetNetwork
~GarnetNetwork()=default
gem5::ruby::garnet::GarnetNetwork::m_avg_flit_vqueue_latency
statistics::Formula m_avg_flit_vqueue_latency
Definition: GarnetNetwork.hh:186
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ruby::garnet::GarnetNetwork::regStats
void regStats()
Callback to set stat parameters.
Definition: GarnetNetwork.cc:373
gem5::ruby::garnet::GarnetNetwork::isVNetOrdered
bool isVNetOrdered(int vnet) const
Definition: GarnetNetwork.hh:88
gem5::ruby::garnet::GarnetNetwork::m_packets_received
statistics::Vector m_packets_received
Definition: GarnetNetwork.hh:169
gem5::ruby::FaultModel
Definition: FaultModel.hh:59
gem5::ruby::garnet::GarnetNetwork::resetStats
void resetStats()
Callback to reset stats.
Definition: GarnetNetwork.cc:574

Generated on Tue Sep 21 2021 12:25:41 for gem5 by doxygen 1.8.17