/*
+ * Copyright (c) 2012-2013 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
* Copyright (c) 2006 The Regents of The University of Michigan
* All rights reserved.
*
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Kevin Lim
*/
+#include "cpu/o3/fu_pool.hh"
+
#include <sstream>
-#include "cpu/o3/fu_pool.hh"
#include "cpu/func_unit.hh"
using namespace std;
// Constructor
-FUPool::FUPool(const Params *p)
+FUPool::FUPool(const Params &p)
: SimObject(p)
{
numFU = 0;
funcUnits.clear();
- for (int i = 0; i < Num_OpClasses; ++i) {
- maxOpLatencies[i] = 0;
- maxIssueLatencies[i] = 0;
- }
+ maxOpLatencies.fill(Cycles(0));
+ pipelined.fill(true);
//
// Iterate through the list of FUDescData structures
//
- const vector<FUDesc *> ¶mList = p->FUList;
+ const vector<FUDesc *> ¶mList = p.FUList;
for (FUDDiterator i = paramList.begin(); i != paramList.end(); ++i) {
//
fuPerCapList[(*j)->opClass].addFU(numFU + k);
// indicate that this FU has the capability
- fu->addCapability((*j)->opClass, (*j)->opLat, (*j)->issueLat);
+ fu->addCapability((*j)->opClass, (*j)->opLat, (*j)->pipelined);
if ((*j)->opLat > maxOpLatencies[(*j)->opClass])
maxOpLatencies[(*j)->opClass] = (*j)->opLat;
- if ((*j)->issueLat > maxIssueLatencies[(*j)->opClass])
- maxIssueLatencies[(*j)->opClass] = (*j)->issueLat;
+ if (!(*j)->pipelined)
+ pipelined[(*j)->opClass] = false;
}
numFU++;
// Add the appropriate number of copies of this FU to the list
- ostringstream s;
-
- s << (*i)->name() << "(0)";
- fu->name = s.str();
+ fu->name = (*i)->name() + "(0)";
funcUnits.push_back(fu);
for (int c = 1; c < (*i)->number; ++c) {
}
}
-void
-FUPool::annotateMemoryUnits(unsigned hit_latency)
-{
- maxOpLatencies[MemReadOp] = hit_latency;
-
- fuListIterator i = funcUnits.begin();
- fuListIterator iend = funcUnits.end();
- for (; i != iend; ++i) {
- if ((*i)->provides(MemReadOp))
- (*i)->opLatency(MemReadOp) = hit_latency;
-
- if ((*i)->provides(MemWriteOp))
- (*i)->opLatency(MemWriteOp) = hit_latency;
- }
-}
-
int
FUPool::getUnit(OpClass capability)
{
}
}
-void
-FUPool::switchOut()
-{
-}
-
-void
-FUPool::takeOver()
+bool
+FUPool::isDrained() const
{
- for (int i = 0; i < numFU; i++) {
- unitBusy[i] = false;
- }
- unitsToBeFreed.clear();
-}
-
-//
+ bool is_drained = true;
+ for (int i = 0; i < numFU; i++)
+ is_drained = is_drained && !unitBusy[i];
-////////////////////////////////////////////////////////////////////////////
-//
-// The SimObjects we use to get the FU information into the simulator
-//
-////////////////////////////////////////////////////////////////////////////
-
-//
-// FUPool - Contails a list of FUDesc objects to make available
-//
-
-//
-// The FuPool object
-//
-FUPool *
-FUPoolParams::create()
-{
- return new FUPool(this);
+ return is_drained;
}