gem5  v20.1.0.0
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 class InputUnit : public Consumer
47 {
48  public:
49  InputUnit(int id, PortDirection direction, Router *router);
50  ~InputUnit() = default;
51 
52  void wakeup();
53  void print(std::ostream& out) const {};
54 
56 
57  inline void
58  set_vc_idle(int vc, Tick curTime)
59  {
60  virtualChannels[vc].set_idle(curTime);
61  }
62 
63  inline void
64  set_vc_active(int vc, Tick curTime)
65  {
66  virtualChannels[vc].set_active(curTime);
67  }
68 
69  inline void
70  grant_outport(int vc, int outport)
71  {
72  virtualChannels[vc].set_outport(outport);
73  }
74 
75  inline void
76  grant_outvc(int vc, int outvc)
77  {
78  virtualChannels[vc].set_outvc(outvc);
79  }
80 
81  inline int
82  get_outport(int invc)
83  {
84  return virtualChannels[invc].get_outport();
85  }
86 
87  inline int
88  get_outvc(int invc)
89  {
90  return virtualChannels[invc].get_outvc();
91  }
92 
93  inline Tick
94  get_enqueue_time(int invc)
95  {
96  return virtualChannels[invc].get_enqueue_time();
97  }
98 
99  void increment_credit(int in_vc, bool free_signal, Tick curTime);
100 
101  inline flit*
102  peekTopFlit(int vc)
103  {
104  return virtualChannels[vc].peekTopFlit();
105  }
106 
107  inline flit*
108  getTopFlit(int vc)
109  {
110  return virtualChannels[vc].getTopFlit();
111  }
112 
113  inline bool
114  need_stage(int vc, flit_stage stage, Tick time)
115  {
116  return virtualChannels[vc].need_stage(stage, time);
117  }
118 
119  inline bool
120  isReady(int invc, Tick curTime)
121  {
122  return virtualChannels[invc].isReady(curTime);
123  }
124 
126 
127  inline void
129  {
130  m_in_link = link;
131  }
132 
133  inline int get_inlink_id() { return m_in_link->get_id(); }
134 
135  inline void
137  {
138  m_credit_link = credit_link;
139  }
140 
141  double get_buf_read_activity(unsigned int vnet) const
142  { return m_num_buffer_reads[vnet]; }
143  double get_buf_write_activity(unsigned int vnet) const
144  { return m_num_buffer_writes[vnet]; }
145 
146  uint32_t functionalWrite(Packet *pkt);
147  void resetStats();
148 
149  private:
151  int m_id;
157 
158  // Input Virtual channels
160 
161  // Statistical variables
164 };
165 
166 #endif // __MEM_RUBY_NETWORK_GARNET_0_INPUTUNIT_HH__
InputUnit::m_num_buffer_reads
std::vector< double > m_num_buffer_reads
Definition: InputUnit.hh:163
flitBuffer
Definition: flitBuffer.hh:41
flit
Definition: flit.hh:41
InputUnit::m_id
int m_id
Definition: InputUnit.hh:151
InputUnit::print
void print(std::ostream &out) const
Definition: InputUnit.hh:53
InputUnit::set_vc_idle
void set_vc_idle(int vc, Tick curTime)
Definition: InputUnit.hh:58
InputUnit::set_vc_active
void set_vc_active(int vc, Tick curTime)
Definition: InputUnit.hh:64
flit_stage
flit_stage
Definition: CommonTypes.hh:42
InputUnit::set_credit_link
void set_credit_link(CreditLink *credit_link)
Definition: InputUnit.hh:136
InputUnit::getCreditQueue
flitBuffer * getCreditQueue()
Definition: InputUnit.hh:125
InputUnit::get_buf_read_activity
double get_buf_read_activity(unsigned int vnet) const
Definition: InputUnit.hh:141
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
std::vector< VirtualChannel >
InputUnit::m_num_buffer_writes
std::vector< double > m_num_buffer_writes
Definition: InputUnit.hh:162
CommonTypes.hh
InputUnit::get_inlink_id
int get_inlink_id()
Definition: InputUnit.hh:133
flitBuffer.hh
InputUnit::m_router
Router * m_router
Definition: InputUnit.hh:150
InputUnit::get_direction
PortDirection get_direction()
Definition: InputUnit.hh:55
InputUnit::InputUnit
InputUnit(int id, PortDirection direction, Router *router)
Definition: InputUnit.cc:40
InputUnit::getTopFlit
flit * getTopFlit(int vc)
Definition: InputUnit.hh:108
InputUnit::grant_outvc
void grant_outvc(int vc, int outvc)
Definition: InputUnit.hh:76
Router
Definition: Router.hh:56
InputUnit::get_buf_write_activity
double get_buf_write_activity(unsigned int vnet) const
Definition: InputUnit.hh:143
InputUnit::get_enqueue_time
Tick get_enqueue_time(int invc)
Definition: InputUnit.hh:94
Consumer
Definition: Consumer.hh:43
InputUnit::get_outvc
int get_outvc(int invc)
Definition: InputUnit.hh:88
InputUnit::m_credit_link
CreditLink * m_credit_link
Definition: InputUnit.hh:155
InputUnit::m_vc_per_vnet
int m_vc_per_vnet
Definition: InputUnit.hh:153
VirtualChannel.hh
InputUnit::grant_outport
void grant_outport(int vc, int outport)
Definition: InputUnit.hh:70
InputUnit::~InputUnit
~InputUnit()=default
InputUnit::m_direction
PortDirection m_direction
Definition: InputUnit.hh:152
InputUnit::increment_credit
void increment_credit(int in_vc, bool free_signal, Tick curTime)
Definition: InputUnit.cc:138
InputUnit::peekTopFlit
flit * peekTopFlit(int vc)
Definition: InputUnit.hh:102
InputUnit::wakeup
void wakeup()
Definition: InputUnit.cc:70
InputUnit::need_stage
bool need_stage(int vc, flit_stage stage, Tick time)
Definition: InputUnit.hh:114
Consumer.hh
InputUnit::functionalWrite
uint32_t functionalWrite(Packet *pkt)
Definition: InputUnit.cc:149
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
InputUnit::virtualChannels
std::vector< VirtualChannel > virtualChannels
Definition: InputUnit.hh:159
PortDirection
std::string PortDirection
Definition: Topology.hh:62
InputUnit::set_in_link
void set_in_link(NetworkLink *link)
Definition: InputUnit.hh:128
InputUnit::get_outport
int get_outport(int invc)
Definition: InputUnit.hh:82
InputUnit::m_in_link
NetworkLink * m_in_link
Definition: InputUnit.hh:154
InputUnit::creditQueue
flitBuffer creditQueue
Definition: InputUnit.hh:156
InputUnit::isReady
bool isReady(int invc, Tick curTime)
Definition: InputUnit.hh:120
InputUnit
Definition: InputUnit.hh:46
InputUnit::resetStats
void resetStats()
Definition: InputUnit.cc:160
Router.hh

Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17