gem5  v22.1.0.0
NetworkLink.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Advanced Micro Devices, Inc.
3  * Copyright (c) 2020 Inria
4  * Copyright (c) 2016 Georgia Institute of Technology
5  * Copyright (c) 2008 Princeton University
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met: redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer;
12  * redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution;
15  * neither the name of the copyright holders nor the names of its
16  * contributors may be used to endorse or promote products derived from
17  * this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 
33 #ifndef __MEM_RUBY_NETWORK_GARNET_0_NETWORKLINK_HH__
34 #define __MEM_RUBY_NETWORK_GARNET_0_NETWORKLINK_HH__
35 
36 #include <iostream>
37 #include <vector>
38 
42 #include "params/NetworkLink.hh"
43 #include "sim/clocked_object.hh"
44 
45 namespace gem5
46 {
47 
48 namespace ruby
49 {
50 
51 namespace garnet
52 {
53 
54 class GarnetNetwork;
55 
56 class NetworkLink : public ClockedObject, public Consumer
57 {
58  public:
59  typedef NetworkLinkParams Params;
60  NetworkLink(const Params &p);
61  ~NetworkLink() = default;
62 
63  void setLinkConsumer(Consumer *consumer);
64  void setSourceQueue(flitBuffer *src_queue, ClockedObject *srcClockObject);
65  virtual void setVcsPerVnet(uint32_t consumerVcs);
67  link_type getType() { return m_type; }
68  void print(std::ostream& out) const {}
69  int get_id() const { return m_id; }
71  virtual void wakeup();
72 
73  unsigned int getLinkUtilization() const { return m_link_utilized; }
74  const std::vector<unsigned int> & getVcLoad() const { return m_vc_load; }
75 
76  inline bool isReady(Tick curTime)
77  {
78  return linkBuffer.isReady(curTime);
79  }
80 
81  inline flit* peekLink() { return linkBuffer.peekTopFlit(); }
82  inline flit* consumeLink() { return linkBuffer.getTopFlit(); }
83 
84  bool functionalRead(Packet *pkt, WriteMask &mask);
85  uint32_t functionalWrite(Packet *);
86  void resetStats();
87 
89  uint32_t bitWidth;
90 
91  private:
92  const int m_id;
95 
97 
98  // Statistical variables
99  unsigned int m_link_utilized;
101 
102  protected:
103  uint32_t m_virt_nets;
107 
108 };
109 
110 } // namespace garnet
111 } // namespace ruby
112 } // namespace gem5
113 
114 #endif // __MEM_RUBY_NETWORK_GARNET_0_NETWORKLINK_HH__
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:79
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
bool isReady(Tick curTime)
Definition: flitBuffer.cc:60
ClockedObject declaration and implementation.
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
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Tick
Tick count type.
Definition: types.hh:58

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