gem5  v21.1.0.2
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 
54 namespace gem5
55 {
56 
57 class FUDesc;
58 class FuncUnit;
59 
60 namespace o3
61 {
62 
75 class 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 
98  class FUIdxQueue
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__
gem5::o3::FUPool::capabilityList
std::bitset< Num_OpClasses > capabilityList
Bitvector listing capabilities of this FU pool.
Definition: fu_pool.hh:84
gem5::o3::FUPool::FUPool
FUPool(const Params &p)
Constructs a FU pool.
Definition: fu_pool.cc:86
gem5::o3::FUPool::funcUnits
std::vector< FuncUnit * > funcUnits
Functional units.
Definition: fu_pool.hh:132
gem5::o3::FUPool::NoCapableFU
static constexpr auto NoCapableFU
Definition: fu_pool.hh:142
op_class.hh
gem5::o3::FUPool::getOpLatency
Cycles getOpLatency(OpClass capability)
Returns the operation execution latency of the given capability.
Definition: fu_pool.hh:169
gem5::o3::FUPool::takeOverFrom
void takeOverFrom()
Takes over from another CPU's thread.
Definition: fu_pool.hh:182
gem5::o3::FUPool::numFU
int numFU
Number of FUs.
Definition: fu_pool.hh:129
gem5::o3::FUPool::unitsToBeFreed
std::vector< int > unitsToBeFreed
List of units to be freed at the end of this cycle.
Definition: fu_pool.hh:90
std::vector< bool >
gem5::o3::FUPool::dump
void dump()
Debugging function used to dump FU information.
Definition: fu_pool.cc:210
gem5::o3::FUPool::FUIdxQueue
Class that implements a circular queue to hold FU indices.
Definition: fu_pool.hh:98
gem5::o3::FUPool::Params
FUPoolParams Params
Definition: fu_pool.hh:137
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::o3::FUPool::freeUnitNextCycle
void freeUnitNextCycle(int fu_idx)
Frees a FU at the end of this cycle.
Definition: fu_pool.cc:190
gem5::o3::FUPool::FUIdxQueue::funcUnitsIdx
std::vector< int > funcUnitsIdx
Queue of FU indices.
Definition: fu_pool.hh:122
gem5::o3::FUPool::~FUPool
~FUPool()
Definition: fu_pool.cc:76
gem5::o3::FUPool::isDrained
bool isDrained() const
Have all the FUs drained?
Definition: fu_pool.cc:244
sim_object.hh
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::o3::FUPool::unitBusy
std::vector< bool > unitBusy
Bitvector listing which FUs are busy.
Definition: fu_pool.hh:87
gem5::o3::FUPool::processFreeUnits
void processFreeUnits()
Frees all FUs on the list.
Definition: fu_pool.cc:197
gem5::o3::FUPool::FUIdxQueue::size
int size
Size of the queue.
Definition: fu_pool.hh:119
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::o3::FUPool::pipelined
std::array< bool, Num_OpClasses > pipelined
Whether op is pipelined or not.
Definition: fu_pool.hh:81
gem5::o3::FUPool::isPipelined
bool isPipelined(OpClass capability)
Returns the issue latency of the given capability.
Definition: fu_pool.hh:174
gem5::o3::FUPool::FUIdxQueue::FUIdxQueue
FUIdxQueue()
Constructs a circular queue of FU indices.
Definition: fu_pool.hh:102
gem5::o3::FUPool::FUIdxQueue::idx
int idx
Circular queue index.
Definition: fu_pool.hh:116
gem5::o3::FUPool::FUIdxQueue::getFU
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
gem5::o3::FUPool::size
int size()
Returns the total number of FUs.
Definition: fu_pool.hh:163
gem5::o3::FUPool::FUIdxQueue::addFU
void addFU(int fu_idx)
Adds a FU to the queue.
Definition: fu_pool.cc:59
gem5::o3::FUPool::fuListIterator
std::vector< FuncUnit * >::iterator fuListIterator
Definition: fu_pool.hh:134
gem5::o3::FUPool::maxOpLatencies
std::array< Cycles, Num_OpClasses > maxOpLatencies
Maximum op execution latencies, per op class.
Definition: fu_pool.hh:79
gem5::Num_OpClasses
static const OpClass Num_OpClasses
Definition: op_class.hh:108
gem5::o3::FUPool::NoFreeFU
static constexpr auto NoFreeFU
Definition: fu_pool.hh:143
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::o3::FUPool::fuPerCapList
FUIdxQueue fuPerCapList[Num_OpClasses]
Per op class queues of FUs that provide that capability.
Definition: fu_pool.hh:126
gem5::o3::FUPool
Pool of FU's, specific to the new CPU model.
Definition: fu_pool.hh:75
gem5::o3::FUPool::getUnit
int getUnit(OpClass capability)
Gets a FU providing the requested capability.
Definition: fu_pool.cc:162

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