gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
46namespace gem5
47{
48
49namespace ruby
50{
51
52namespace garnet
53{
54
55class 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*
112 {
113 return virtualChannels[vc].peekTopFlit();
114 }
115
116 inline flit*
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 bool functionalRead(Packet *pkt, WriteMask &mask);
156 uint32_t functionalWrite(Packet *pkt);
157
158 void resetStats();
159
160 private:
162 int m_id;
168
169 // Input Virtual channels
171
172 // Statistical variables
175};
176
177} // namespace garnet
178} // namespace ruby
179} // namespace gem5
180
181#endif // __MEM_RUBY_NETWORK_GARNET_0_INPUTUNIT_HH__
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
std::vector< double > m_num_buffer_reads
Definition InputUnit.hh:174
void set_vc_active(int vc, Tick curTime)
Definition InputUnit.hh:73
PortDirection get_direction()
Definition InputUnit.hh:64
std::vector< VirtualChannel > virtualChannels
Definition InputUnit.hh:170
void grant_outport(int vc, int outport)
Definition InputUnit.hh:79
void print(std::ostream &out) const
Definition InputUnit.hh:62
void set_credit_link(CreditLink *credit_link)
Definition InputUnit.hh:145
bool need_stage(int vc, flit_stage stage, Tick time)
Definition InputUnit.hh:123
double get_buf_write_activity(unsigned int vnet) const
Definition InputUnit.hh:152
void set_in_link(NetworkLink *link)
Definition InputUnit.hh:137
bool isReady(int invc, Tick curTime)
Definition InputUnit.hh:129
InputUnit(int id, PortDirection direction, Router *router)
Definition InputUnit.cc:47
Tick get_enqueue_time(int invc)
Definition InputUnit.hh:103
void increment_credit(int in_vc, bool free_signal, Tick curTime)
Definition InputUnit.cc:145
bool functionalRead(Packet *pkt, WriteMask &mask)
Definition InputUnit.cc:155
uint32_t functionalWrite(Packet *pkt)
Definition InputUnit.cc:167
void set_vc_idle(int vc, Tick curTime)
Definition InputUnit.hh:67
void grant_outvc(int vc, int outvc)
Definition InputUnit.hh:85
std::vector< double > m_num_buffer_writes
Definition InputUnit.hh:173
double get_buf_read_activity(unsigned int vnet) const
Definition InputUnit.hh:150
STL vector class.
Definition stl.hh:37
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
std::string PortDirection
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Tick
Tick count type.
Definition types.hh:58

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0