gem5 v24.0.0.0
Loading...
Searching...
No Matches
fu_pool.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2006 The Regents of The University of Michigan
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 */
40
41#ifndef __CPU_O3_FU_POOL_HH__
42#define __CPU_O3_FU_POOL_HH__
43
44#include <array>
45#include <bitset>
46#include <list>
47#include <string>
48#include <vector>
49
50#include "cpu/op_class.hh"
51#include "params/FUPool.hh"
52#include "sim/sim_object.hh"
53
54namespace gem5
55{
56
57class FUDesc;
58class FuncUnit;
59
60namespace o3
61{
62
75class FUPool : public SimObject
76{
77 private:
79 std::array<Cycles, Num_OpClasses> maxOpLatencies;
81 std::array<bool, Num_OpClasses> pipelined;
82
84 std::bitset<Num_OpClasses> capabilityList;
85
88
91
99 {
100 public:
103 : idx(0), size(0)
104 { }
105
107 inline void addFU(int fu_idx);
108
112 inline int getFU();
113
114 private:
116 int idx;
117
119 int size;
120
123 };
124
127
129 int numFU;
130
133
135
136 public:
137 typedef FUPoolParams Params;
139 FUPool(const Params &p);
140 ~FUPool();
141
142 static constexpr auto NoCapableFU = -2;
143 static constexpr auto NoFreeFU = -1;
154 int getUnit(OpClass capability);
155
157 void freeUnitNextCycle(int fu_idx);
158
160 void processFreeUnits();
161
163 int size() { return numFU; }
164
166 void dump();
167
169 Cycles getOpLatency(OpClass capability) {
170 return maxOpLatencies[capability];
171 }
172
174 bool isPipelined(OpClass capability) {
175 return pipelined[capability];
176 }
177
179 bool isDrained() const;
180
182 void takeOverFrom() {};
183};
184
185} // namespace o3
186} // namespace gem5
187
188#endif // __CPU_O3_FU_POOL_HH__
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
Abstract superclass for simulation objects.
Class that implements a circular queue to hold FU indices.
Definition fu_pool.hh:99
int size
Size of the queue.
Definition fu_pool.hh:119
int idx
Circular queue index.
Definition fu_pool.hh:116
std::vector< int > funcUnitsIdx
Queue of FU indices.
Definition fu_pool.hh:122
void addFU(int fu_idx)
Adds a FU to the queue.
Definition fu_pool.cc:59
FUIdxQueue()
Constructs a circular queue of FU indices.
Definition fu_pool.hh:102
int getFU()
Returns the index of the FU at the head of the queue, and changes the index to the next element.
Definition fu_pool.cc:66
Pool of FU's, specific to the new CPU model.
Definition fu_pool.hh:76
std::array< bool, Num_OpClasses > pipelined
Whether op is pipelined or not.
Definition fu_pool.hh:81
FUPoolParams Params
Definition fu_pool.hh:137
void processFreeUnits()
Frees all FUs on the list.
Definition fu_pool.cc:197
void dump()
Debugging function used to dump FU information.
Definition fu_pool.cc:210
FUIdxQueue fuPerCapList[Num_OpClasses]
Per op class queues of FUs that provide that capability.
Definition fu_pool.hh:126
std::vector< bool > unitBusy
Bitvector listing which FUs are busy.
Definition fu_pool.hh:87
FUPool(const Params &p)
Constructs a FU pool.
Definition fu_pool.cc:86
void freeUnitNextCycle(int fu_idx)
Frees a FU at the end of this cycle.
Definition fu_pool.cc:190
Cycles getOpLatency(OpClass capability)
Returns the operation execution latency of the given capability.
Definition fu_pool.hh:169
bool isDrained() const
Have all the FUs drained?
Definition fu_pool.cc:244
int numFU
Number of FUs.
Definition fu_pool.hh:129
int size()
Returns the total number of FUs.
Definition fu_pool.hh:163
std::vector< FuncUnit * >::iterator fuListIterator
Definition fu_pool.hh:134
bool isPipelined(OpClass capability)
Returns the issue latency of the given capability.
Definition fu_pool.hh:174
std::vector< FuncUnit * > funcUnits
Functional units.
Definition fu_pool.hh:132
static constexpr auto NoCapableFU
Definition fu_pool.hh:142
std::array< Cycles, Num_OpClasses > maxOpLatencies
Maximum op execution latencies, per op class.
Definition fu_pool.hh:79
static constexpr auto NoFreeFU
Definition fu_pool.hh:143
std::vector< int > unitsToBeFreed
List of units to be freed at the end of this cycle.
Definition fu_pool.hh:90
void takeOverFrom()
Takes over from another CPU's thread.
Definition fu_pool.hh:182
int getUnit(OpClass capability)
Gets a FU providing the requested capability.
Definition fu_pool.cc:162
std::bitset< Num_OpClasses > capabilityList
Bitvector listing capabilities of this FU pool.
Definition fu_pool.hh:84
STL vector class.
Definition stl.hh:37
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
static const OpClass Num_OpClasses
Definition op_class.hh:135

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