110 FuncUnit *fu = new FuncUnit;
112 for (OpDesc *j : i->opDescList) {
114 capabilityList.set(j->opClass);
118 for (int k = 0; k < i->number; ++k)
119 fuPerCapList[j->opClass].addFU(numFU + k);
122 fu->addCapability(j->opClass, j->opLat, j->pipelined);
124 if (j->opLat > maxOpLatencies[j->opClass])
125 maxOpLatencies[j->opClass] = j->opLat;
128 pipelined[j->opClass] = false;
134 fu->name = i->name() +
"(0)";
135 funcUnits.push_back(fu);
137 for (int c = 1; c < i->number; ++c) {
138 std::ostringstream s;
140 FuncUnit *fu2 = new FuncUnit(*fu);
142 s << i->name() <<
"(" << c <<
")";
144 funcUnits.push_back(fu2);
149 unitBusy.resize(numFU);
151 for (
int i = 0;
i < numFU;
i++) {
165 int start_idx = fu_idx;
171 if (fu_idx == start_idx) {
177 assert(fu_idx <
numFU);
207 std::cout <<
"Function Unit Pool (" <<
name() <<
")\n";
208 std::cout <<
"======================================\n";
209 std::cout <<
"Free List:\n";
216 std::cout <<
" [" <<
i <<
"] : ";
223 std::cout <<
"======================================\n";
224 std::cout <<
"Busy List:\n";
230 std::cout <<
" [" <<
i <<
"] : ";
241 bool is_drained =
true;
Cycles is a wrapper class for representing cycle counts, i.e.
int size
Size of the queue.
int idx
Circular queue index.
std::vector< int > funcUnitsIdx
Queue of FU indices.
void addFU(int fu_idx)
Adds a FU to the queue.
int getFU()
Returns the index of the FU at the head of the queue, and changes the index to the next element.
std::array< bool, Num_OpClasses > pipelined
Whether op is pipelined or not.
void processFreeUnits()
Frees all FUs on the list.
void dump()
Debugging function used to dump FU information.
FUIdxQueue fuPerCapList[Num_OpClasses]
Per op class queues of FUs that provide that capability.
std::vector< bool > unitBusy
Bitvector listing which FUs are busy.
FUPool(const Params &p)
Constructs a FU pool.
void freeUnitNextCycle(int fu_idx)
Frees a FU at the end of this cycle.
bool isDrained() const
Have all the FUs drained?
std::vector< FuncUnit * > funcUnits
Functional units.
static constexpr auto NoCapableFU
Instruction asked for a FU but this FUPool does not have a FU for this instruction op type.
std::array< Cycles, Num_OpClasses > maxOpLatencies
Maximum op execution latencies, per op class.
static constexpr auto NoFreeFU
Instruction asked for a FU but all FU for this op type have already been allocated to other instructi...
std::vector< int > unitsToBeFreed
List of units to be freed at the end of this cycle.
int getUnit(OpClass capability)
Gets a FU providing the requested capability.
std::bitset< Num_OpClasses > capabilityList
Bitvector listing capabilities of this FU pool.
SimObject(const Params &p)
Copyright (c) 2024 Arm Limited All rights reserved.
const std::string & name()