gem5  v21.1.0.2
InputUnit.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Inria
3  * Copyright (c) 2016 Georgia Institute of Technology
4  * Copyright (c) 2008 Princeton University
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_INPUTUNIT_HH__
33 #define __MEM_RUBY_NETWORK_GARNET_0_INPUTUNIT_HH__
34 
35 #include <iostream>
36 #include <vector>
37 
45 
46 namespace gem5
47 {
48 
49 namespace ruby
50 {
51 
52 namespace garnet
53 {
54 
55 class InputUnit : public Consumer
56 {
57  public:
58  InputUnit(int id, PortDirection direction, Router *router);
59  ~InputUnit() = default;
60 
61  void wakeup();
62  void print(std::ostream& out) const {};
63 
65 
66  inline void
67  set_vc_idle(int vc, Tick curTime)
68  {
69  virtualChannels[vc].set_idle(curTime);
70  }
71 
72  inline void
73  set_vc_active(int vc, Tick curTime)
74  {
75  virtualChannels[vc].set_active(curTime);
76  }
77 
78  inline void
79  grant_outport(int vc, int outport)
80  {
81  virtualChannels[vc].set_outport(outport);
82  }
83 
84  inline void
85  grant_outvc(int vc, int outvc)
86  {
87  virtualChannels[vc].set_outvc(outvc);
88  }
89 
90  inline int
91  get_outport(int invc)
92  {
93  return virtualChannels[invc].get_outport();
94  }
95 
96  inline int
97  get_outvc(int invc)
98  {
99  return virtualChannels[invc].get_outvc();
100  }
101 
102  inline Tick
104  {
105  return virtualChannels[invc].get_enqueue_time();
106  }
107 
108  void increment_credit(int in_vc, bool free_signal, Tick curTime);
109 
110  inline flit*
111  peekTopFlit(int vc)
112  {
113  return virtualChannels[vc].peekTopFlit();
114  }
115 
116  inline flit*
117  getTopFlit(int vc)
118  {
119  return virtualChannels[vc].getTopFlit();
120  }
121 
122  inline bool
123  need_stage(int vc, flit_stage stage, Tick time)
124  {
125  return virtualChannels[vc].need_stage(stage, time);
126  }
127 
128  inline bool
129  isReady(int invc, Tick curTime)
130  {
131  return virtualChannels[invc].isReady(curTime);
132  }
133 
135 
136  inline void
138  {
139  m_in_link = link;
140  }
141 
142  inline int get_inlink_id() { return m_in_link->get_id(); }
143 
144  inline void
146  {
147  m_credit_link = credit_link;
148  }
149 
150  double get_buf_read_activity(unsigned int vnet) const
151  { return m_num_buffer_reads[vnet]; }
152  double get_buf_write_activity(unsigned int vnet) const
153  { return m_num_buffer_writes[vnet]; }
154 
155  uint32_t functionalWrite(Packet *pkt);
156  void resetStats();
157 
158  private:
160  int m_id;
166 
167  // Input Virtual channels
169 
170  // Statistical variables
173 };
174 
175 } // namespace garnet
176 } // namespace ruby
177 } // namespace gem5
178 
179 #endif // __MEM_RUBY_NETWORK_GARNET_0_INPUTUNIT_HH__
gem5::ruby::garnet::InputUnit::resetStats
void resetStats()
Definition: InputUnit.cc:167
gem5::ruby::garnet::flit
Definition: flit.hh:50
gem5::ruby::garnet::InputUnit::grant_outport
void grant_outport(int vc, int outport)
Definition: InputUnit.hh:79
gem5::ruby::garnet::InputUnit::set_credit_link
void set_credit_link(CreditLink *credit_link)
Definition: InputUnit.hh:145
gem5::ruby::garnet::InputUnit::increment_credit
void increment_credit(int in_vc, bool free_signal, Tick curTime)
Definition: InputUnit.cc:145
gem5::ruby::PortDirection
std::string PortDirection
Definition: Topology.hh:68
gem5::ruby::garnet::InputUnit::get_outport
int get_outport(int invc)
Definition: InputUnit.hh:91
gem5::ruby::garnet::InputUnit::get_inlink_id
int get_inlink_id()
Definition: InputUnit.hh:142
gem5::ruby::garnet::InputUnit::peekTopFlit
flit * peekTopFlit(int vc)
Definition: InputUnit.hh:111
gem5::ruby::garnet::Router
Definition: Router.hh:66
gem5::ruby::garnet::InputUnit::m_router
Router * m_router
Definition: InputUnit.hh:159
std::vector
STL vector class.
Definition: stl.hh:37
gem5::ruby::Consumer
Definition: Consumer.hh:61
CommonTypes.hh
gem5::ruby::garnet::InputUnit::set_vc_idle
void set_vc_idle(int vc, Tick curTime)
Definition: InputUnit.hh:67
gem5::ruby::garnet::InputUnit::getCreditQueue
flitBuffer * getCreditQueue()
Definition: InputUnit.hh:134
flitBuffer.hh
gem5::ruby::garnet::InputUnit::m_credit_link
CreditLink * m_credit_link
Definition: InputUnit.hh:164
gem5::ruby::garnet::InputUnit::set_vc_active
void set_vc_active(int vc, Tick curTime)
Definition: InputUnit.hh:73
gem5::ruby::garnet::InputUnit::get_direction
PortDirection get_direction()
Definition: InputUnit.hh:64
gem5::ruby::garnet::InputUnit::getTopFlit
flit * getTopFlit(int vc)
Definition: InputUnit.hh:117
gem5::ruby::garnet::InputUnit::set_in_link
void set_in_link(NetworkLink *link)
Definition: InputUnit.hh:137
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ruby::garnet::InputUnit::functionalWrite
uint32_t functionalWrite(Packet *pkt)
Definition: InputUnit.cc:156
gem5::ruby::garnet::InputUnit::virtualChannels
std::vector< VirtualChannel > virtualChannels
Definition: InputUnit.hh:168
gem5::ruby::garnet::InputUnit::get_buf_read_activity
double get_buf_read_activity(unsigned int vnet) const
Definition: InputUnit.hh:150
VirtualChannel.hh
gem5::ruby::garnet::InputUnit::InputUnit
InputUnit(int id, PortDirection direction, Router *router)
Definition: InputUnit.cc:47
gem5::ruby::garnet::InputUnit
Definition: InputUnit.hh:55
gem5::ruby::garnet::InputUnit::creditQueue
flitBuffer creditQueue
Definition: InputUnit.hh:165
gem5::ruby::garnet::InputUnit::m_num_buffer_reads
std::vector< double > m_num_buffer_reads
Definition: InputUnit.hh:172
gem5::ruby::garnet::InputUnit::get_buf_write_activity
double get_buf_write_activity(unsigned int vnet) const
Definition: InputUnit.hh:152
gem5::ruby::garnet::flit_stage
flit_stage
Definition: CommonTypes.hh:51
gem5::ruby::garnet::InputUnit::get_enqueue_time
Tick get_enqueue_time(int invc)
Definition: InputUnit.hh:103
Consumer.hh
gem5::ruby::garnet::InputUnit::m_direction
PortDirection m_direction
Definition: InputUnit.hh:161
gem5::ruby::garnet::InputUnit::~InputUnit
~InputUnit()=default
gem5::ruby::garnet::InputUnit::m_in_link
NetworkLink * m_in_link
Definition: InputUnit.hh:163
gem5::ruby::garnet::flitBuffer
Definition: flitBuffer.hh:50
gem5::ruby::garnet::InputUnit::grant_outvc
void grant_outvc(int vc, int outvc)
Definition: InputUnit.hh:85
gem5::ruby::garnet::InputUnit::get_outvc
int get_outvc(int invc)
Definition: InputUnit.hh:97
gem5::ruby::garnet::InputUnit::wakeup
void wakeup()
Definition: InputUnit.cc:77
gem5::ruby::garnet::InputUnit::m_num_buffer_writes
std::vector< double > m_num_buffer_writes
Definition: InputUnit.hh:171
gem5::ruby::garnet::InputUnit::m_vc_per_vnet
int m_vc_per_vnet
Definition: InputUnit.hh:162
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ruby::garnet::InputUnit::need_stage
bool need_stage(int vc, flit_stage stage, Tick time)
Definition: InputUnit.hh:123
gem5::ruby::garnet::InputUnit::isReady
bool isReady(int invc, Tick curTime)
Definition: InputUnit.hh:129
gem5::ruby::garnet::InputUnit::print
void print(std::ostream &out) const
Definition: InputUnit.hh:62
Router.hh
gem5::ruby::garnet::InputUnit::m_id
int m_id
Definition: InputUnit.hh:160

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