gem5  v20.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 class CreditLink;
45 class Router;
46 
47 class OutputUnit : public Consumer
48 {
49  public:
50  OutputUnit(int id, PortDirection direction, Router *router,
51  uint32_t consumerVcs);
52  ~OutputUnit() = default;
53  void set_out_link(NetworkLink *link);
54  void set_credit_link(CreditLink *credit_link);
55  void wakeup();
57  void print(std::ostream& out) const {};
58  void decrement_credit(int out_vc);
59  void increment_credit(int out_vc);
60  bool has_credit(int out_vc);
61  bool has_free_vc(int vnet);
62  int select_free_vc(int vnet);
63 
65 
66  int
68  {
69  return outVcState[vc].get_credit_count();
70  }
71 
72  inline int
74  {
75  return m_out_link->get_id();
76  }
77 
78  inline void
79  set_vc_state(VC_state_type state, int vc, Tick curTime)
80  {
81  outVcState[vc].setState(state, curTime);
82  }
83 
84  inline bool
85  is_vc_idle(int vc, Tick curTime)
86  {
87  return (outVcState[vc].isInState(IDLE_, curTime));
88  }
89 
90  void insert_flit(flit *t_flit);
91 
92  inline int
94  {
95  return m_vc_per_vnet;
96  }
97 
98  uint32_t functionalWrite(Packet *pkt);
99 
100  private:
107 
108  // This is for the network link to consume
110  // vc state of downstream router
112 };
113 
114 #endif // __MEM_RUBY_NETWORK_GARNET_0_OUTPUTUNIT_HH__
OutputUnit::m_credit_link
CreditLink * m_credit_link
Definition: OutputUnit.hh:106
OutputUnit::m_id
int M5_CLASS_VAR_USED m_id
Definition: OutputUnit.hh:102
OutputUnit::has_free_vc
bool has_free_vc(int vnet)
Definition: OutputUnit.cc:89
flitBuffer
Definition: flitBuffer.hh:41
OutputUnit::getOutQueue
flitBuffer * getOutQueue()
Definition: OutputUnit.cc:142
flit
Definition: flit.hh:41
OutputUnit::m_out_link
NetworkLink * m_out_link
Definition: OutputUnit.hh:105
OutputUnit::functionalWrite
uint32_t functionalWrite(Packet *pkt)
Definition: OutputUnit.cc:167
OutputUnit::has_credit
bool has_credit(int out_vc)
Definition: OutputUnit.cc:80
OutputUnit::increment_credit
void increment_credit(int out_vc)
Definition: OutputUnit.cc:65
OutputUnit::outVcState
std::vector< OutVcState > outVcState
Definition: OutputUnit.hh:111
OutputUnit::m_router
Router * m_router
Definition: OutputUnit.hh:101
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
std::vector< OutVcState >
OutputUnit::getVcsPerVnet
int getVcsPerVnet()
Definition: OutputUnit.hh:93
OutputUnit::is_vc_idle
bool is_vc_idle(int vc, Tick curTime)
Definition: OutputUnit.hh:85
CommonTypes.hh
OutputUnit::~OutputUnit
~OutputUnit()=default
IDLE_
@ IDLE_
Definition: CommonTypes.hh:40
OutputUnit::set_credit_link
void set_credit_link(CreditLink *credit_link)
Definition: OutputUnit.cc:154
M5_CLASS_VAR_USED
#define M5_CLASS_VAR_USED
Definition: compiler.hh:64
OutputUnit::get_outlink_id
int get_outlink_id()
Definition: OutputUnit.hh:73
VC_state_type
VC_state_type
Definition: CommonTypes.hh:40
OutputUnit::set_out_link
void set_out_link(NetworkLink *link)
Definition: OutputUnit.cc:148
OutputUnit::m_vc_per_vnet
int m_vc_per_vnet
Definition: OutputUnit.hh:104
Router
Definition: Router.hh:56
OutputUnit::decrement_credit
void decrement_credit(int out_vc)
Definition: OutputUnit.cc:53
Consumer
Definition: Consumer.hh:43
compiler.hh
OutputUnit::outBuffer
flitBuffer outBuffer
Definition: OutputUnit.hh:109
OutputUnit::select_free_vc
int select_free_vc(int vnet)
Definition: OutputUnit.cc:102
OutputUnit::insert_flit
void insert_flit(flit *t_flit)
Definition: OutputUnit.cc:160
OutputUnit::set_vc_state
void set_vc_state(VC_state_type state, int vc, Tick curTime)
Definition: OutputUnit.hh:79
OutVcState.hh
OutputUnit::wakeup
void wakeup()
Definition: OutputUnit.cc:124
Consumer.hh
OutputUnit
Definition: OutputUnit.hh:47
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
PortDirection
std::string PortDirection
Definition: Topology.hh:62
OutputUnit::get_direction
PortDirection get_direction()
Definition: OutputUnit.hh:64
OutputUnit::m_direction
PortDirection m_direction
Definition: OutputUnit.hh:103
OutputUnit::print
void print(std::ostream &out) const
Definition: OutputUnit.hh:57
OutputUnit::get_credit_count
int get_credit_count(int vc)
Definition: OutputUnit.hh:67
OutputUnit::OutputUnit
OutputUnit(int id, PortDirection direction, Router *router, uint32_t consumerVcs)
Definition: OutputUnit.cc:40

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