gem5  v21.1.0.2
flitBuffer.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Advanced Micro Devices, Inc.
3  * Copyright (c) 2008 Princeton University
4  * Copyright (c) 2016 Georgia Institute of Technology
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 
33 
34 namespace gem5
35 {
36 
37 namespace ruby
38 {
39 
40 namespace garnet
41 {
42 
44 {
46 }
47 
48 flitBuffer::flitBuffer(int maximum_size)
49 {
50  max_size = maximum_size;
51 }
52 
53 bool
55 {
56  return (m_buffer.size() == 0);
57 }
58 
59 bool
61 {
62  if (m_buffer.size() != 0 ) {
63  flit *t_flit = peekTopFlit();
64  if (t_flit->get_time() <= curTime)
65  return true;
66  }
67  return false;
68 }
69 
70 void
71 flitBuffer::print(std::ostream& out) const
72 {
73  out << "[flitBuffer: " << m_buffer.size() << "] " << std::endl;
74 }
75 
76 bool
78 {
79  return (m_buffer.size() >= max_size);
80 }
81 
82 void
84 {
85  max_size = maximum;
86 }
87 
88 uint32_t
90 {
91  uint32_t num_functional_writes = 0;
92 
93  for (unsigned int i = 0; i < m_buffer.size(); ++i) {
94  if (m_buffer[i]->functionalWrite(pkt)) {
95  num_functional_writes++;
96  }
97  }
98 
99  return num_functional_writes;
100 }
101 
102 } // namespace garnet
103 } // namespace ruby
104 } // namespace gem5
gem5::ruby::garnet::flit
Definition: flit.hh:50
gem5::ruby::garnet::flitBuffer::flitBuffer
flitBuffer()
Definition: flitBuffer.cc:43
gem5::ruby::garnet::flitBuffer::peekTopFlit
flit * peekTopFlit()
Definition: flitBuffer.hh:72
gem5::ruby::garnet::flitBuffer::m_buffer
std::deque< flit * > m_buffer
Definition: flitBuffer.hh:86
gem5::ruby::garnet::flitBuffer::isReady
bool isReady(Tick curTime)
Definition: flitBuffer.cc:60
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:66
flitBuffer.hh
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::flitBuffer::setMaxSize
void setMaxSize(int maximum)
Definition: flitBuffer.cc:83
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ruby::garnet::flitBuffer::isFull
bool isFull()
Definition: flitBuffer.cc:77
gem5::ruby::garnet::flitBuffer::functionalWrite
uint32_t functionalWrite(Packet *pkt)
Definition: flitBuffer.cc:89
gem5::ruby::garnet::flit::get_time
Tick get_time()
Definition: flit.hh:64
gem5::ruby::garnet::flitBuffer::print
void print(std::ostream &out) const
Definition: flitBuffer.cc:71
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ruby::garnet::flitBuffer::isEmpty
bool isEmpty()
Definition: flitBuffer.cc:54
gem5::ruby::garnet::flitBuffer::max_size
int max_size
Definition: flitBuffer.hh:87
INFINITE_
#define INFINITE_
Definition: CommonTypes.hh:75

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