gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
43namespace gem5
44{
45
46namespace ruby
47{
48
49class FaultModel;
50class NetDest;
51
52namespace garnet
53{
54
55class NetworkInterface;
56class Router;
57class NetworkLink;
58class NetworkBridge;
59class CreditLink;
60
61class GarnetNetwork : public Network
62{
63 public:
64 typedef GarnetNetworkParams Params;
65 GarnetNetwork(const Params &p);
66 ~GarnetNetwork() = default;
67
68 void init();
69
70 const char *garnetVersion = "3.0";
71
72 // Configuration (set externally)
73
74 // for 2D topology
75 int getNumRows() const { return m_num_rows; }
76 int getNumCols() { return m_num_cols; }
77
78 // for network
79 uint32_t getNiFlitSize() const { return m_ni_flit_size; }
83
86
87
88 // Internal configuration
89 bool isVNetOrdered(int vnet) const { return m_ordered[vnet]; }
91 get_vnet_type(int vnet)
92 {
93 return m_vnet_type[vnet];
94 }
95 int getNumRouters();
96 int get_router_id(int ni, int vnet);
97
98
99 // Methods used by Topology to setup the network
100 void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
101 std::vector<NetDest>& routing_table_entry);
102 void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
103 std::vector<NetDest>& routing_table_entry);
104 void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
105 std::vector<NetDest>& routing_table_entry,
106 PortDirection src_outport_dirn,
107 PortDirection dest_inport_dirn);
108
109 bool functionalRead(Packet *pkt, WriteMask &mask);
112 uint32_t functionalWrite(Packet *pkt);
113
114 // Stats
115 void collateStats();
116 void regStats();
117 void resetStats();
118 void print(std::ostream& out) const;
119
120 // increment counters
123
124 void
126 {
127 m_packet_network_latency[vnet] += latency;
128 }
129
130 void
132 {
133 m_packet_queueing_latency[vnet] += latency;
134 }
135
136 void increment_injected_flits(int vnet) { m_flits_injected[vnet]++; }
137 void increment_received_flits(int vnet) { m_flits_received[vnet]++; }
138
139 void
141 {
142 m_flit_network_latency[vnet] += latency;
143 }
144
145 void
147 {
148 m_flit_queueing_latency[vnet] += latency;
149 }
150
151 void
153 {
154 m_total_hops += hops;
155 }
156
159
160 protected:
161 // Configuration
170
171 // Statistical variables
176
182
187
193
199
202
205
206 private:
209
211 std::vector<Router *> m_routers; // All Routers in Network
212 std::vector<NetworkLink *> m_networklinks; // All flit links in the network
214 std::vector<CreditLink *> m_creditlinks; // All credit links in the network
216 int m_next_packet_id; // static vairable for packet id allocation
217};
218
219inline std::ostream&
220operator<<(std::ostream& out, const GarnetNetwork& obj)
221{
222 obj.print(out);
223 out << std::flush;
224 return out;
225}
226
227} // namespace garnet
228} // namespace ruby
229} // namespace gem5
230
231#endif //__MEM_RUBY_NETWORK_GARNET_0_GARNETNETWORK_HH__
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
std::vector< bool > m_ordered
Definition Network.hh:165
statistics::Vector m_packet_network_latency
statistics::Formula m_avg_packet_vqueue_latency
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry, PortDirection src_outport_dirn, PortDirection dest_inport_dirn)
bool isVNetOrdered(int vnet) const
std::vector< VNET_type > m_vnet_type
uint32_t functionalWrite(Packet *pkt)
Function for performing a functional write.
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
std::vector< std::vector< statistics::Scalar * > > m_data_traffic_distribution
void regStats()
Callback to set stat parameters.
statistics::Scalar m_total_ext_in_link_utilization
int get_router_id(int ni, int vnet)
statistics::Formula m_avg_packet_queueing_latency
void increment_flit_queueing_latency(Tick latency, int vnet)
statistics::Formula m_avg_flit_queueing_latency
void increment_flit_network_latency(Tick latency, int vnet)
statistics::Vector m_flit_queueing_latency
statistics::Formula m_avg_flit_vqueue_latency
statistics::Scalar m_average_link_utilization
void resetStats()
Callback to reset stats.
statistics::Formula m_avg_flit_network_latency
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
std::vector< NetworkLink * > m_networklinks
GarnetNetwork & operator=(const GarnetNetwork &obj)
statistics::Vector m_flit_network_latency
void increment_packet_queueing_latency(Tick latency, int vnet)
std::vector< Router * > m_routers
statistics::Scalar m_total_ext_out_link_utilization
GarnetNetwork(const GarnetNetwork &obj)
statistics::Scalar m_total_int_link_utilization
void increment_packet_network_latency(Tick latency, int vnet)
statistics::Formula m_avg_packet_network_latency
statistics::Formula m_avg_flit_latency
void update_traffic_distribution(RouteInfo route)
std::vector< std::vector< statistics::Scalar * > > m_ctrl_traffic_distribution
std::vector< CreditLink * > m_creditlinks
statistics::Formula m_avg_packet_latency
void print(std::ostream &out) const
statistics::Formula m_avg_packet_vnet_latency
statistics::Formula m_avg_flit_vnet_latency
bool functionalRead(Packet *pkt, WriteMask &mask)
statistics::Vector m_packet_queueing_latency
void makeExtInLink(NodeID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
std::vector< NetworkInterface * > m_nis
std::vector< NetworkBridge * > m_networkbridges
A formula for statistics that is calculated when printed.
This is a simple scalar statistic, like a counter.
A vector of scalar stats.
STL vector class.
Definition stl.hh:37
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
Bitfield< 0 > p
Bitfield< 3 > ni
Definition misc.hh:104
std::ostream & operator<<(std::ostream &out, const flit &obj)
Definition flit.hh:135
unsigned int SwitchID
std::string PortDirection
unsigned int NodeID
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Tick
Tick count type.
Definition types.hh:58

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0