summaryrefslogtreecommitdiff
path: root/src/cpu/minor/pipe_data.cc
diff options
context:
space:
mode:
authorAndrew Bardsley <Andrew.Bardsley@arm.com>2014-07-23 16:09:04 -0500
committerAndrew Bardsley <Andrew.Bardsley@arm.com>2014-07-23 16:09:04 -0500
commit0e8a90f06bd3db00f700891a33458353478cce76 (patch)
tree50742efcc18254a36e80029b522139e8bd601dc2 /src/cpu/minor/pipe_data.cc
parent040fa23d01109c68d194d2517df777844e4e2f13 (diff)
downloadgem5-0e8a90f06bd3db00f700891a33458353478cce76.tar.xz
cpu: `Minor' in-order CPU model
This patch contains a new CPU model named `Minor'. Minor models a four stage in-order execution pipeline (fetch lines, decompose into macroops, decompose macroops into microops, execute). The model was developed to support the ARM ISA but should be fixable to support all the remaining gem5 ISAs. It currently also works for Alpha, and regressions are included for ARM and Alpha (including Linux boot). Documentation for the model can be found in src/doc/inside-minor.doxygen and its internal operations can be visualised using the Minorview tool utils/minorview.py. Minor was designed to be fairly simple and not to engage in a lot of instruction annotation. As such, it currently has very few gathered stats and may lack other gem5 features. Minor is faster than the o3 model. Sample results: Benchmark | Stat host_seconds (s) ---------------+--------v--------v-------- (on ARM, opt) | simple | o3 | minor | timing | timing | timing ---------------+--------+--------+-------- 10.linux-boot | 169 | 1883 | 1075 10.mcf | 117 | 967 | 491 20.parser | 668 | 6315 | 3146 30.eon | 542 | 3413 | 2414 40.perlbmk | 2339 | 20905 | 11532 50.vortex | 122 | 1094 | 588 60.bzip2 | 2045 | 18061 | 9662 70.twolf | 207 | 2736 | 1036
Diffstat (limited to 'src/cpu/minor/pipe_data.cc')
-rw-r--r--src/cpu/minor/pipe_data.cc294
1 files changed, 294 insertions, 0 deletions
diff --git a/src/cpu/minor/pipe_data.cc b/src/cpu/minor/pipe_data.cc
new file mode 100644
index 000000000..447f9c0e7
--- /dev/null
+++ b/src/cpu/minor/pipe_data.cc
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2013-2014 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.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * 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: Andrew Bardsley
+ */
+
+#include "cpu/minor/pipe_data.hh"
+
+namespace Minor
+{
+
+std::ostream &
+operator <<(std::ostream &os, BranchData::Reason reason)
+{
+ switch (reason)
+ {
+ case BranchData::NoBranch:
+ os << "NoBranch";
+ break;
+ case BranchData::UnpredictedBranch:
+ os << "UnpredictedBranch";
+ break;
+ case BranchData::BranchPrediction:
+ os << "BranchPrediction";
+ break;
+ case BranchData::CorrectlyPredictedBranch:
+ os << "CorrectlyPredictedBranch";
+ break;
+ case BranchData::BadlyPredictedBranch:
+ os << "BadlyPredictedBranch";
+ break;
+ case BranchData::BadlyPredictedBranchTarget:
+ os << "BadlyPredictedBranchTarget";
+ break;
+ case BranchData::Interrupt:
+ os << "Interrupt";
+ break;
+ case BranchData::SuspendThread:
+ os << "SuspendThread";
+ break;
+ case BranchData::WakeupFetch:
+ os << "WakeupFetch";
+ break;
+ case BranchData::HaltFetch:
+ os << "HaltFetch";
+ break;
+ }
+
+ return os;
+}
+
+bool
+BranchData::isStreamChange(const BranchData::Reason reason)
+{
+ bool ret = false;
+
+ switch (reason)
+ {
+ /* No change of stream (see the enum comment in pipe_data.hh) */
+ case NoBranch:
+ case CorrectlyPredictedBranch:
+ ret = false;
+ break;
+
+ /* Change of stream (Fetch1 should act on) */
+ case UnpredictedBranch:
+ case BranchPrediction:
+ case BadlyPredictedBranchTarget:
+ case BadlyPredictedBranch:
+ case SuspendThread:
+ case Interrupt:
+ case WakeupFetch:
+ case HaltFetch:
+ ret = true;
+ break;
+ }
+
+ return ret;
+}
+
+bool
+BranchData::isBranch(const BranchData::Reason reason)
+{
+ bool ret = false;
+
+ switch (reason)
+ {
+ /* No change of stream (see the enum comment in pipe_data.hh) */
+ case NoBranch:
+ case CorrectlyPredictedBranch:
+ case SuspendThread:
+ case Interrupt:
+ case WakeupFetch:
+ case HaltFetch:
+ ret = false;
+ break;
+
+ /* Change of stream (Fetch1 should act on) */
+ case UnpredictedBranch:
+ case BranchPrediction:
+ case BadlyPredictedBranchTarget:
+ case BadlyPredictedBranch:
+ ret = true;
+ break;
+ }
+
+ return ret;
+}
+
+void
+BranchData::reportData(std::ostream &os) const
+{
+ if (isBubble()) {
+ os << '-';
+ } else {
+ os << reason
+ << ';' << newStreamSeqNum << '.' << newPredictionSeqNum
+ << ";0x" << std::hex << target.instAddr() << std::dec
+ << ';';
+ inst->reportData(os);
+ }
+}
+
+std::ostream &
+operator <<(std::ostream &os, const BranchData &branch)
+{
+ os << branch.reason << " target: 0x"
+ << std::hex << branch.target.instAddr() << std::dec
+ << ' ' << *branch.inst
+ << ' ' << branch.newStreamSeqNum << "(stream)."
+ << branch.newPredictionSeqNum << "(pred)";
+
+ return os;
+}
+
+void
+ForwardLineData::setFault(Fault fault_)
+{
+ fault = fault_;
+ if (isFault())
+ bubbleFlag = false;
+}
+
+void
+ForwardLineData::allocateLine(unsigned int width_)
+{
+ lineWidth = width_;
+ bubbleFlag = false;
+
+ assert(!isFault());
+ assert(!line);
+
+ line = new uint8_t[width_];
+}
+
+void
+ForwardLineData::adoptPacketData(Packet *packet)
+{
+ this->packet = packet;
+ lineWidth = packet->req->getSize();
+ bubbleFlag = false;
+
+ assert(!isFault());
+ assert(!line);
+
+ line = packet->getPtr<uint8_t>();
+}
+
+void
+ForwardLineData::freeLine()
+{
+ /* Only free lines in non-faulting, non-bubble lines */
+ if (!isFault() && !isBubble()) {
+ assert(line);
+ /* If packet is not NULL then the line must belong to the packet so
+ * we don't need to separately deallocate the line */
+ if (packet) {
+ delete packet;
+ } else {
+ delete [] line;
+ }
+ line = NULL;
+ bubbleFlag = true;
+ }
+}
+
+void
+ForwardLineData::reportData(std::ostream &os) const
+{
+ if (isBubble())
+ os << '-';
+ else if (fault != NoFault)
+ os << "F;" << id;
+ else
+ os << id;
+}
+
+ForwardInstData::ForwardInstData(unsigned int width) :
+ numInsts(width)
+{
+ bubbleFill();
+}
+
+ForwardInstData::ForwardInstData(const ForwardInstData &src)
+{
+ *this = src;
+}
+
+ForwardInstData &
+ForwardInstData::operator =(const ForwardInstData &src)
+{
+ numInsts = src.numInsts;
+
+ for (unsigned int i = 0; i < src.numInsts; i++)
+ insts[i] = src.insts[i];
+
+ return *this;
+}
+
+bool
+ForwardInstData::isBubble() const
+{
+ return numInsts == 0 || insts[0]->isBubble();
+}
+
+void
+ForwardInstData::bubbleFill()
+{
+ for (unsigned int i = 0; i < numInsts; i++)
+ insts[i] = MinorDynInst::bubble();
+}
+
+void
+ForwardInstData::resize(unsigned int width)
+{
+ assert(width < MAX_FORWARD_INSTS);
+ numInsts = width;
+
+ bubbleFill();
+}
+
+void
+ForwardInstData::reportData(std::ostream &os) const
+{
+ if (isBubble()) {
+ os << '-';
+ } else {
+ unsigned int i = 0;
+
+ os << '(';
+ while (i != numInsts) {
+ insts[i]->reportData(os);
+ i++;
+ if (i != numInsts)
+ os << ',';
+ }
+ os << ')';
+ }
+}
+
+}