gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InputUnit.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 Princeton University
3  * Copyright (c) 2016 Georgia Institute of Technology
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Authors: Niket Agarwal
30  * Tushar Krishna
31  */
32 
33 
34 #ifndef __MEM_RUBY_NETWORK_GARNET_INPUT_UNIT_HH__
35 #define __MEM_RUBY_NETWORK_GARNET_INPUT_UNIT_HH__
36 
37 #include <iostream>
38 #include <vector>
39 
47 
48 class InputUnit : public Consumer
49 {
50  public:
51  InputUnit(int id, PortDirection direction, Router *router);
52  ~InputUnit();
53 
54  void wakeup();
55  void print(std::ostream& out) const {};
56 
58 
59  inline void
60  set_vc_idle(int vc, Cycles curTime)
61  {
62  m_vcs[vc]->set_idle(curTime);
63  }
64 
65  inline void
66  set_vc_active(int vc, Cycles curTime)
67  {
68  m_vcs[vc]->set_active(curTime);
69  }
70 
71  inline void
72  grant_outport(int vc, int outport)
73  {
74  m_vcs[vc]->set_outport(outport);
75  }
76 
77  inline void
78  grant_outvc(int vc, int outvc)
79  {
80  m_vcs[vc]->set_outvc(outvc);
81  }
82 
83  inline int
84  get_outport(int invc)
85  {
86  return m_vcs[invc]->get_outport();
87  }
88 
89  inline int
90  get_outvc(int invc)
91  {
92  return m_vcs[invc]->get_outvc();
93  }
94 
95  inline Cycles
96  get_enqueue_time(int invc)
97  {
98  return m_vcs[invc]->get_enqueue_time();
99  }
100 
101  void increment_credit(int in_vc, bool free_signal, Cycles curTime);
102 
103  inline flit*
104  peekTopFlit(int vc)
105  {
106  return m_vcs[vc]->peekTopFlit();
107  }
108 
109  inline flit*
110  getTopFlit(int vc)
111  {
112  return m_vcs[vc]->getTopFlit();
113  }
114 
115  inline bool
116  need_stage(int vc, flit_stage stage, Cycles time)
117  {
118  return m_vcs[vc]->need_stage(stage, time);
119  }
120 
121  inline bool
122  isReady(int invc, Cycles curTime)
123  {
124  return m_vcs[invc]->isReady(curTime);
125  }
126 
128 
129  inline void
131  {
132  m_in_link = link;
133  }
134 
135  inline int get_inlink_id() { return m_in_link->get_id(); }
136 
137  inline void
139  {
140  m_credit_link = credit_link;
141  }
142 
143  double get_buf_read_activity(unsigned int vnet) const
144  { return m_num_buffer_reads[vnet]; }
145  double get_buf_write_activity(unsigned int vnet) const
146  { return m_num_buffer_writes[vnet]; }
147 
148  uint32_t functionalWrite(Packet *pkt);
149  void resetStats();
150 
151  private:
152  int m_id;
156 
161 
162  // Input Virtual channels
164 
165  // Statistical variables
168 };
169 
170 #endif // __MEM_RUBY_NETWORK_GARNET_INPUT_UNIT_HH__
void print(std::ostream &out) const
Definition: InputUnit.hh:55
~InputUnit()
Definition: InputUnit.cc:68
void set_in_link(NetworkLink *link)
Definition: InputUnit.hh:130
int m_vc_per_vnet
Definition: InputUnit.hh:155
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
void set_vc_active(int vc, Cycles curTime)
Definition: InputUnit.hh:66
InputUnit(int id, PortDirection direction, Router *router)
Definition: InputUnit.cc:44
bool need_stage(int vc, flit_stage stage, Cycles time)
Definition: InputUnit.hh:116
int get_outvc(int invc)
Definition: InputUnit.hh:90
CreditLink * m_credit_link
Definition: InputUnit.hh:159
void set_vc_idle(int vc, Cycles curTime)
Definition: InputUnit.hh:60
int get_outport(int invc)
Definition: InputUnit.hh:84
void set_credit_link(CreditLink *credit_link)
Definition: InputUnit.hh:138
double get_buf_read_activity(unsigned int vnet) const
Definition: InputUnit.hh:143
std::vector< double > m_num_buffer_reads
Definition: InputUnit.hh:167
std::vector< double > m_num_buffer_writes
Definition: InputUnit.hh:166
Cycles get_enqueue_time(int invc)
Definition: InputUnit.hh:96
Definition: flit.hh:44
flitBuffer * creditQueue
Definition: InputUnit.hh:160
Router * m_router
Definition: InputUnit.hh:157
int get_inlink_id()
Definition: InputUnit.hh:135
std::vector< VirtualChannel * > m_vcs
Definition: InputUnit.hh:163
flit * getTopFlit(int vc)
Definition: InputUnit.hh:110
std::string PortDirection
Definition: Topology.hh:55
uint32_t functionalWrite(Packet *pkt)
Definition: InputUnit.cc:154
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
PortDirection m_direction
Definition: InputUnit.hh:153
void increment_credit(int in_vc, bool free_signal, Cycles curTime)
Definition: InputUnit.cc:145
void resetStats()
Definition: InputUnit.cc:165
Definition: Router.hh:57
void wakeup()
Definition: InputUnit.cc:85
double get_buf_write_activity(unsigned int vnet) const
Definition: InputUnit.hh:145
void grant_outport(int vc, int outport)
Definition: InputUnit.hh:72
flit_stage
Definition: CommonTypes.hh:44
void grant_outvc(int vc, int outvc)
Definition: InputUnit.hh:78
int m_num_vcs
Definition: InputUnit.hh:154
PortDirection get_direction()
Definition: InputUnit.hh:57
flitBuffer * getCreditQueue()
Definition: InputUnit.hh:127
bool isReady(int invc, Cycles curTime)
Definition: InputUnit.hh:122
flit * peekTopFlit(int vc)
Definition: InputUnit.hh:104
NetworkLink * m_in_link
Definition: InputUnit.hh:158

Generated on Fri Jun 9 2017 13:03:49 for gem5 by doxygen 1.8.6