gem5  v21.1.0.2
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 namespace gem5
51 {
52 
53 namespace ruby
54 {
55 
56 class NetDest;
57 class MessageBuffer;
58 class Throttle;
59 class Switch;
60 
61 class SimpleNetwork : public Network
62 {
63  public:
64  typedef SimpleNetworkParams Params;
65  SimpleNetwork(const Params &p);
66  ~SimpleNetwork() = default;
67 
68  void init();
69 
70  int getBufferSize() { return m_buffer_size; }
73 
74  void collateStats();
75  void regStats();
76 
77  bool isVNetOrdered(int vnet) const { return m_ordered[vnet]; }
78 
79  // Methods used by Topology to setup the network
80  void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
81  std::vector<NetDest>& routing_table_entry);
82  void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
83  std::vector<NetDest>& routing_table_entry);
84  void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
85  std::vector<NetDest>& routing_table_entry,
86  PortDirection src_outport,
87  PortDirection dst_inport);
88 
89  void print(std::ostream& out) const;
90 
91  bool functionalRead(Packet *pkt);
92  bool functionalRead(Packet *pkt, WriteMask &mask);
93  uint32_t functionalWrite(Packet *pkt);
94 
95  private:
96  void addLink(SwitchID src, SwitchID dest, int link_latency);
97  void makeLink(SwitchID src, SwitchID dest,
98  const NetDest& routing_table_entry, int link_latency);
99  void makeTopology();
100 
101  // Private copy constructor and assignment operator
102  SimpleNetwork(const SimpleNetwork& obj);
104 
108  const int m_buffer_size;
110  const bool m_adaptive_routing;
111 
112 
114  {
116 
117  //Statistical variables
118  statistics::Formula* m_msg_counts[MessageSizeType_NUM];
119  statistics::Formula* m_msg_bytes[MessageSizeType_NUM];
120  } networkStats;
121 };
122 
123 inline std::ostream&
124 operator<<(std::ostream& out, const SimpleNetwork& obj)
125 {
126  obj.print(out);
127  out << std::flush;
128  return out;
129 }
130 
131 } // namespace ruby
132 } // namespace gem5
133 
134 #endif // __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__
gem5::ruby::SimpleNetwork::makeLink
void makeLink(SwitchID src, SwitchID dest, const NetDest &routing_table_entry, int link_latency)
gem5::ruby::SimpleNetwork::print
void print(std::ostream &out) const
Definition: SimpleNetwork.cc:187
gem5::ruby::SimpleNetwork::NetworkStats::m_msg_bytes
statistics::Formula * m_msg_bytes[MessageSizeType_NUM]
Definition: SimpleNetwork.hh:119
gem5::ruby::WriteMask
Definition: WriteMask.hh:59
gem5::ruby::Network::m_ordered
std::vector< bool > m_ordered
Definition: Network.hh:165
gem5::ruby::PortDirection
std::string PortDirection
Definition: Topology.hh:68
gem5::ruby::SimpleNetwork::m_adaptive_routing
const bool m_adaptive_routing
Definition: SimpleNetwork.hh:110
gem5::ruby::SimpleNetwork::isVNetOrdered
bool isVNetOrdered(int vnet) const
Definition: SimpleNetwork.hh:77
gem5::ruby::SimpleNetwork::init
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: SimpleNetwork.cc:80
gem5::ruby::operator<<
std::ostream & operator<<(std::ostream &os, const BoolVec &myvector)
Definition: BoolVec.cc:49
gem5::ruby::SimpleNetwork::networkStats
gem5::ruby::SimpleNetwork::NetworkStats networkStats
gem5::ruby::SimpleNetwork::m_num_connected_buffers
int m_num_connected_buffers
Definition: SimpleNetwork.hh:107
gem5::ruby::SimpleNetwork::makeExtInLink
void makeExtInLink(NodeID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
Definition: SimpleNetwork.cc:110
gem5::ruby::Network
Definition: Network.hh:82
gem5::ruby::SimpleNetwork
Definition: SimpleNetwork.hh:61
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::SimpleNetwork::addLink
void addLink(SwitchID src, SwitchID dest, int link_latency)
gem5::ruby::SimpleNetwork::m_endpoint_bandwidth
const int m_endpoint_bandwidth
Definition: SimpleNetwork.hh:109
gem5::mask
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
gem5::ruby::SimpleNetwork::getAdaptiveRouting
bool getAdaptiveRouting()
Definition: SimpleNetwork.hh:72
gem5::ruby::SimpleNetwork::NetworkStats::NetworkStats
NetworkStats(statistics::Group *parent)
Definition: SimpleNetwork.cc:243
gem5::ruby::SimpleNetwork::m_int_link_buffers
std::vector< MessageBuffer * > m_int_link_buffers
Definition: SimpleNetwork.hh:106
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::ruby::SimpleNetwork::regStats
void regStats()
Callback to set stat parameters.
Definition: SimpleNetwork.cc:146
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::ruby::SimpleNetwork::m_buffer_size
const int m_buffer_size
Definition: SimpleNetwork.hh:108
gem5::ruby::SimpleNetwork::makeTopology
void makeTopology()
gem5::ruby::SimpleNetwork::NetworkStats
Definition: SimpleNetwork.hh:113
gem5::ruby::SwitchID
unsigned int SwitchID
Definition: TypeDefines.hh:41
gem5::ruby::SimpleNetwork::makeExtOutLink
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
Definition: SimpleNetwork.cc:92
gem5::ruby::NetDest
Definition: NetDest.hh:45
gem5::ruby::SimpleNetwork::Params
SimpleNetworkParams Params
Definition: SimpleNetwork.hh:64
Network.hh
gem5::ruby::SimpleNetwork::getEndpointBandwidth
int getEndpointBandwidth()
Definition: SimpleNetwork.hh:71
gem5::ruby::SimpleNetwork::functionalWrite
uint32_t functionalWrite(Packet *pkt)
Definition: SimpleNetwork.cc:228
gem5::ruby::SimpleNetwork::functionalRead
bool functionalRead(Packet *pkt)
Definition: SimpleNetwork.cc:198
gem5::ruby::SimpleNetwork::NetworkStats::m_msg_counts
statistics::Formula * m_msg_counts[MessageSizeType_NUM]
Definition: SimpleNetwork.hh:118
gem5::ruby::SimpleNetwork::collateStats
void collateStats()
Definition: SimpleNetwork.cc:179
gem5::ruby::SimpleNetwork::SimpleNetwork
SimpleNetwork(const Params &p)
Definition: SimpleNetwork.cc:61
gem5::ruby::SimpleNetwork::~SimpleNetwork
~SimpleNetwork()=default
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::ruby::NodeID
unsigned int NodeID
Definition: TypeDefines.hh:40
gem5::ruby::SimpleNetwork::m_switches
std::vector< Switch * > m_switches
Definition: SimpleNetwork.hh:105
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ruby::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:120
gem5::ruby::SimpleNetwork::getBufferSize
int getBufferSize()
Definition: SimpleNetwork.hh:70
gem5::ruby::SimpleNetwork::operator=
SimpleNetwork & operator=(const SimpleNetwork &obj)

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