gem5  v21.1.0.2
flit.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 
30 
31 #ifndef __MEM_RUBY_NETWORK_GARNET_0_FLIT_HH__
32 #define __MEM_RUBY_NETWORK_GARNET_0_FLIT_HH__
33 
34 #include <cassert>
35 #include <iostream>
36 
37 #include "base/types.hh"
40 
41 namespace gem5
42 {
43 
44 namespace ruby
45 {
46 
47 namespace garnet
48 {
49 
50 class flit
51 {
52  public:
53  flit() {}
54  flit(int id, int vc, int vnet, RouteInfo route, int size,
55  MsgPtr msg_ptr, int MsgSize, uint32_t bWidth, Tick curTime);
56 
57  virtual ~flit(){};
58 
59  int get_outport() {return m_outport; }
60  int get_size() { return m_size; }
63  int get_id() { return m_id; }
64  Tick get_time() { return m_time; }
65  int get_vnet() { return m_vnet; }
66  int get_vc() { return m_vc; }
67  RouteInfo get_route() { return m_route; }
68  MsgPtr& get_msg_ptr() { return m_msg_ptr; }
69  flit_type get_type() { return m_type; }
72 
73  void set_outport(int port) { m_outport = port; }
74  void set_time(Tick time) { m_time = time; }
75  void set_vc(int vc) { m_vc = vc; }
76  void set_route(RouteInfo route) { m_route = route; }
77  void set_src_delay(Tick delay) { src_delay = delay; }
78  void set_dequeue_time(Tick time) { m_dequeue_time = time; }
79  void set_enqueue_time(Tick time) { m_enqueue_time = time; }
80 
82  virtual void print(std::ostream& out) const;
83 
84  bool
85  is_stage(flit_stage stage, Tick time)
86  {
87  return (stage == m_stage.first &&
88  time >= m_stage.second);
89  }
90 
91  void
92  advance_stage(flit_stage t_stage, Tick newTime)
93  {
94  m_stage.first = t_stage;
95  m_stage.second = newTime;
96  }
97 
98  static bool
99  greater(flit* n1, flit* n2)
100  {
101  if (n1->get_time() == n2->get_time()) {
102  //assert(n1->flit_id != n2->flit_id);
103  return (n1->get_id() > n2->get_id());
104  } else {
105  return (n1->get_time() > n2->get_time());
106  }
107  }
108 
109  bool functionalWrite(Packet *pkt);
110 
111  virtual flit* serialize(int ser_id, int parts, uint32_t bWidth);
112  virtual flit* deserialize(int des_id, int num_flits, uint32_t bWidth);
113 
114  uint32_t m_width;
115  int msgSize;
116  protected:
117  int m_id;
118  int m_vnet;
119  int m_vc;
121  int m_size;
129 };
130 
131 inline std::ostream&
132 operator<<(std::ostream& out, const flit& obj)
133 {
134  obj.print(out);
135  out << std::flush;
136  return out;
137 }
138 
139 } // namespace garnet
140 } // namespace ruby
141 } // namespace gem5
142 
143 #endif // __MEM_RUBY_NETWORK_GARNET_0_FLIT_HH__
gem5::ruby::garnet::flit
Definition: flit.hh:50
gem5::ruby::garnet::flit::src_delay
Tick src_delay
Definition: flit.hh:127
gem5::ruby::garnet::flit::get_outport
int get_outport()
Definition: flit.hh:59
gem5::ruby::garnet::flit::m_route
RouteInfo m_route
Definition: flit.hh:120
gem5::ruby::garnet::flit::functionalWrite
bool functionalWrite(Packet *pkt)
Definition: flit.cc:127
gem5::ruby::garnet::flit::set_vc
void set_vc(int vc)
Definition: flit.hh:75
gem5::ruby::MsgPtr
std::shared_ptr< Message > MsgPtr
Definition: Message.hh:59
gem5::ruby::garnet::flit::m_size
int m_size
Definition: flit.hh:121
gem5::ruby::garnet::flit::is_stage
bool is_stage(flit_stage stage, Tick time)
Definition: flit.hh:85
gem5::ruby::garnet::flit::get_vnet
int get_vnet()
Definition: flit.hh:65
gem5::ruby::garnet::flit::set_dequeue_time
void set_dequeue_time(Tick time)
Definition: flit.hh:78
gem5::ruby::garnet::flit::m_vc
int m_vc
Definition: flit.hh:119
gem5::ruby::garnet::flit_type
flit_type
Definition: CommonTypes.hh:47
gem5::ruby::garnet::flit::m_outport
int m_outport
Definition: flit.hh:126
gem5::ruby::garnet::flit::m_dequeue_time
Tick m_dequeue_time
Definition: flit.hh:122
gem5::ruby::garnet::flit::increment_hops
void increment_hops()
Definition: flit.hh:81
gem5::ruby::garnet::flit::set_time
void set_time(Tick time)
Definition: flit.hh:74
gem5::ruby::garnet::RouteInfo
Definition: CommonTypes.hh:56
gem5::ruby::garnet::flit::deserialize
virtual flit * deserialize(int des_id, int num_flits, uint32_t bWidth)
Definition: flit.cc:93
gem5::ruby::garnet::flit::msgSize
int msgSize
Definition: flit.hh:115
gem5::ruby::garnet::flit::flit
flit()
Definition: flit.hh:53
gem5::ruby::garnet::flit::m_stage
std::pair< flit_stage, Tick > m_stage
Definition: flit.hh:128
CommonTypes.hh
gem5::ruby::garnet::flit::set_src_delay
void set_src_delay(Tick delay)
Definition: flit.hh:77
gem5::ruby::garnet::flit::m_vnet
int m_vnet
Definition: flit.hh:118
gem5::ruby::garnet::flit::get_msg_ptr
MsgPtr & get_msg_ptr()
Definition: flit.hh:68
gem5::ruby::garnet::flit::set_route
void set_route(RouteInfo route)
Definition: flit.hh:76
gem5::ruby::garnet::flit::set_enqueue_time
void set_enqueue_time(Tick time)
Definition: flit.hh:79
gem5::ruby::garnet::flit::get_vc
int get_vc()
Definition: flit.hh:66
gem5::ruby::garnet::operator<<
std::ostream & operator<<(std::ostream &out, const flit &obj)
Definition: flit.hh:132
gem5::ruby::garnet::flit::get_route
RouteInfo get_route()
Definition: flit.hh:67
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::ruby::garnet::flit::get_enqueue_time
Tick get_enqueue_time()
Definition: flit.hh:61
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ruby::garnet::flit::get_id
int get_id()
Definition: flit.hh:63
gem5::ruby::garnet::flit::m_time
Tick m_time
Definition: flit.hh:123
gem5::ruby::garnet::flit::m_id
int m_id
Definition: flit.hh:117
std::pair< flit_stage, Tick >
gem5::ruby::garnet::flit_stage
flit_stage
Definition: CommonTypes.hh:51
gem5::ruby::garnet::RouteInfo::hops_traversed
int hops_traversed
Definition: CommonTypes.hh:72
gem5::ruby::garnet::flit::m_type
flit_type m_type
Definition: flit.hh:124
gem5::ruby::garnet::flit::greater
static bool greater(flit *n1, flit *n2)
Definition: flit.hh:99
gem5::ruby::garnet::flit::advance_stage
void advance_stage(flit_stage t_stage, Tick newTime)
Definition: flit.hh:92
gem5::ruby::garnet::flit::~flit
virtual ~flit()
Definition: flit.hh:57
gem5::ruby::garnet::flit::set_outport
void set_outport(int port)
Definition: flit.hh:73
types.hh
gem5::ruby::garnet::flit::get_time
Tick get_time()
Definition: flit.hh:64
gem5::ruby::garnet::flit::get_src_delay
Tick get_src_delay()
Definition: flit.hh:71
gem5::ruby::garnet::flit::get_dequeue_time
Tick get_dequeue_time()
Definition: flit.hh:62
gem5::ruby::garnet::flit::m_enqueue_time
Tick m_enqueue_time
Definition: flit.hh:122
gem5::ruby::garnet::flit::print
virtual void print(std::ostream &out) const
Definition: flit.cc:109
gem5::ruby::garnet::flit::get_type
flit_type get_type()
Definition: flit.hh:69
gem5::ruby::garnet::flit::get_size
int get_size()
Definition: flit.hh:60
gem5::ruby::garnet::flit::get_stage
std::pair< flit_stage, Tick > get_stage()
Definition: flit.hh:70
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
Message.hh
gem5::ruby::garnet::flit::m_width
uint32_t m_width
Definition: flit.hh:114
gem5::ruby::garnet::flit::serialize
virtual flit * serialize(int ser_id, int parts, uint32_t bWidth)
Definition: flit.cc:76
gem5::ruby::garnet::flit::m_msg_ptr
MsgPtr m_msg_ptr
Definition: flit.hh:125

Generated on Tue Sep 21 2021 12:25:40 for gem5 by doxygen 1.8.17