gem5  v22.1.0.0
OutputUnit.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_OUTPUTUNIT_HH__
33 #define __MEM_RUBY_NETWORK_GARNET_0_OUTPUTUNIT_HH__
34 
35 #include <iostream>
36 #include <vector>
37 
38 #include "base/compiler.hh"
43 
44 namespace gem5
45 {
46 
47 namespace ruby
48 {
49 
50 namespace garnet
51 {
52 
53 class CreditLink;
54 class Router;
55 
56 class OutputUnit : public Consumer
57 {
58  public:
59  OutputUnit(int id, PortDirection direction, Router *router,
60  uint32_t consumerVcs);
61  ~OutputUnit() = default;
62  void set_out_link(NetworkLink *link);
63  void set_credit_link(CreditLink *credit_link);
64  void wakeup();
66  void print(std::ostream& out) const {};
67  void decrement_credit(int out_vc);
68  void increment_credit(int out_vc);
69  bool has_credit(int out_vc);
70  bool has_free_vc(int vnet);
71  int select_free_vc(int vnet);
72 
74 
75  int
77  {
78  return outVcState[vc].get_credit_count();
79  }
80 
81  inline int
83  {
84  return m_out_link->get_id();
85  }
86 
87  inline void
89  {
90  outVcState[vc].setState(state, curTime);
91  }
92 
93  inline bool
94  is_vc_idle(int vc, Tick curTime)
95  {
96  return (outVcState[vc].isInState(IDLE_, curTime));
97  }
98 
99  void insert_flit(flit *t_flit);
100 
101  inline int
103  {
104  return m_vc_per_vnet;
105  }
106 
107  bool functionalRead(Packet *pkt, WriteMask &mask);
108  uint32_t functionalWrite(Packet *pkt);
109 
110  private:
117 
118  // This is for the network link to consume
120  // vc state of downstream router
122 };
123 
124 } // namespace garnet
125 } // namespace ruby
126 } // namespace gem5
127 
128 #endif // __MEM_RUBY_NETWORK_GARNET_0_OUTPUTUNIT_HH__
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
void increment_credit(int out_vc)
Definition: OutputUnit.cc:74
GEM5_CLASS_VAR_USED int m_id
Definition: OutputUnit.hh:112
void set_out_link(NetworkLink *link)
Definition: OutputUnit.cc:157
void decrement_credit(int out_vc)
Definition: OutputUnit.cc:62
uint32_t functionalWrite(Packet *pkt)
Definition: OutputUnit.cc:182
bool has_credit(int out_vc)
Definition: OutputUnit.cc:89
void set_vc_state(VC_state_type state, int vc, Tick curTime)
Definition: OutputUnit.hh:88
bool functionalRead(Packet *pkt, WriteMask &mask)
Definition: OutputUnit.cc:176
std::vector< OutVcState > outVcState
Definition: OutputUnit.hh:121
void insert_flit(flit *t_flit)
Definition: OutputUnit.cc:169
bool is_vc_idle(int vc, Tick curTime)
Definition: OutputUnit.hh:94
void set_credit_link(CreditLink *credit_link)
Definition: OutputUnit.cc:163
PortDirection get_direction()
Definition: OutputUnit.hh:73
void print(std::ostream &out) const
Definition: OutputUnit.hh:66
OutputUnit(int id, PortDirection direction, Router *router, uint32_t consumerVcs)
Definition: OutputUnit.cc:49
STL vector class.
Definition: stl.hh:37
#define GEM5_CLASS_VAR_USED
Definition: compiler.hh:141
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
atomic_var_t state
Definition: helpers.cc:188
std::string PortDirection
Definition: TypeDefines.hh:44
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