gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
34namespace gem5
35{
36
37namespace ruby
38{
39
40namespace garnet
41{
42
47
48flitBuffer::flitBuffer(int maximum_size)
49{
50 max_size = maximum_size;
51}
52
53bool
55{
56 return (m_buffer.size() == 0);
57}
58
59bool
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
70void
71flitBuffer::print(std::ostream& out) const
72{
73 out << "[flitBuffer: " << m_buffer.size() << "] " << std::endl;
74}
75
76bool
78{
79 return (m_buffer.size() >= max_size);
80}
81
82void
84{
85 max_size = maximum;
86}
87
88bool
90{
91 bool read = false;
92 for (unsigned int i = 0; i < m_buffer.size(); ++i) {
93 if (m_buffer[i]->functionalRead(pkt, mask)) {
94 read = true;
95 }
96 }
97
98 return read;
99}
100
101uint32_t
103{
104 uint32_t num_functional_writes = 0;
105
106 for (unsigned int i = 0; i < m_buffer.size(); ++i) {
107 if (m_buffer[i]->functionalWrite(pkt)) {
108 num_functional_writes++;
109 }
110 }
111
112 return num_functional_writes;
113}
114
115} // namespace garnet
116} // namespace ruby
117} // namespace gem5
#define INFINITE_
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
void setMaxSize(int maximum)
Definition flitBuffer.cc:83
bool functionalRead(Packet *pkt, WriteMask &mask)
Definition flitBuffer.cc:89
void print(std::ostream &out) const
Definition flitBuffer.cc:71
bool isReady(Tick curTime)
Definition flitBuffer.cc:60
std::deque< flit * > m_buffer
Definition flitBuffer.hh:87
uint32_t functionalWrite(Packet *pkt)
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
Bitfield< 7 > i
Definition misc_types.hh:67
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Tick
Tick count type.
Definition types.hh:58

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0