gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  * Authors: Kevin Lim
41  */
42 
43 #ifndef __CPU_O3_FU_POOL_HH__
44 #define __CPU_O3_FU_POOL_HH__
45 
46 #include <array>
47 #include <bitset>
48 #include <list>
49 #include <string>
50 #include <vector>
51 
52 #include "cpu/op_class.hh"
53 #include "params/FUPool.hh"
54 #include "sim/sim_object.hh"
55 
56 class FUDesc;
57 class FuncUnit;
58 
71 class FUPool : public SimObject
72 {
73  private:
75  std::array<Cycles, Num_OpClasses> maxOpLatencies;
77  std::array<bool, Num_OpClasses> pipelined;
78 
80  std::bitset<Num_OpClasses> capabilityList;
81 
84 
87 
94  class FUIdxQueue {
95  public:
98  : idx(0), size(0)
99  { }
100 
102  inline void addFU(int fu_idx);
103 
107  inline int getFU();
108 
109  private:
111  int idx;
112 
114  int size;
115 
118  };
119 
122 
124  int numFU;
125 
128 
130 
131  public:
132  typedef FUPoolParams Params;
134  FUPool(const Params *p);
135  ~FUPool();
136 
137  static constexpr auto NoCapableFU = -2;
138  static constexpr auto NoFreeFU = -1;
149  int getUnit(OpClass capability);
150 
152  void freeUnitNextCycle(int fu_idx);
153 
155  void processFreeUnits();
156 
158  int size() { return numFU; }
159 
161  void dump();
162 
164  Cycles getOpLatency(OpClass capability) {
165  return maxOpLatencies[capability];
166  }
167 
169  bool isPipelined(OpClass capability) {
170  return pipelined[capability];
171  }
172 
174  bool isDrained() const;
175 
177  void takeOverFrom() {};
178 };
179 
180 #endif // __CPU_O3_FU_POOL_HH__
void dump()
Debugging function used to dump FU information.
Definition: fu_pool.cc:208
void takeOverFrom()
Takes over from another CPU's thread.
Definition: fu_pool.hh:177
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
int numFU
Number of FUs.
Definition: fu_pool.hh:124
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:64
std::vector< FuncUnit * > funcUnits
Functional units.
Definition: fu_pool.hh:127
std::vector< int > funcUnitsIdx
Queue of FU indices.
Definition: fu_pool.hh:117
Cycles getOpLatency(OpClass capability)
Returns the operation execution latency of the given capability.
Definition: fu_pool.hh:164
FUIdxQueue fuPerCapList[Num_OpClasses]
Per op class queues of FUs that provide that capability.
Definition: fu_pool.hh:121
void freeUnitNextCycle(int fu_idx)
Frees a FU at the end of this cycle.
Definition: fu_pool.cc:188
static constexpr auto NoCapableFU
Definition: fu_pool.hh:137
int size
Size of the queue.
Definition: fu_pool.hh:114
Class that implements a circular queue to hold FU indices.
Definition: fu_pool.hh:94
bool isDrained() const
Have all the FUs drained?
Definition: fu_pool.cc:242
std::vector< bool > unitBusy
Bitvector listing which FUs are busy.
Definition: fu_pool.hh:83
~FUPool()
Definition: fu_pool.cc:74
std::vector< int > unitsToBeFreed
List of units to be freed at the end of this cycle.
Definition: fu_pool.hh:86
Pool of FU's, specific to the new CPU model.
Definition: fu_pool.hh:71
int size()
Returns the total number of FUs.
Definition: fu_pool.hh:158
std::array< bool, Num_OpClasses > pipelined
Whether op is pipelined or not.
Definition: fu_pool.hh:77
std::array< Cycles, Num_OpClasses > maxOpLatencies
Maximum op execution latencies, per op class.
Definition: fu_pool.hh:75
FUPool(const Params *p)
Constructs a FU pool.
Definition: fu_pool.cc:84
void addFU(int fu_idx)
Adds a FU to the queue.
Definition: fu_pool.cc:57
int idx
Circular queue index.
Definition: fu_pool.hh:111
FUPoolParams Params
Definition: fu_pool.hh:132
static const OpClass Num_OpClasses
Definition: op_class.hh:92
std::vector< FuncUnit * >::iterator fuListIterator
Definition: fu_pool.hh:129
int getUnit(OpClass capability)
Gets a FU providing the requested capability.
Definition: fu_pool.cc:160
bool isPipelined(OpClass capability)
Returns the issue latency of the given capability.
Definition: fu_pool.hh:169
Bitfield< 0 > p
void processFreeUnits()
Frees all FUs on the list.
Definition: fu_pool.cc:195
std::bitset< Num_OpClasses > capabilityList
Bitvector listing capabilities of this FU pool.
Definition: fu_pool.hh:80
Abstract superclass for simulation objects.
Definition: sim_object.hh:94
FUIdxQueue()
Constructs a circular queue of FU indices.
Definition: fu_pool.hh:97
static constexpr auto NoFreeFU
Definition: fu_pool.hh:138

Generated on Fri Jun 9 2017 13:03:43 for gem5 by doxygen 1.8.6