gem5  v22.1.0.0
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:
65 
66  SimpleNetwork(const Params &p);
67  ~SimpleNetwork() = default;
68 
69  void init();
70 
71  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
104 
105  std::unordered_map<int, Switch*> m_switches;
107  const int m_buffer_size;
109 
110 
112  {
114 
115  //Statistical variables
116  statistics::Formula* m_msg_counts[MessageSizeType_NUM];
117  statistics::Formula* m_msg_bytes[MessageSizeType_NUM];
119 };
120 
121 inline std::ostream&
122 operator<<(std::ostream& out, const SimpleNetwork& obj)
123 {
124  obj.print(out);
125  out << std::flush;
126  return out;
127 }
128 
129 } // namespace ruby
130 } // namespace gem5
131 
132 #endif // __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__
ClockedObjectParams Params
Parameters of ClockedObject.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
std::vector< bool > m_ordered
Definition: Network.hh:165
void regStats()
Callback to set stat parameters.
void print(std::ostream &out) const
std::vector< MessageBuffer * > m_int_link_buffers
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry, PortDirection src_outport, PortDirection dst_inport)
void addLink(SwitchID src, SwitchID dest, int link_latency)
std::unordered_map< int, Switch * > m_switches
bool functionalRead(Packet *pkt)
uint32_t functionalWrite(Packet *pkt)
SimpleNetwork & operator=(const SimpleNetwork &obj)
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
void makeLink(SwitchID src, SwitchID dest, const NetDest &routing_table_entry, int link_latency)
gem5::ruby::SimpleNetwork::NetworkStats networkStats
SimpleNetwork(const Params &p)
bool isVNetOrdered(int vnet) const
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
void makeExtInLink(NodeID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
SimpleNetwork(const SimpleNetwork &obj)
A formula for statistics that is calculated when printed.
Definition: statistics.hh:2540
Statistics container.
Definition: group.hh:94
STL vector class.
Definition: stl.hh:37
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
Bitfield< 54 > p
Definition: pagetable.hh:70
unsigned int SwitchID
Definition: TypeDefines.hh:43
std::string PortDirection
Definition: TypeDefines.hh:44
unsigned int NodeID
Definition: TypeDefines.hh:42
std::ostream & operator<<(std::ostream &os, const BoolVec &myvector)
Definition: BoolVec.cc:49
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
statistics::Formula * m_msg_bytes[MessageSizeType_NUM]
NetworkStats(statistics::Group *parent)
statistics::Formula * m_msg_counts[MessageSizeType_NUM]

Generated on Wed Dec 21 2022 10:22:38 for gem5 by doxygen 1.9.1