gem5  v20.1.0.0
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 class FUDesc;
55 class FuncUnit;
56 
69 class FUPool : public SimObject
70 {
71  private:
73  std::array<Cycles, Num_OpClasses> maxOpLatencies;
75  std::array<bool, Num_OpClasses> pipelined;
76 
78  std::bitset<Num_OpClasses> capabilityList;
79 
82 
85 
92  class FUIdxQueue {
93  public:
96  : idx(0), size(0)
97  { }
98 
100  inline void addFU(int fu_idx);
101 
105  inline int getFU();
106 
107  private:
109  int idx;
110 
112  int size;
113 
116  };
117 
120 
122  int numFU;
123 
126 
128 
129  public:
130  typedef FUPoolParams Params;
132  FUPool(const Params *p);
133  ~FUPool();
134 
135  static constexpr auto NoCapableFU = -2;
136  static constexpr auto NoFreeFU = -1;
147  int getUnit(OpClass capability);
148 
150  void freeUnitNextCycle(int fu_idx);
151 
153  void processFreeUnits();
154 
156  int size() { return numFU; }
157 
159  void dump();
160 
162  Cycles getOpLatency(OpClass capability) {
163  return maxOpLatencies[capability];
164  }
165 
167  bool isPipelined(OpClass capability) {
168  return pipelined[capability];
169  }
170 
172  bool isDrained() const;
173 
175  void takeOverFrom() {};
176 };
177 
178 #endif // __CPU_O3_FU_POOL_HH__
Num_OpClasses
static const OpClass Num_OpClasses
Definition: op_class.hh:105
FUPool::FUIdxQueue::funcUnitsIdx
std::vector< int > funcUnitsIdx
Queue of FU indices.
Definition: fu_pool.hh:115
FUPool::FUIdxQueue::idx
int idx
Circular queue index.
Definition: fu_pool.hh:109
op_class.hh
FUPool::maxOpLatencies
std::array< Cycles, Num_OpClasses > maxOpLatencies
Maximum op execution latencies, per op class.
Definition: fu_pool.hh:73
FUPool::capabilityList
std::bitset< Num_OpClasses > capabilityList
Bitvector listing capabilities of this FU pool.
Definition: fu_pool.hh:78
FUPool::dump
void dump()
Debugging function used to dump FU information.
Definition: fu_pool.cc:206
FUPool::fuListIterator
std::vector< FuncUnit * >::iterator fuListIterator
Definition: fu_pool.hh:127
FUPool::getUnit
int getUnit(OpClass capability)
Gets a FU providing the requested capability.
Definition: fu_pool.cc:158
std::vector< bool >
FUPool::unitBusy
std::vector< bool > unitBusy
Bitvector listing which FUs are busy.
Definition: fu_pool.hh:81
FUPool::size
int size()
Returns the total number of FUs.
Definition: fu_pool.hh:156
FUPool::takeOverFrom
void takeOverFrom()
Takes over from another CPU's thread.
Definition: fu_pool.hh:175
FUPool
Pool of FU's, specific to the new CPU model.
Definition: fu_pool.hh:69
FUPool::FUIdxQueue::FUIdxQueue
FUIdxQueue()
Constructs a circular queue of FU indices.
Definition: fu_pool.hh:95
FUDesc
Definition: func_unit.hh:61
FUPool::NoCapableFU
static constexpr auto NoCapableFU
Definition: fu_pool.hh:135
FUPool::isDrained
bool isDrained() const
Have all the FUs drained?
Definition: fu_pool.cc:240
FUPool::Params
FUPoolParams Params
Definition: fu_pool.hh:130
sim_object.hh
FUPool::FUIdxQueue::addFU
void addFU(int fu_idx)
Adds a FU to the queue.
Definition: fu_pool.cc:55
FUPool::numFU
int numFU
Number of FUs.
Definition: fu_pool.hh:122
FUPool::pipelined
std::array< bool, Num_OpClasses > pipelined
Whether op is pipelined or not.
Definition: fu_pool.hh:75
FUPool::processFreeUnits
void processFreeUnits()
Frees all FUs on the list.
Definition: fu_pool.cc:193
FUPool::freeUnitNextCycle
void freeUnitNextCycle(int fu_idx)
Frees a FU at the end of this cycle.
Definition: fu_pool.cc:186
FUPool::isPipelined
bool isPipelined(OpClass capability)
Returns the issue latency of the given capability.
Definition: fu_pool.hh:167
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
FUPool::FUIdxQueue
Class that implements a circular queue to hold FU indices.
Definition: fu_pool.hh:92
FUPool::getOpLatency
Cycles getOpLatency(OpClass capability)
Returns the operation execution latency of the given capability.
Definition: fu_pool.hh:162
FUPool::FUIdxQueue::size
int size
Size of the queue.
Definition: fu_pool.hh:112
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:62
FUPool::funcUnits
std::vector< FuncUnit * > funcUnits
Functional units.
Definition: fu_pool.hh:125
FUPool::FUPool
FUPool(const Params *p)
Constructs a FU pool.
Definition: fu_pool.cc:82
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
FUPool::unitsToBeFreed
std::vector< int > unitsToBeFreed
List of units to be freed at the end of this cycle.
Definition: fu_pool.hh:84
FUPool::NoFreeFU
static constexpr auto NoFreeFU
Definition: fu_pool.hh:136
FuncUnit
Definition: func_unit.hh:83
FUPool::~FUPool
~FUPool()
Definition: fu_pool.cc:72
FUPool::fuPerCapList
FUIdxQueue fuPerCapList[Num_OpClasses]
Per op class queues of FUs that provide that capability.
Definition: fu_pool.hh:119
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92

Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17