gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OutputUnit.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_OUTPUT_UNIT_HH__
35 #define __MEM_RUBY_NETWORK_GARNET_OUTPUT_UNIT_HH__
36 
37 #include <iostream>
38 #include <vector>
39 
47 
48 class OutputUnit : public Consumer
49 {
50  public:
51  OutputUnit(int id, PortDirection direction, Router *router);
52  ~OutputUnit();
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 m_outvc_state[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, Cycles curTime)
80  {
81  m_outvc_state[vc]->setState(state, curTime);
82  }
83 
84  inline bool
85  is_vc_idle(int vc, Cycles curTime)
86  {
87  return (m_outvc_state[vc]->isInState(IDLE_, curTime));
88  }
89 
90  inline void
91  insert_flit(flit *t_flit)
92  {
93  m_out_buffer->insert(t_flit);
95  }
96 
97  uint32_t functionalWrite(Packet *pkt);
98 
99  private:
100  int m_id;
107 
108  flitBuffer *m_out_buffer; // This is for the network link to consume
109  std::vector<OutVcState *> m_outvc_state; // vc state of downstream router
110 
111 };
112 
113 #endif // __MEM_RUBY_NETWORK_GARNET_OUTPUT_UNIT_HH__
void wakeup()
Definition: OutputUnit.cc:133
void set_out_link(NetworkLink *link)
Definition: OutputUnit.cc:153
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
int m_vc_per_vnet
Definition: OutputUnit.hh:103
void decrement_credit(int out_vc)
Definition: OutputUnit.cc:66
PortDirection get_direction()
Definition: OutputUnit.hh:64
CreditLink * m_credit_link
Definition: OutputUnit.hh:106
flitBuffer * getOutQueue()
Definition: OutputUnit.cc:147
void scheduleEventAbsolute(Tick timeAbs)
Definition: Consumer.cc:40
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
Definition: flit.hh:44
bool has_credit(int out_vc)
Definition: OutputUnit.cc:89
NetworkLink * m_out_link
Definition: OutputUnit.hh:105
std::string PortDirection
Definition: Topology.hh:55
PortDirection m_direction
Definition: OutputUnit.hh:101
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
void set_credit_link(CreditLink *credit_link)
Definition: OutputUnit.cc:159
int get_outlink_id()
Definition: OutputUnit.hh:73
bool has_free_vc(int vnet)
Definition: OutputUnit.cc:98
Definition: Router.hh:57
int get_credit_count(int vc)
Definition: OutputUnit.hh:67
void increment_credit(int out_vc)
Definition: OutputUnit.cc:76
Router * m_router
Definition: OutputUnit.hh:104
VC_state_type
Definition: CommonTypes.hh:42
flitBuffer * m_out_buffer
Definition: OutputUnit.hh:108
OutputUnit(int id, PortDirection direction, Router *router)
Definition: OutputUnit.cc:44
void print(std::ostream &out) const
Definition: OutputUnit.hh:57
bool is_vc_idle(int vc, Cycles curTime)
Definition: OutputUnit.hh:85
uint32_t functionalWrite(Packet *pkt)
Definition: OutputUnit.cc:165
std::vector< OutVcState * > m_outvc_state
Definition: OutputUnit.hh:109
void set_vc_state(VC_state_type state, int vc, Cycles curTime)
Definition: OutputUnit.hh:79
void insert(flit *flt)
Definition: flitBuffer.hh:73
int select_free_vc(int vnet)
Definition: OutputUnit.cc:111
void insert_flit(flit *t_flit)
Definition: OutputUnit.hh:91

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