2005-05-27 05:30:12 +02:00
|
|
|
/*
|
2006-05-19 21:37:52 +02:00
|
|
|
* Copyright (c) 2004-2006 The Regents of The University of Michigan
|
2005-05-27 05:30:12 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* 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.
|
2006-06-01 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Authors: Kevin Lim
|
2006-06-16 04:01:28 +02:00
|
|
|
* Korey Sewell
|
2005-05-27 05:30:12 +02:00
|
|
|
*/
|
|
|
|
|
2005-08-30 19:18:54 +02:00
|
|
|
#include "config/full_system.hh"
|
2006-06-16 23:08:47 +02:00
|
|
|
#include "config/use_checker.hh"
|
2005-08-30 19:18:54 +02:00
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
#include "cpu/activity.hh"
|
2006-06-07 21:29:53 +02:00
|
|
|
#include "cpu/simple_thread.hh"
|
2006-06-06 23:32:21 +02:00
|
|
|
#include "cpu/thread_context.hh"
|
2006-07-01 01:52:08 +02:00
|
|
|
#include "cpu/o3/isa_specific.hh"
|
2005-06-05 02:50:10 +02:00
|
|
|
#include "cpu/o3/cpu.hh"
|
2008-10-09 09:08:50 +02:00
|
|
|
#include "cpu/o3/thread_context.hh"
|
2007-07-24 06:51:38 +02:00
|
|
|
#include "enums/MemoryMode.hh"
|
2007-03-06 20:13:43 +01:00
|
|
|
#include "sim/core.hh"
|
2006-04-23 00:26:48 +02:00
|
|
|
#include "sim/stat_control.hh"
|
|
|
|
|
2007-07-24 06:51:38 +02:00
|
|
|
#if FULL_SYSTEM
|
|
|
|
#include "cpu/quiesce_event.hh"
|
|
|
|
#include "sim/system.hh"
|
|
|
|
#else
|
|
|
|
#include "sim/process.hh"
|
|
|
|
#endif
|
|
|
|
|
2006-06-23 05:43:45 +02:00
|
|
|
#if USE_CHECKER
|
|
|
|
#include "cpu/checker/cpu.hh"
|
|
|
|
#endif
|
|
|
|
|
2008-10-20 22:22:59 +02:00
|
|
|
#if THE_ISA == ALPHA_ISA
|
|
|
|
#include "arch/alpha/osfpal.hh"
|
|
|
|
#endif
|
|
|
|
|
2008-08-11 21:22:16 +02:00
|
|
|
class BaseCPUParams;
|
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
using namespace TheISA;
|
2009-05-26 18:23:13 +02:00
|
|
|
using namespace std;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2008-08-11 21:22:16 +02:00
|
|
|
BaseO3CPU::BaseO3CPU(BaseCPUParams *params)
|
2008-11-03 03:56:57 +01:00
|
|
|
: BaseCPU(params)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-06-16 23:08:47 +02:00
|
|
|
BaseO3CPU::regStats()
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-04-23 00:26:48 +02:00
|
|
|
BaseCPU::regStats();
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::TickEvent::TickEvent(FullO3CPU<Impl> *c)
|
2008-10-09 13:58:24 +02:00
|
|
|
: Event(CPU_Tick_Pri), cpu(c)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::TickEvent::process()
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
|
|
|
cpu->tick();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
const char *
|
2008-02-06 22:32:40 +01:00
|
|
|
FullO3CPU<Impl>::TickEvent::description() const
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2007-07-01 02:45:58 +02:00
|
|
|
return "FullO3CPU tick";
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
2006-07-02 00:52:02 +02:00
|
|
|
template <class Impl>
|
|
|
|
FullO3CPU<Impl>::ActivateThreadEvent::ActivateThreadEvent()
|
2008-10-09 13:58:24 +02:00
|
|
|
: Event(CPU_Switch_Pri)
|
2006-07-02 00:52:02 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::ActivateThreadEvent::init(int thread_num,
|
|
|
|
FullO3CPU<Impl> *thread_cpu)
|
|
|
|
{
|
|
|
|
tid = thread_num;
|
|
|
|
cpu = thread_cpu;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::ActivateThreadEvent::process()
|
|
|
|
{
|
|
|
|
cpu->activateThread(tid);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
const char *
|
2008-02-06 22:32:40 +01:00
|
|
|
FullO3CPU<Impl>::ActivateThreadEvent::description() const
|
2006-07-02 00:52:02 +02:00
|
|
|
{
|
2007-07-01 02:45:58 +02:00
|
|
|
return "FullO3CPU \"Activate Thread\"";
|
2006-07-02 00:52:02 +02:00
|
|
|
}
|
|
|
|
|
2006-07-07 10:06:26 +02:00
|
|
|
template <class Impl>
|
|
|
|
FullO3CPU<Impl>::DeallocateContextEvent::DeallocateContextEvent()
|
2008-10-09 13:58:24 +02:00
|
|
|
: Event(CPU_Tick_Pri), tid(0), remove(false), cpu(NULL)
|
2006-07-07 10:06:26 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::DeallocateContextEvent::init(int thread_num,
|
2006-12-21 06:46:16 +01:00
|
|
|
FullO3CPU<Impl> *thread_cpu)
|
2006-07-07 10:06:26 +02:00
|
|
|
{
|
|
|
|
tid = thread_num;
|
|
|
|
cpu = thread_cpu;
|
2006-12-21 06:46:16 +01:00
|
|
|
remove = false;
|
2006-07-07 10:06:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::DeallocateContextEvent::process()
|
|
|
|
{
|
|
|
|
cpu->deactivateThread(tid);
|
2006-10-08 06:53:41 +02:00
|
|
|
if (remove)
|
|
|
|
cpu->removeThread(tid);
|
2006-07-07 10:06:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
const char *
|
2008-02-06 22:32:40 +01:00
|
|
|
FullO3CPU<Impl>::DeallocateContextEvent::description() const
|
2006-07-07 10:06:26 +02:00
|
|
|
{
|
2007-07-01 02:45:58 +02:00
|
|
|
return "FullO3CPU \"Deallocate Context\"";
|
2006-07-07 10:06:26 +02:00
|
|
|
}
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
template <class Impl>
|
2008-10-09 09:08:50 +02:00
|
|
|
FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
|
2006-06-16 23:08:47 +02:00
|
|
|
: BaseO3CPU(params),
|
2006-12-06 17:36:40 +01:00
|
|
|
itb(params->itb),
|
|
|
|
dtb(params->dtb),
|
2004-08-20 20:54:07 +02:00
|
|
|
tickEvent(this),
|
2008-11-10 20:51:18 +01:00
|
|
|
#ifndef NDEBUG
|
|
|
|
instcount(0),
|
|
|
|
#endif
|
2006-04-23 00:26:48 +02:00
|
|
|
removeInstsThisCycle(false),
|
2008-10-09 09:08:50 +02:00
|
|
|
fetch(this, params),
|
|
|
|
decode(this, params),
|
|
|
|
rename(this, params),
|
|
|
|
iew(this, params),
|
|
|
|
commit(this, params),
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2008-10-09 09:08:50 +02:00
|
|
|
regFile(this, params->numPhysIntRegs,
|
2007-04-04 21:38:59 +02:00
|
|
|
params->numPhysFloatRegs),
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2008-08-11 21:22:16 +02:00
|
|
|
freeList(params->numThreads,
|
2006-04-23 00:26:48 +02:00
|
|
|
TheISA::NumIntRegs, params->numPhysIntRegs,
|
|
|
|
TheISA::NumFloatRegs, params->numPhysFloatRegs),
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2008-10-09 09:08:50 +02:00
|
|
|
rob(this,
|
2007-04-04 21:38:59 +02:00
|
|
|
params->numROBEntries, params->squashWidth,
|
2006-04-23 00:26:48 +02:00
|
|
|
params->smtROBPolicy, params->smtROBThreshold,
|
2008-08-11 21:22:16 +02:00
|
|
|
params->numThreads),
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2008-08-11 21:22:16 +02:00
|
|
|
scoreboard(params->numThreads,
|
2006-04-23 00:26:48 +02:00
|
|
|
TheISA::NumIntRegs, params->numPhysIntRegs,
|
|
|
|
TheISA::NumFloatRegs, params->numPhysFloatRegs,
|
2009-05-26 18:23:13 +02:00
|
|
|
TheISA::NumMiscRegs * numThreads,
|
2006-04-23 00:26:48 +02:00
|
|
|
TheISA::ZeroReg),
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-07-10 21:40:28 +02:00
|
|
|
timeBuffer(params->backComSize, params->forwardComSize),
|
|
|
|
fetchQueue(params->backComSize, params->forwardComSize),
|
|
|
|
decodeQueue(params->backComSize, params->forwardComSize),
|
|
|
|
renameQueue(params->backComSize, params->forwardComSize),
|
|
|
|
iewQueue(params->backComSize, params->forwardComSize),
|
2009-01-21 23:56:18 +01:00
|
|
|
activityRec(name(), NumStages,
|
2006-07-10 21:40:28 +02:00
|
|
|
params->backComSize + params->forwardComSize,
|
|
|
|
params->activity),
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
globalSeqNum(1),
|
2005-08-30 19:18:54 +02:00
|
|
|
#if FULL_SYSTEM
|
2006-04-23 00:26:48 +02:00
|
|
|
system(params->system),
|
2004-08-20 20:54:07 +02:00
|
|
|
physmem(system->physmem),
|
|
|
|
#endif // FULL_SYSTEM
|
2006-07-06 19:59:02 +02:00
|
|
|
drainCount(0),
|
2009-05-26 18:23:13 +02:00
|
|
|
deferRegistration(params->defer_registration)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-10-08 06:53:41 +02:00
|
|
|
if (!deferRegistration) {
|
|
|
|
_status = Running;
|
|
|
|
} else {
|
|
|
|
_status = Idle;
|
|
|
|
}
|
2005-05-03 16:56:47 +02:00
|
|
|
|
2006-06-23 05:43:45 +02:00
|
|
|
#if USE_CHECKER
|
2007-06-20 17:15:06 +02:00
|
|
|
if (params->checker) {
|
2006-05-16 20:06:35 +02:00
|
|
|
BaseCPU *temp_checker = params->checker;
|
|
|
|
checker = dynamic_cast<Checker<DynInstPtr> *>(temp_checker);
|
2005-08-30 19:18:54 +02:00
|
|
|
#if FULL_SYSTEM
|
2006-05-16 20:06:35 +02:00
|
|
|
checker->setSystem(params->system);
|
|
|
|
#endif
|
2007-06-20 17:15:06 +02:00
|
|
|
} else {
|
|
|
|
checker = NULL;
|
2005-05-03 16:56:47 +02:00
|
|
|
}
|
2007-06-20 17:15:06 +02:00
|
|
|
#endif // USE_CHECKER
|
2005-05-03 16:56:47 +02:00
|
|
|
|
2005-08-30 19:18:54 +02:00
|
|
|
#if !FULL_SYSTEM
|
2009-05-26 18:23:13 +02:00
|
|
|
thread.resize(numThreads);
|
|
|
|
tids.resize(numThreads);
|
2005-05-03 16:56:47 +02:00
|
|
|
#endif
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
// The stages also need their CPU pointer setup. However this
|
|
|
|
// must be done at the upper level CPU because they have pointers
|
|
|
|
// to the upper level CPU, and not this FullO3CPU.
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
// Set up Pointers to the activeThreads list for each stage
|
|
|
|
fetch.setActiveThreads(&activeThreads);
|
|
|
|
decode.setActiveThreads(&activeThreads);
|
|
|
|
rename.setActiveThreads(&activeThreads);
|
|
|
|
iew.setActiveThreads(&activeThreads);
|
|
|
|
commit.setActiveThreads(&activeThreads);
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
// Give each of the stages the time buffer they will use.
|
|
|
|
fetch.setTimeBuffer(&timeBuffer);
|
|
|
|
decode.setTimeBuffer(&timeBuffer);
|
|
|
|
rename.setTimeBuffer(&timeBuffer);
|
|
|
|
iew.setTimeBuffer(&timeBuffer);
|
|
|
|
commit.setTimeBuffer(&timeBuffer);
|
|
|
|
|
|
|
|
// Also setup each of the stages' queues.
|
|
|
|
fetch.setFetchQueue(&fetchQueue);
|
|
|
|
decode.setFetchQueue(&fetchQueue);
|
2006-04-23 00:26:48 +02:00
|
|
|
commit.setFetchQueue(&fetchQueue);
|
2004-08-20 20:54:07 +02:00
|
|
|
decode.setDecodeQueue(&decodeQueue);
|
|
|
|
rename.setDecodeQueue(&decodeQueue);
|
|
|
|
rename.setRenameQueue(&renameQueue);
|
|
|
|
iew.setRenameQueue(&renameQueue);
|
|
|
|
iew.setIEWQueue(&iewQueue);
|
|
|
|
commit.setIEWQueue(&iewQueue);
|
|
|
|
commit.setRenameQueue(&renameQueue);
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
commit.setIEWStage(&iew);
|
|
|
|
rename.setIEWStage(&iew);
|
|
|
|
rename.setCommitStage(&commit);
|
|
|
|
|
|
|
|
#if !FULL_SYSTEM
|
2009-05-26 18:23:13 +02:00
|
|
|
ThreadID active_threads = params->workload.size();
|
2006-07-03 05:11:24 +02:00
|
|
|
|
|
|
|
if (active_threads > Impl::MaxThreads) {
|
|
|
|
panic("Workload Size too large. Increase the 'MaxThreads'"
|
|
|
|
"constant in your O3CPU impl. file (e.g. o3/alpha/impl.hh) or "
|
|
|
|
"edit your workload size.");
|
|
|
|
}
|
2006-04-23 00:26:48 +02:00
|
|
|
#else
|
2009-05-26 18:23:13 +02:00
|
|
|
ThreadID active_threads = 1;
|
2006-04-23 00:26:48 +02:00
|
|
|
#endif
|
|
|
|
|
2006-05-16 20:06:35 +02:00
|
|
|
//Make Sure That this a Valid Architeture
|
2006-04-23 00:26:48 +02:00
|
|
|
assert(params->numPhysIntRegs >= numThreads * TheISA::NumIntRegs);
|
|
|
|
assert(params->numPhysFloatRegs >= numThreads * TheISA::NumFloatRegs);
|
|
|
|
|
|
|
|
rename.setScoreboard(&scoreboard);
|
|
|
|
iew.setScoreboard(&scoreboard);
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
// Setup the rename map for whichever stages need it.
|
2006-04-23 00:26:48 +02:00
|
|
|
PhysRegIndex lreg_idx = 0;
|
|
|
|
PhysRegIndex freg_idx = params->numPhysIntRegs; //Index to 1 after int regs
|
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
for (ThreadID tid = 0; tid < numThreads; tid++) {
|
2006-05-04 17:36:20 +02:00
|
|
|
bool bindRegs = (tid <= active_threads - 1);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
commitRenameMap[tid].init(TheISA::NumIntRegs,
|
|
|
|
params->numPhysIntRegs,
|
2006-05-19 21:37:52 +02:00
|
|
|
lreg_idx, //Index for Logical. Regs
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
TheISA::NumFloatRegs,
|
|
|
|
params->numPhysFloatRegs,
|
2006-05-19 21:37:52 +02:00
|
|
|
freg_idx, //Index for Float Regs
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
TheISA::NumMiscRegs,
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
TheISA::ZeroReg,
|
|
|
|
TheISA::ZeroReg,
|
|
|
|
|
|
|
|
tid,
|
|
|
|
false);
|
|
|
|
|
|
|
|
renameMap[tid].init(TheISA::NumIntRegs,
|
|
|
|
params->numPhysIntRegs,
|
2006-05-19 21:37:52 +02:00
|
|
|
lreg_idx, //Index for Logical. Regs
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
TheISA::NumFloatRegs,
|
|
|
|
params->numPhysFloatRegs,
|
2006-05-19 21:37:52 +02:00
|
|
|
freg_idx, //Index for Float Regs
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
TheISA::NumMiscRegs,
|
|
|
|
|
|
|
|
TheISA::ZeroReg,
|
|
|
|
TheISA::ZeroReg,
|
|
|
|
|
|
|
|
tid,
|
|
|
|
bindRegs);
|
2006-10-08 06:53:41 +02:00
|
|
|
|
|
|
|
activateThreadEvent[tid].init(tid, this);
|
|
|
|
deallocateContextEvent[tid].init(tid, this);
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rename.setRenameMap(renameMap);
|
|
|
|
commit.setRenameMap(commitRenameMap);
|
|
|
|
|
|
|
|
// Give renameMap & rename stage access to the freeList;
|
2009-05-26 18:23:13 +02:00
|
|
|
for (ThreadID tid = 0; tid < numThreads; tid++)
|
|
|
|
renameMap[tid].setFreeList(&freeList);
|
2004-08-20 20:54:07 +02:00
|
|
|
rename.setFreeList(&freeList);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
// Setup the ROB for whichever stages need it.
|
|
|
|
commit.setROB(&rob);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
lastRunningCycle = curTick;
|
|
|
|
|
2006-07-02 00:52:02 +02:00
|
|
|
lastActivatedCycle = -1;
|
2009-05-26 18:23:13 +02:00
|
|
|
#if 0
|
2006-09-01 02:51:30 +02:00
|
|
|
// Give renameMap & rename stage access to the freeList;
|
2009-05-26 18:23:13 +02:00
|
|
|
for (ThreadID tid = 0; tid < numThreads; tid++)
|
|
|
|
globalSeqNum[tid] = 1;
|
|
|
|
#endif
|
2006-09-01 02:51:30 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
contextSwitch = false;
|
2008-10-09 09:08:50 +02:00
|
|
|
DPRINTF(O3CPU, "Creating O3CPU object.\n");
|
|
|
|
|
|
|
|
// Setup any thread state.
|
|
|
|
this->thread.resize(this->numThreads);
|
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
for (ThreadID tid = 0; tid < this->numThreads; ++tid) {
|
2008-10-09 09:08:50 +02:00
|
|
|
#if FULL_SYSTEM
|
|
|
|
// SMT is not supported in FS mode yet.
|
|
|
|
assert(this->numThreads == 1);
|
2009-05-26 18:23:13 +02:00
|
|
|
this->thread[tid] = new Thread(this, 0);
|
2008-10-09 09:08:50 +02:00
|
|
|
#else
|
2009-05-26 18:23:13 +02:00
|
|
|
if (tid < params->workload.size()) {
|
2008-10-09 09:08:50 +02:00
|
|
|
DPRINTF(O3CPU, "Workload[%i] process is %#x",
|
2009-05-26 18:23:13 +02:00
|
|
|
tid, this->thread[tid]);
|
|
|
|
this->thread[tid] = new typename FullO3CPU<Impl>::Thread(
|
2008-10-09 09:08:50 +02:00
|
|
|
(typename Impl::O3CPU *)(this),
|
2009-05-26 18:23:13 +02:00
|
|
|
tid, params->workload[tid], tid);
|
2008-10-09 09:08:50 +02:00
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
//usedTids[tid] = true;
|
|
|
|
//threadMap[tid] = tid;
|
2008-10-09 09:08:50 +02:00
|
|
|
} else {
|
|
|
|
//Allocate Empty thread so M5 can use later
|
|
|
|
//when scheduling threads to CPU
|
|
|
|
Process* dummy_proc = NULL;
|
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
this->thread[tid] = new typename FullO3CPU<Impl>::Thread(
|
2008-10-09 09:08:50 +02:00
|
|
|
(typename Impl::O3CPU *)(this),
|
2009-05-26 18:23:13 +02:00
|
|
|
tid, dummy_proc, tid);
|
|
|
|
//usedTids[tid] = false;
|
2008-10-09 09:08:50 +02:00
|
|
|
}
|
|
|
|
#endif // !FULL_SYSTEM
|
|
|
|
|
|
|
|
ThreadContext *tc;
|
|
|
|
|
|
|
|
// Setup the TC that will serve as the interface to the threads/CPU.
|
|
|
|
O3ThreadContext<Impl> *o3_tc = new O3ThreadContext<Impl>;
|
|
|
|
|
|
|
|
tc = o3_tc;
|
|
|
|
|
|
|
|
// If we're using a checker, then the TC should be the
|
|
|
|
// CheckerThreadContext.
|
|
|
|
#if USE_CHECKER
|
|
|
|
if (params->checker) {
|
|
|
|
tc = new CheckerThreadContext<O3ThreadContext<Impl> >(
|
|
|
|
o3_tc, this->checker);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
o3_tc->cpu = (typename Impl::O3CPU *)(this);
|
|
|
|
assert(o3_tc->cpu);
|
2009-05-26 18:23:13 +02:00
|
|
|
o3_tc->thread = this->thread[tid];
|
2008-10-09 09:08:50 +02:00
|
|
|
|
|
|
|
#if FULL_SYSTEM
|
|
|
|
// Setup quiesce event.
|
2009-05-26 18:23:13 +02:00
|
|
|
this->thread[tid]->quiesceEvent = new EndQuiesceEvent(tc);
|
2008-10-09 09:08:50 +02:00
|
|
|
#endif
|
|
|
|
// Give the thread the TC.
|
2009-05-26 18:23:13 +02:00
|
|
|
this->thread[tid]->tc = tc;
|
2008-10-09 09:08:50 +02:00
|
|
|
|
|
|
|
// Add the TC to the CPU's list of TC's.
|
|
|
|
this->threadContexts.push_back(tc);
|
|
|
|
}
|
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
for (ThreadID tid = 0; tid < this->numThreads; tid++)
|
|
|
|
this->thread[tid]->setFuncExeInst(0);
|
2008-10-09 09:08:50 +02:00
|
|
|
|
|
|
|
lockAddr = 0;
|
|
|
|
lockFlag = false;
|
|
|
|
}
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
template <class Impl>
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::~FullO3CPU()
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2008-10-09 09:08:50 +02:00
|
|
|
FullO3CPU<Impl>::regStats()
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
{
|
2006-06-16 23:08:47 +02:00
|
|
|
BaseO3CPU::regStats();
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2006-06-16 23:08:47 +02:00
|
|
|
// Register any of the O3CPU's stats here.
|
2006-04-23 00:26:48 +02:00
|
|
|
timesIdled
|
|
|
|
.name(name() + ".timesIdled")
|
|
|
|
.desc("Number of times that the entire CPU went into an idle state and"
|
|
|
|
" unscheduled itself")
|
|
|
|
.prereq(timesIdled);
|
|
|
|
|
|
|
|
idleCycles
|
|
|
|
.name(name() + ".idleCycles")
|
|
|
|
.desc("Total number of cycles that the CPU has spent unscheduled due "
|
|
|
|
"to idling")
|
|
|
|
.prereq(idleCycles);
|
|
|
|
|
|
|
|
// Number of Instructions simulated
|
|
|
|
// --------------------------------
|
|
|
|
// Should probably be in Base CPU but need templated
|
|
|
|
// MaxThreads so put in here instead
|
|
|
|
committedInsts
|
|
|
|
.init(numThreads)
|
|
|
|
.name(name() + ".committedInsts")
|
|
|
|
.desc("Number of Instructions Simulated");
|
|
|
|
|
|
|
|
totalCommittedInsts
|
|
|
|
.name(name() + ".committedInsts_total")
|
|
|
|
.desc("Number of Instructions Simulated");
|
|
|
|
|
|
|
|
cpi
|
|
|
|
.name(name() + ".cpi")
|
|
|
|
.desc("CPI: Cycles Per Instruction")
|
|
|
|
.precision(6);
|
2007-04-22 21:11:54 +02:00
|
|
|
cpi = numCycles / committedInsts;
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
totalCpi
|
|
|
|
.name(name() + ".cpi_total")
|
|
|
|
.desc("CPI: Total CPI of All Threads")
|
|
|
|
.precision(6);
|
2007-04-22 21:11:54 +02:00
|
|
|
totalCpi = numCycles / totalCommittedInsts;
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
ipc
|
|
|
|
.name(name() + ".ipc")
|
|
|
|
.desc("IPC: Instructions Per Cycle")
|
|
|
|
.precision(6);
|
2007-04-22 21:11:54 +02:00
|
|
|
ipc = committedInsts / numCycles;
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
totalIpc
|
|
|
|
.name(name() + ".ipc_total")
|
|
|
|
.desc("IPC: Total IPC of All Threads")
|
|
|
|
.precision(6);
|
2007-04-22 21:11:54 +02:00
|
|
|
totalIpc = totalCommittedInsts / numCycles;
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2008-10-09 09:08:50 +02:00
|
|
|
this->fetch.regStats();
|
|
|
|
this->decode.regStats();
|
|
|
|
this->rename.regStats();
|
|
|
|
this->iew.regStats();
|
|
|
|
this->commit.regStats();
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
}
|
|
|
|
|
2006-07-07 23:33:24 +02:00
|
|
|
template <class Impl>
|
|
|
|
Port *
|
|
|
|
FullO3CPU<Impl>::getPort(const std::string &if_name, int idx)
|
|
|
|
{
|
|
|
|
if (if_name == "dcache_port")
|
|
|
|
return iew.getDcachePort();
|
|
|
|
else if (if_name == "icache_port")
|
|
|
|
return fetch.getIcachePort();
|
|
|
|
else
|
|
|
|
panic("No Such Port\n");
|
|
|
|
}
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::tick()
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU, "\n\nFullO3CPU: Ticking main, FullO3CPU.\n");
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
++numCycles;
|
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
// activity = false;
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
//Tick each of the stages
|
2004-08-20 20:54:07 +02:00
|
|
|
fetch.tick();
|
|
|
|
|
|
|
|
decode.tick();
|
|
|
|
|
|
|
|
rename.tick();
|
|
|
|
|
|
|
|
iew.tick();
|
|
|
|
|
|
|
|
commit.tick();
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
#if !FULL_SYSTEM
|
|
|
|
doContextSwitch();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Now advance the time buffers
|
2004-08-20 20:54:07 +02:00
|
|
|
timeBuffer.advance();
|
|
|
|
|
|
|
|
fetchQueue.advance();
|
|
|
|
decodeQueue.advance();
|
|
|
|
renameQueue.advance();
|
|
|
|
iewQueue.advance();
|
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
activityRec.advance();
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
if (removeInstsThisCycle) {
|
|
|
|
cleanUpRemovedInsts();
|
|
|
|
}
|
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
if (!tickEvent.scheduled()) {
|
2006-07-07 21:38:15 +02:00
|
|
|
if (_status == SwitchedOut ||
|
2006-07-13 19:08:58 +02:00
|
|
|
getState() == SimObject::Drained) {
|
2006-10-09 17:01:19 +02:00
|
|
|
DPRINTF(O3CPU, "Switched out!\n");
|
2006-05-19 21:37:52 +02:00
|
|
|
// increment stat
|
|
|
|
lastRunningCycle = curTick;
|
2006-10-08 06:53:41 +02:00
|
|
|
} else if (!activityRec.active() || _status == Idle) {
|
2006-10-09 17:01:19 +02:00
|
|
|
DPRINTF(O3CPU, "Idle!\n");
|
2006-05-19 21:37:52 +02:00
|
|
|
lastRunningCycle = curTick;
|
|
|
|
timesIdled++;
|
|
|
|
} else {
|
2008-10-09 13:58:24 +02:00
|
|
|
schedule(tickEvent, nextCycle(curTick + ticks(1)));
|
2006-10-09 17:01:19 +02:00
|
|
|
DPRINTF(O3CPU, "Scheduling next tick!\n");
|
2006-05-19 21:37:52 +02:00
|
|
|
}
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#if !FULL_SYSTEM
|
|
|
|
updateThreadPriority();
|
|
|
|
#endif
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::init()
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2008-11-03 03:57:07 +01:00
|
|
|
BaseCPU::init();
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
// Set inSyscall so that the CPU doesn't squash when initially
|
|
|
|
// setting up registers.
|
2009-05-26 18:23:13 +02:00
|
|
|
for (ThreadID tid = 0; tid < numThreads; ++tid)
|
|
|
|
thread[tid]->inSyscall = true;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2005-08-30 19:18:54 +02:00
|
|
|
#if FULL_SYSTEM
|
2009-05-26 18:23:13 +02:00
|
|
|
for (ThreadID tid = 0; tid < numThreads; tid++) {
|
2006-06-06 23:32:21 +02:00
|
|
|
ThreadContext *src_tc = threadContexts[tid];
|
2008-11-03 03:57:07 +01:00
|
|
|
TheISA::initCPU(src_tc, src_tc->contextId());
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
2009-04-18 01:54:58 +02:00
|
|
|
#endif
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
// Clear inSyscall.
|
2009-05-26 18:23:13 +02:00
|
|
|
for (int tid = 0; tid < numThreads; ++tid)
|
|
|
|
thread[tid]->inSyscall = false;
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2006-05-16 20:06:35 +02:00
|
|
|
// Initialize stages.
|
2006-04-23 00:26:48 +02:00
|
|
|
fetch.initStage();
|
|
|
|
iew.initStage();
|
|
|
|
rename.initStage();
|
|
|
|
commit.initStage();
|
|
|
|
|
|
|
|
commit.setThreads(thread);
|
|
|
|
}
|
|
|
|
|
2006-07-07 10:06:26 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::activateThread(ThreadID tid)
|
2006-07-07 10:06:26 +02:00
|
|
|
{
|
2009-05-26 18:23:13 +02:00
|
|
|
list<ThreadID>::iterator isActive =
|
2008-01-02 21:20:15 +01:00
|
|
|
std::find(activeThreads.begin(), activeThreads.end(), tid);
|
2006-07-07 10:06:26 +02:00
|
|
|
|
2006-10-09 17:01:19 +02:00
|
|
|
DPRINTF(O3CPU, "[tid:%i]: Calling activate thread.\n", tid);
|
|
|
|
|
2006-07-07 10:06:26 +02:00
|
|
|
if (isActive == activeThreads.end()) {
|
|
|
|
DPRINTF(O3CPU, "[tid:%i]: Adding to active threads list\n",
|
|
|
|
tid);
|
|
|
|
|
|
|
|
activeThreads.push_back(tid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::deactivateThread(ThreadID tid)
|
2006-07-07 10:06:26 +02:00
|
|
|
{
|
|
|
|
//Remove From Active List, if Active
|
2009-05-26 18:23:13 +02:00
|
|
|
list<ThreadID>::iterator thread_it =
|
2008-01-02 21:20:15 +01:00
|
|
|
std::find(activeThreads.begin(), activeThreads.end(), tid);
|
2006-07-07 10:06:26 +02:00
|
|
|
|
2006-10-09 17:01:19 +02:00
|
|
|
DPRINTF(O3CPU, "[tid:%i]: Calling deactivate thread.\n", tid);
|
|
|
|
|
2006-07-07 10:06:26 +02:00
|
|
|
if (thread_it != activeThreads.end()) {
|
|
|
|
DPRINTF(O3CPU,"[tid:%i]: Removing from active threads list\n",
|
|
|
|
tid);
|
|
|
|
activeThreads.erase(thread_it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
template <class Impl>
|
|
|
|
Counter
|
|
|
|
FullO3CPU<Impl>::totalInstructions() const
|
|
|
|
{
|
|
|
|
Counter total(0);
|
|
|
|
|
|
|
|
ThreadID size = thread.size();
|
|
|
|
for (ThreadID i = 0; i < size; i++)
|
|
|
|
total += thread[i]->numInst;
|
|
|
|
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
2006-07-07 10:06:26 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::activateContext(ThreadID tid, int delay)
|
2006-07-07 10:06:26 +02:00
|
|
|
{
|
|
|
|
// Needs to set each stage to running as well.
|
|
|
|
if (delay){
|
|
|
|
DPRINTF(O3CPU, "[tid:%i]: Scheduling thread context to activate "
|
2007-09-28 19:21:52 +02:00
|
|
|
"on cycle %d\n", tid, curTick + ticks(delay));
|
2006-07-07 10:06:26 +02:00
|
|
|
scheduleActivateThreadEvent(tid, delay);
|
|
|
|
} else {
|
|
|
|
activateThread(tid);
|
|
|
|
}
|
|
|
|
|
2006-10-08 06:53:41 +02:00
|
|
|
if (lastActivatedCycle < curTick) {
|
2006-07-07 10:06:26 +02:00
|
|
|
scheduleTickEvent(delay);
|
|
|
|
|
|
|
|
// Be sure to signal that there's some activity so the CPU doesn't
|
|
|
|
// deschedule itself.
|
|
|
|
activityRec.activity();
|
|
|
|
fetch.wakeFromQuiesce();
|
|
|
|
|
|
|
|
lastActivatedCycle = curTick;
|
|
|
|
|
|
|
|
_status = Running;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
2006-10-08 06:53:41 +02:00
|
|
|
bool
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::deallocateContext(ThreadID tid, bool remove, int delay)
|
2006-07-07 10:06:26 +02:00
|
|
|
{
|
|
|
|
// Schedule removal of thread data from CPU
|
|
|
|
if (delay){
|
|
|
|
DPRINTF(O3CPU, "[tid:%i]: Scheduling thread context to deallocate "
|
2007-09-28 19:21:52 +02:00
|
|
|
"on cycle %d\n", tid, curTick + ticks(delay));
|
2006-10-08 06:53:41 +02:00
|
|
|
scheduleDeallocateContextEvent(tid, remove, delay);
|
|
|
|
return false;
|
2006-07-07 10:06:26 +02:00
|
|
|
} else {
|
|
|
|
deactivateThread(tid);
|
2006-10-08 06:53:41 +02:00
|
|
|
if (remove)
|
|
|
|
removeThread(tid);
|
|
|
|
return true;
|
2006-07-07 10:06:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::suspendContext(ThreadID tid)
|
2006-07-07 10:06:26 +02:00
|
|
|
{
|
|
|
|
DPRINTF(O3CPU,"[tid: %i]: Suspending Thread Context.\n", tid);
|
2006-10-08 06:53:41 +02:00
|
|
|
bool deallocated = deallocateContext(tid, false, 1);
|
|
|
|
// If this was the last thread then unschedule the tick event.
|
2008-09-28 06:03:49 +02:00
|
|
|
if ((activeThreads.size() == 1 && !deallocated) ||
|
2006-12-21 06:46:16 +01:00
|
|
|
activeThreads.size() == 0)
|
2006-07-14 19:06:37 +02:00
|
|
|
unscheduleTickEvent();
|
2006-07-07 10:06:26 +02:00
|
|
|
_status = Idle;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::haltContext(ThreadID tid)
|
2006-07-07 10:06:26 +02:00
|
|
|
{
|
2006-07-14 19:06:37 +02:00
|
|
|
//For now, this is the same as deallocate
|
|
|
|
DPRINTF(O3CPU,"[tid:%i]: Halt Context called. Deallocating", tid);
|
2006-10-08 06:53:41 +02:00
|
|
|
deallocateContext(tid, true, 1);
|
2006-07-07 10:06:26 +02:00
|
|
|
}
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::insertThread(ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
2006-07-06 17:25:44 +02:00
|
|
|
DPRINTF(O3CPU,"[tid:%i] Initializing thread into CPU");
|
2006-04-23 00:26:48 +02:00
|
|
|
// Will change now that the PC and thread state is internal to the CPU
|
2006-06-07 21:29:53 +02:00
|
|
|
// and not in the ThreadContext.
|
2006-04-23 00:26:48 +02:00
|
|
|
#if FULL_SYSTEM
|
2006-06-06 23:32:21 +02:00
|
|
|
ThreadContext *src_tc = system->threadContexts[tid];
|
2006-04-23 00:26:48 +02:00
|
|
|
#else
|
2006-07-06 17:25:44 +02:00
|
|
|
ThreadContext *src_tc = tcBase(tid);
|
2006-04-23 00:26:48 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//Bind Int Regs to Rename Map
|
|
|
|
for (int ireg = 0; ireg < TheISA::NumIntRegs; ireg++) {
|
|
|
|
PhysRegIndex phys_reg = freeList.getIntReg();
|
|
|
|
|
|
|
|
renameMap[tid].setEntry(ireg,phys_reg);
|
|
|
|
scoreboard.setReg(phys_reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
//Bind Float Regs to Rename Map
|
|
|
|
for (int freg = 0; freg < TheISA::NumFloatRegs; freg++) {
|
|
|
|
PhysRegIndex phys_reg = freeList.getFloatReg();
|
|
|
|
|
|
|
|
renameMap[tid].setEntry(freg,phys_reg);
|
|
|
|
scoreboard.setReg(phys_reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
//Copy Thread Data Into RegFile
|
2006-07-06 17:25:44 +02:00
|
|
|
//this->copyFromTC(tid);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2006-07-06 17:25:44 +02:00
|
|
|
//Set PC/NPC/NNPC
|
|
|
|
setPC(src_tc->readPC(), tid);
|
|
|
|
setNextPC(src_tc->readNextPC(), tid);
|
|
|
|
setNextNPC(src_tc->readNextNPC(), tid);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2006-06-06 23:32:21 +02:00
|
|
|
src_tc->setStatus(ThreadContext::Active);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
activateContext(tid,1);
|
|
|
|
|
|
|
|
//Reset ROB/IQ/LSQ Entries
|
|
|
|
commit.rob->resetEntries();
|
|
|
|
iew.resetEntries();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::removeThread(ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
2006-07-07 21:58:03 +02:00
|
|
|
DPRINTF(O3CPU,"[tid:%i] Removing thread context from CPU.\n", tid);
|
2006-07-06 17:25:44 +02:00
|
|
|
|
|
|
|
// Copy Thread Data From RegFile
|
|
|
|
// If thread is suspended, it might be re-allocated
|
2008-02-27 23:50:29 +01:00
|
|
|
// this->copyToTC(tid);
|
|
|
|
|
|
|
|
|
|
|
|
// @todo: 2-27-2008: Fix how we free up rename mappings
|
|
|
|
// here to alleviate the case for double-freeing registers
|
|
|
|
// in SMT workloads.
|
2006-07-06 17:25:44 +02:00
|
|
|
|
|
|
|
// Unbind Int Regs from Rename Map
|
2006-04-23 00:26:48 +02:00
|
|
|
for (int ireg = 0; ireg < TheISA::NumIntRegs; ireg++) {
|
|
|
|
PhysRegIndex phys_reg = renameMap[tid].lookup(ireg);
|
|
|
|
|
|
|
|
scoreboard.unsetReg(phys_reg);
|
|
|
|
freeList.addReg(phys_reg);
|
|
|
|
}
|
|
|
|
|
2006-07-06 17:25:44 +02:00
|
|
|
// Unbind Float Regs from Rename Map
|
2008-02-27 22:48:33 +01:00
|
|
|
for (int freg = TheISA::NumIntRegs; freg < TheISA::NumFloatRegs; freg++) {
|
2006-04-23 00:26:48 +02:00
|
|
|
PhysRegIndex phys_reg = renameMap[tid].lookup(freg);
|
|
|
|
|
|
|
|
scoreboard.unsetReg(phys_reg);
|
|
|
|
freeList.addReg(phys_reg);
|
|
|
|
}
|
|
|
|
|
2006-07-06 17:25:44 +02:00
|
|
|
// Squash Throughout Pipeline
|
2006-07-23 19:39:42 +02:00
|
|
|
InstSeqNum squash_seq_num = commit.rob->readHeadInst(tid)->seqNum;
|
2007-04-14 19:13:18 +02:00
|
|
|
fetch.squash(0, sizeof(TheISA::MachInst), 0, squash_seq_num, tid);
|
2006-04-23 00:26:48 +02:00
|
|
|
decode.squash(tid);
|
2006-07-23 19:39:42 +02:00
|
|
|
rename.squash(squash_seq_num, tid);
|
2006-07-07 10:06:26 +02:00
|
|
|
iew.squash(tid);
|
2008-02-27 22:53:08 +01:00
|
|
|
iew.ldstQueue.squash(squash_seq_num, tid);
|
2006-07-23 19:39:42 +02:00
|
|
|
commit.rob->squash(squash_seq_num, tid);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2008-02-27 22:48:33 +01:00
|
|
|
|
|
|
|
assert(iew.instQueue.getCount(tid) == 0);
|
2006-04-23 00:26:48 +02:00
|
|
|
assert(iew.ldstQueue.getCount(tid) == 0);
|
|
|
|
|
2006-07-06 17:25:44 +02:00
|
|
|
// Reset ROB/IQ/LSQ Entries
|
2006-10-10 04:49:58 +02:00
|
|
|
|
|
|
|
// Commented out for now. This should be possible to do by
|
|
|
|
// telling all the pipeline stages to drain first, and then
|
|
|
|
// checking until the drain completes. Once the pipeline is
|
|
|
|
// drained, call resetEntries(). - 10-09-06 ktlim
|
|
|
|
/*
|
2006-04-23 00:26:48 +02:00
|
|
|
if (activeThreads.size() >= 1) {
|
|
|
|
commit.rob->resetEntries();
|
|
|
|
iew.resetEntries();
|
|
|
|
}
|
2006-10-10 04:49:58 +02:00
|
|
|
*/
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::activateWhenReady(ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU,"[tid:%i]: Checking if resources are available for incoming"
|
2006-04-23 00:26:48 +02:00
|
|
|
"(e.g. PhysRegs/ROB/IQ/LSQ) \n",
|
|
|
|
tid);
|
|
|
|
|
|
|
|
bool ready = true;
|
|
|
|
|
|
|
|
if (freeList.numFreeIntRegs() >= TheISA::NumIntRegs) {
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
|
2006-04-23 00:26:48 +02:00
|
|
|
"Phys. Int. Regs.\n",
|
|
|
|
tid);
|
|
|
|
ready = false;
|
|
|
|
} else if (freeList.numFreeFloatRegs() >= TheISA::NumFloatRegs) {
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
|
2006-04-23 00:26:48 +02:00
|
|
|
"Phys. Float. Regs.\n",
|
|
|
|
tid);
|
|
|
|
ready = false;
|
|
|
|
} else if (commit.rob->numFreeEntries() >=
|
|
|
|
commit.rob->entryAmount(activeThreads.size() + 1)) {
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
|
2006-04-23 00:26:48 +02:00
|
|
|
"ROB entries.\n",
|
|
|
|
tid);
|
|
|
|
ready = false;
|
|
|
|
} else if (iew.instQueue.numFreeEntries() >=
|
|
|
|
iew.instQueue.entryAmount(activeThreads.size() + 1)) {
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
|
2006-04-23 00:26:48 +02:00
|
|
|
"IQ entries.\n",
|
|
|
|
tid);
|
|
|
|
ready = false;
|
|
|
|
} else if (iew.ldstQueue.numFreeEntries() >=
|
|
|
|
iew.ldstQueue.entryAmount(activeThreads.size() + 1)) {
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
|
2006-04-23 00:26:48 +02:00
|
|
|
"LSQ entries.\n",
|
|
|
|
tid);
|
|
|
|
ready = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ready) {
|
|
|
|
insertThread(tid);
|
|
|
|
|
|
|
|
contextSwitch = false;
|
|
|
|
|
|
|
|
cpuWaitList.remove(tid);
|
|
|
|
} else {
|
|
|
|
suspendContext(tid);
|
|
|
|
|
|
|
|
//blocks fetch
|
|
|
|
contextSwitch = true;
|
|
|
|
|
2006-07-07 10:06:26 +02:00
|
|
|
//@todo: dont always add to waitlist
|
2006-04-23 00:26:48 +02:00
|
|
|
//do waitlist
|
|
|
|
cpuWaitList.push_back(tid);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-09 16:06:09 +01:00
|
|
|
#if FULL_SYSTEM
|
2008-10-20 22:22:59 +02:00
|
|
|
template <class Impl>
|
|
|
|
Fault
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::hwrei(ThreadID tid)
|
2008-10-20 22:22:59 +02:00
|
|
|
{
|
|
|
|
#if THE_ISA == ALPHA_ISA
|
|
|
|
// Need to clear the lock flag upon returning from an interrupt.
|
|
|
|
this->setMiscRegNoEffect(AlphaISA::MISCREG_LOCKFLAG, false, tid);
|
|
|
|
|
|
|
|
this->thread[tid]->kernelStats->hwrei();
|
|
|
|
|
|
|
|
// FIXME: XXX check for interrupts? XXX
|
|
|
|
#endif
|
|
|
|
return NoFault;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
bool
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::simPalCheck(int palFunc, ThreadID tid)
|
2008-10-20 22:22:59 +02:00
|
|
|
{
|
|
|
|
#if THE_ISA == ALPHA_ISA
|
|
|
|
if (this->thread[tid]->kernelStats)
|
|
|
|
this->thread[tid]->kernelStats->callpal(palFunc,
|
|
|
|
this->threadContexts[tid]);
|
|
|
|
|
|
|
|
switch (palFunc) {
|
|
|
|
case PAL::halt:
|
|
|
|
halt();
|
|
|
|
if (--System::numSystemsRunning == 0)
|
|
|
|
exitSimLoop("all cpus halted");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAL::bpt:
|
|
|
|
case PAL::bugchk:
|
|
|
|
if (this->system->breakpoint())
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-10-09 09:08:50 +02:00
|
|
|
template <class Impl>
|
|
|
|
Fault
|
|
|
|
FullO3CPU<Impl>::getInterrupts()
|
|
|
|
{
|
|
|
|
// Check if there are any outstanding interrupts
|
2008-10-12 18:09:56 +02:00
|
|
|
return this->interrupts->getInterrupt(this->threadContexts[0]);
|
2008-10-09 09:08:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::processInterrupts(Fault interrupt)
|
|
|
|
{
|
|
|
|
// Check for interrupts here. For now can copy the code that
|
|
|
|
// exists within isa_fullsys_traits.hh. Also assume that thread 0
|
|
|
|
// is the one that handles the interrupts.
|
|
|
|
// @todo: Possibly consolidate the interrupt checking code.
|
|
|
|
// @todo: Allow other threads to handle interrupts.
|
|
|
|
|
|
|
|
assert(interrupt != NoFault);
|
2008-10-12 18:09:56 +02:00
|
|
|
this->interrupts->updateIntrInfo(this->threadContexts[0]);
|
2008-10-09 09:08:50 +02:00
|
|
|
|
|
|
|
DPRINTF(O3CPU, "Interrupt %s being handled\n", interrupt->name());
|
|
|
|
this->trap(interrupt, 0);
|
|
|
|
}
|
|
|
|
|
2007-03-09 16:06:09 +01:00
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::updateMemPorts()
|
|
|
|
{
|
|
|
|
// Update all ThreadContext's memory ports (Functional/Virtual
|
|
|
|
// Ports)
|
2009-05-26 18:23:13 +02:00
|
|
|
ThreadID size = thread.size();
|
|
|
|
for (ThreadID i = 0; i < size; ++i)
|
2008-07-01 16:24:16 +02:00
|
|
|
thread[i]->connectMemPorts(thread[i]->getTC());
|
2007-03-09 16:06:09 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-10-09 09:08:50 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::trap(Fault fault, ThreadID tid)
|
2008-10-09 09:08:50 +02:00
|
|
|
{
|
|
|
|
// Pass the thread's TC into the invoke method.
|
|
|
|
fault->invoke(this->threadContexts[tid]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if !FULL_SYSTEM
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::syscall(int64_t callnum, ThreadID tid)
|
2008-10-09 09:08:50 +02:00
|
|
|
{
|
|
|
|
DPRINTF(O3CPU, "[tid:%i] Executing syscall().\n\n", tid);
|
|
|
|
|
|
|
|
DPRINTF(Activity,"Activity: syscall() called.\n");
|
|
|
|
|
|
|
|
// Temporarily increase this by one to account for the syscall
|
|
|
|
// instruction.
|
|
|
|
++(this->thread[tid]->funcExeInst);
|
|
|
|
|
|
|
|
// Execute the actual syscall.
|
|
|
|
this->thread[tid]->syscall(callnum);
|
|
|
|
|
|
|
|
// Decrease funcExeInst by one as the normal commit will handle
|
|
|
|
// incrementing it.
|
|
|
|
--(this->thread[tid]->funcExeInst);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2006-07-07 05:13:38 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::serialize(std::ostream &os)
|
|
|
|
{
|
2006-07-12 23:18:34 +02:00
|
|
|
SimObject::State so_state = SimObject::getState();
|
|
|
|
SERIALIZE_ENUM(so_state);
|
2006-07-07 05:13:38 +02:00
|
|
|
BaseCPU::serialize(os);
|
|
|
|
nameOut(os, csprintf("%s.tickEvent", name()));
|
|
|
|
tickEvent.serialize(os);
|
|
|
|
|
|
|
|
// Use SimpleThread's ability to checkpoint to make it easier to
|
|
|
|
// write out the registers. Also make this static so it doesn't
|
|
|
|
// get instantiated multiple times (causes a panic in statistics).
|
|
|
|
static SimpleThread temp;
|
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
ThreadID size = thread.size();
|
|
|
|
for (ThreadID i = 0; i < size; i++) {
|
2006-07-07 05:13:38 +02:00
|
|
|
nameOut(os, csprintf("%s.xc.%i", name(), i));
|
|
|
|
temp.copyTC(thread[i]->getTC());
|
|
|
|
temp.serialize(os);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::unserialize(Checkpoint *cp, const std::string §ion)
|
|
|
|
{
|
2006-07-12 23:18:34 +02:00
|
|
|
SimObject::State so_state;
|
|
|
|
UNSERIALIZE_ENUM(so_state);
|
2006-07-07 05:13:38 +02:00
|
|
|
BaseCPU::unserialize(cp, section);
|
|
|
|
tickEvent.unserialize(cp, csprintf("%s.tickEvent", section));
|
|
|
|
|
|
|
|
// Use SimpleThread's ability to checkpoint to make it easier to
|
|
|
|
// read in the registers. Also make this static so it doesn't
|
|
|
|
// get instantiated multiple times (causes a panic in statistics).
|
|
|
|
static SimpleThread temp;
|
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
ThreadID size = thread.size();
|
|
|
|
for (ThreadID i = 0; i < size; i++) {
|
2006-07-07 05:13:38 +02:00
|
|
|
temp.copyTC(thread[i]->getTC());
|
|
|
|
temp.unserialize(cp, csprintf("%s.xc.%i", section, i));
|
|
|
|
thread[i]->getTC()->copyArchRegs(temp.getTC());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
template <class Impl>
|
2006-07-13 19:08:58 +02:00
|
|
|
unsigned int
|
2006-07-06 19:59:02 +02:00
|
|
|
FullO3CPU<Impl>::drain(Event *drain_event)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-10-01 05:43:23 +02:00
|
|
|
DPRINTF(O3CPU, "Switching out\n");
|
2006-11-09 17:33:44 +01:00
|
|
|
|
|
|
|
// If the CPU isn't doing anything, then return immediately.
|
|
|
|
if (_status == Idle || _status == SwitchedOut) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-07-06 19:59:02 +02:00
|
|
|
drainCount = 0;
|
|
|
|
fetch.drain();
|
|
|
|
decode.drain();
|
|
|
|
rename.drain();
|
|
|
|
iew.drain();
|
|
|
|
commit.drain();
|
2006-05-19 21:37:52 +02:00
|
|
|
|
|
|
|
// Wake the CPU and record activity so everything can drain out if
|
2006-07-06 23:57:20 +02:00
|
|
|
// the CPU was not able to immediately drain.
|
2006-07-13 19:08:58 +02:00
|
|
|
if (getState() != SimObject::Drained) {
|
2006-07-07 05:13:38 +02:00
|
|
|
// A bit of a hack...set the drainEvent after all the drain()
|
|
|
|
// calls have been made, that way if all of the stages drain
|
|
|
|
// immediately, the signalDrained() function knows not to call
|
|
|
|
// process on the drain event.
|
|
|
|
drainEvent = drain_event;
|
|
|
|
|
2006-07-06 23:57:20 +02:00
|
|
|
wakeCPU();
|
|
|
|
activityRec.activity();
|
2006-07-06 19:59:02 +02:00
|
|
|
|
2006-07-13 19:08:58 +02:00
|
|
|
return 1;
|
2006-07-06 23:57:20 +02:00
|
|
|
} else {
|
2006-07-13 19:08:58 +02:00
|
|
|
return 0;
|
2006-07-06 23:57:20 +02:00
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2006-07-06 19:59:02 +02:00
|
|
|
FullO3CPU<Impl>::resume()
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-07-06 19:59:02 +02:00
|
|
|
fetch.resume();
|
|
|
|
decode.resume();
|
|
|
|
rename.resume();
|
|
|
|
iew.resume();
|
|
|
|
commit.resume();
|
|
|
|
|
2006-07-13 19:08:58 +02:00
|
|
|
changeState(SimObject::Running);
|
|
|
|
|
2006-07-07 05:13:38 +02:00
|
|
|
if (_status == SwitchedOut || _status == Idle)
|
|
|
|
return;
|
|
|
|
|
2006-10-18 23:59:11 +02:00
|
|
|
#if FULL_SYSTEM
|
2007-07-24 06:51:38 +02:00
|
|
|
assert(system->getMemoryMode() == Enums::timing);
|
2006-10-18 23:59:11 +02:00
|
|
|
#endif
|
|
|
|
|
2006-07-06 19:59:02 +02:00
|
|
|
if (!tickEvent.scheduled())
|
2008-10-09 13:58:24 +02:00
|
|
|
schedule(tickEvent, nextCycle());
|
2006-07-06 19:59:02 +02:00
|
|
|
_status = Running;
|
|
|
|
}
|
2006-05-16 20:06:35 +02:00
|
|
|
|
2006-07-06 19:59:02 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::signalDrained()
|
|
|
|
{
|
|
|
|
if (++drainCount == NumStages) {
|
2006-05-16 20:06:35 +02:00
|
|
|
if (tickEvent.scheduled())
|
|
|
|
tickEvent.squash();
|
2006-07-06 23:57:20 +02:00
|
|
|
|
2006-07-13 19:08:58 +02:00
|
|
|
changeState(SimObject::Drained);
|
2006-07-06 23:57:20 +02:00
|
|
|
|
2006-10-02 17:58:09 +02:00
|
|
|
BaseCPU::switchOut();
|
|
|
|
|
2006-07-06 23:57:20 +02:00
|
|
|
if (drainEvent) {
|
|
|
|
drainEvent->process();
|
|
|
|
drainEvent = NULL;
|
|
|
|
}
|
2006-05-16 20:06:35 +02:00
|
|
|
}
|
2006-07-06 19:59:02 +02:00
|
|
|
assert(drainCount <= 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::switchOut()
|
|
|
|
{
|
|
|
|
fetch.switchOut();
|
|
|
|
rename.switchOut();
|
2006-05-04 17:36:20 +02:00
|
|
|
iew.switchOut();
|
2006-07-06 19:59:02 +02:00
|
|
|
commit.switchOut();
|
|
|
|
instList.clear();
|
|
|
|
while (!removeList.empty()) {
|
|
|
|
removeList.pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
_status = SwitchedOut;
|
|
|
|
#if USE_CHECKER
|
|
|
|
if (checker)
|
|
|
|
checker->switchOut();
|
|
|
|
#endif
|
2006-10-02 17:58:09 +02:00
|
|
|
if (tickEvent.scheduled())
|
|
|
|
tickEvent.squash();
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::takeOverFrom(BaseCPU *oldCPU)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-05-19 21:37:52 +02:00
|
|
|
// Flush out any old data from the time buffers.
|
2006-07-10 21:40:28 +02:00
|
|
|
for (int i = 0; i < timeBuffer.getSize(); ++i) {
|
2006-05-04 17:36:20 +02:00
|
|
|
timeBuffer.advance();
|
|
|
|
fetchQueue.advance();
|
|
|
|
decodeQueue.advance();
|
|
|
|
renameQueue.advance();
|
|
|
|
iewQueue.advance();
|
|
|
|
}
|
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
activityRec.reset();
|
2006-05-04 17:36:20 +02:00
|
|
|
|
2007-03-09 16:06:09 +01:00
|
|
|
BaseCPU::takeOverFrom(oldCPU, fetch.getIcachePort(), iew.getDcachePort());
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-05-04 17:36:20 +02:00
|
|
|
fetch.takeOverFrom();
|
|
|
|
decode.takeOverFrom();
|
|
|
|
rename.takeOverFrom();
|
|
|
|
iew.takeOverFrom();
|
|
|
|
commit.takeOverFrom();
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
assert(!tickEvent.scheduled());
|
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
// @todo: Figure out how to properly select the tid to put onto
|
|
|
|
// the active threads list.
|
2009-05-26 18:23:13 +02:00
|
|
|
ThreadID tid = 0;
|
2006-05-04 17:36:20 +02:00
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
list<ThreadID>::iterator isActive =
|
2008-01-02 21:20:15 +01:00
|
|
|
std::find(activeThreads.begin(), activeThreads.end(), tid);
|
2006-05-04 17:36:20 +02:00
|
|
|
|
|
|
|
if (isActive == activeThreads.end()) {
|
2006-05-19 21:37:52 +02:00
|
|
|
//May Need to Re-code this if the delay variable is the delay
|
|
|
|
//needed for thread to activate
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU, "Adding Thread %i to active threads list\n",
|
2006-05-04 17:36:20 +02:00
|
|
|
tid);
|
|
|
|
|
|
|
|
activeThreads.push_back(tid);
|
|
|
|
}
|
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
// Set all statuses to active, schedule the CPU's tick event.
|
2006-05-04 17:36:20 +02:00
|
|
|
// @todo: Fix up statuses so this is handled properly
|
2009-05-26 18:23:13 +02:00
|
|
|
ThreadID size = threadContexts.size();
|
|
|
|
for (ThreadID i = 0; i < size; ++i) {
|
2006-06-06 23:32:21 +02:00
|
|
|
ThreadContext *tc = threadContexts[i];
|
|
|
|
if (tc->status() == ThreadContext::Active && _status != Running) {
|
2005-05-03 16:56:47 +02:00
|
|
|
_status = Running;
|
2008-10-09 13:58:24 +02:00
|
|
|
schedule(tickEvent, nextCycle());
|
2005-05-03 16:56:47 +02:00
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
2006-05-04 17:36:20 +02:00
|
|
|
if (!tickEvent.scheduled())
|
2008-10-09 13:58:24 +02:00
|
|
|
schedule(tickEvent, nextCycle());
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
2008-10-09 09:08:50 +02:00
|
|
|
template <class Impl>
|
|
|
|
TheISA::MiscReg
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::readMiscRegNoEffect(int misc_reg, ThreadID tid)
|
2008-10-09 09:08:50 +02:00
|
|
|
{
|
2009-07-09 08:02:20 +02:00
|
|
|
return this->isa[tid].readMiscRegNoEffect(misc_reg);
|
2008-10-09 09:08:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
TheISA::MiscReg
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::readMiscReg(int misc_reg, ThreadID tid)
|
2008-10-09 09:08:50 +02:00
|
|
|
{
|
2009-07-09 08:02:20 +02:00
|
|
|
return this->isa[tid].readMiscReg(misc_reg, tcBase(tid));
|
2008-10-09 09:08:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::setMiscRegNoEffect(int misc_reg,
|
2009-05-26 18:23:13 +02:00
|
|
|
const TheISA::MiscReg &val, ThreadID tid)
|
2008-10-09 09:08:50 +02:00
|
|
|
{
|
2009-07-09 08:02:20 +02:00
|
|
|
this->isa[tid].setMiscRegNoEffect(misc_reg, val);
|
2008-10-09 09:08:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::setMiscReg(int misc_reg,
|
2009-05-26 18:23:13 +02:00
|
|
|
const TheISA::MiscReg &val, ThreadID tid)
|
2008-10-09 09:08:50 +02:00
|
|
|
{
|
2009-07-09 08:02:20 +02:00
|
|
|
this->isa[tid].setMiscReg(misc_reg, val, tcBase(tid));
|
2008-10-09 09:08:50 +02:00
|
|
|
}
|
|
|
|
|
2004-08-20 20:54:07 +02:00
|
|
|
template <class Impl>
|
|
|
|
uint64_t
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::readIntReg(int reg_idx)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
|
|
|
return regFile.readIntReg(reg_idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
2006-03-14 21:55:00 +01:00
|
|
|
FloatReg
|
|
|
|
FullO3CPU<Impl>::readFloatReg(int reg_idx)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-03-14 21:55:00 +01:00
|
|
|
return regFile.readFloatReg(reg_idx);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
2006-03-14 21:55:00 +01:00
|
|
|
template <class Impl>
|
|
|
|
FloatRegBits
|
|
|
|
FullO3CPU<Impl>::readFloatRegBits(int reg_idx)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-03-14 21:55:00 +01:00
|
|
|
return regFile.readFloatRegBits(reg_idx);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::setIntReg(int reg_idx, uint64_t val)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
|
|
|
regFile.setIntReg(reg_idx, val);
|
|
|
|
}
|
|
|
|
|
2006-03-14 21:55:00 +01:00
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::setFloatReg(int reg_idx, FloatReg val)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-03-14 21:55:00 +01:00
|
|
|
regFile.setFloatReg(reg_idx, val);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2006-03-14 21:55:00 +01:00
|
|
|
FullO3CPU<Impl>::setFloatRegBits(int reg_idx, FloatRegBits val)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-03-14 21:55:00 +01:00
|
|
|
regFile.setFloatRegBits(reg_idx, val);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
uint64_t
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::readArchIntReg(int reg_idx, ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
|
|
|
PhysRegIndex phys_reg = commitRenameMap[tid].lookup(reg_idx);
|
|
|
|
|
|
|
|
return regFile.readIntReg(phys_reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
float
|
2009-07-09 08:02:20 +02:00
|
|
|
FullO3CPU<Impl>::readArchFloatReg(int reg_idx, ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
2009-04-16 08:10:43 +02:00
|
|
|
int idx = reg_idx + TheISA::NumIntRegs;
|
2006-05-04 17:36:20 +02:00
|
|
|
PhysRegIndex phys_reg = commitRenameMap[tid].lookup(idx);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
return regFile.readFloatReg(phys_reg);
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
uint64_t
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::readArchFloatRegInt(int reg_idx, ThreadID tid)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2009-04-16 08:10:43 +02:00
|
|
|
int idx = reg_idx + TheISA::NumIntRegs;
|
2006-05-04 17:36:20 +02:00
|
|
|
PhysRegIndex phys_reg = commitRenameMap[tid].lookup(idx);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
return regFile.readFloatRegBits(phys_reg);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::setArchIntReg(int reg_idx, uint64_t val, ThreadID tid)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-04-23 00:26:48 +02:00
|
|
|
PhysRegIndex phys_reg = commitRenameMap[tid].lookup(reg_idx);
|
|
|
|
|
|
|
|
regFile.setIntReg(phys_reg, val);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-07-09 08:02:20 +02:00
|
|
|
FullO3CPU<Impl>::setArchFloatReg(int reg_idx, float val, ThreadID tid)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2009-04-16 08:10:43 +02:00
|
|
|
int idx = reg_idx + TheISA::NumIntRegs;
|
2006-07-12 23:18:34 +02:00
|
|
|
PhysRegIndex phys_reg = commitRenameMap[tid].lookup(idx);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
regFile.setFloatReg(phys_reg, val);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::setArchFloatRegInt(int reg_idx, uint64_t val, ThreadID tid)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2009-04-16 08:10:43 +02:00
|
|
|
int idx = reg_idx + TheISA::NumIntRegs;
|
2006-07-12 23:18:34 +02:00
|
|
|
PhysRegIndex phys_reg = commitRenameMap[tid].lookup(idx);
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
regFile.setFloatRegBits(phys_reg, val);
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
uint64_t
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::readPC(ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
|
|
|
return commit.readPC(tid);
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::setPC(Addr new_PC, ThreadID tid)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-04-23 00:26:48 +02:00
|
|
|
commit.setPC(new_PC, tid);
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2007-04-14 19:13:18 +02:00
|
|
|
template <class Impl>
|
|
|
|
uint64_t
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::readMicroPC(ThreadID tid)
|
2007-04-14 19:13:18 +02:00
|
|
|
{
|
|
|
|
return commit.readMicroPC(tid);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::setMicroPC(Addr new_PC, ThreadID tid)
|
2007-04-14 19:13:18 +02:00
|
|
|
{
|
|
|
|
commit.setMicroPC(new_PC, tid);
|
|
|
|
}
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
template <class Impl>
|
|
|
|
uint64_t
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::readNextPC(ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
|
|
|
return commit.readNextPC(tid);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::setNextPC(uint64_t val, ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
|
|
|
commit.setNextPC(val, tid);
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-06-16 04:01:28 +02:00
|
|
|
template <class Impl>
|
|
|
|
uint64_t
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::readNextNPC(ThreadID tid)
|
2006-06-16 04:01:28 +02:00
|
|
|
{
|
|
|
|
return commit.readNextNPC(tid);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::setNextNPC(uint64_t val, ThreadID tid)
|
2006-06-16 04:01:28 +02:00
|
|
|
{
|
|
|
|
commit.setNextNPC(val, tid);
|
|
|
|
}
|
|
|
|
|
2007-04-14 19:13:18 +02:00
|
|
|
template <class Impl>
|
|
|
|
uint64_t
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::readNextMicroPC(ThreadID tid)
|
2007-04-14 19:13:18 +02:00
|
|
|
{
|
|
|
|
return commit.readNextMicroPC(tid);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::setNextMicroPC(Addr new_PC, ThreadID tid)
|
2007-04-14 19:13:18 +02:00
|
|
|
{
|
|
|
|
commit.setNextMicroPC(new_PC, tid);
|
|
|
|
}
|
|
|
|
|
2008-10-09 09:08:50 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::squashFromTC(ThreadID tid)
|
2008-10-09 09:08:50 +02:00
|
|
|
{
|
|
|
|
this->thread[tid]->inSyscall = true;
|
|
|
|
this->commit.generateTCEvent(tid);
|
|
|
|
}
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
template <class Impl>
|
|
|
|
typename FullO3CPU<Impl>::ListIt
|
|
|
|
FullO3CPU<Impl>::addInst(DynInstPtr &inst)
|
|
|
|
{
|
|
|
|
instList.push_back(inst);
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
return --(instList.end());
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::instDone(ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
|
|
|
// Keep an instruction count.
|
|
|
|
thread[tid]->numInst++;
|
|
|
|
thread[tid]->numInsts++;
|
|
|
|
committedInsts[tid]++;
|
|
|
|
totalCommittedInsts++;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
// Check for instruction-count-based events.
|
|
|
|
comInstEventQueue[tid]->serviceEvents(thread[tid]->numInst);
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::addToRemoveList(DynInstPtr &inst)
|
|
|
|
{
|
|
|
|
removeInstsThisCycle = true;
|
|
|
|
|
|
|
|
removeList.push(inst->getInstListIt());
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::removeFrontInst(DynInstPtr &inst)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU, "Removing committed instruction [tid:%i] PC %#x "
|
2006-04-23 00:26:48 +02:00
|
|
|
"[sn:%lli]\n",
|
2006-04-24 23:11:31 +02:00
|
|
|
inst->threadNumber, inst->readPC(), inst->seqNum);
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
removeInstsThisCycle = true;
|
2004-08-20 20:54:07 +02:00
|
|
|
|
|
|
|
// Remove the front instruction.
|
2006-04-23 00:26:48 +02:00
|
|
|
removeList.push(inst->getInstListIt());
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::removeInstsNotInROB(ThreadID tid)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU, "Thread %i: Deleting instructions from instruction"
|
2006-04-23 00:26:48 +02:00
|
|
|
" list.\n", tid);
|
|
|
|
|
|
|
|
ListIt end_it;
|
|
|
|
|
|
|
|
bool rob_empty = false;
|
|
|
|
|
|
|
|
if (instList.empty()) {
|
|
|
|
return;
|
|
|
|
} else if (rob.isEmpty(/*tid*/)) {
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU, "ROB is empty, squashing all insts.\n");
|
2006-04-23 00:26:48 +02:00
|
|
|
end_it = instList.begin();
|
|
|
|
rob_empty = true;
|
|
|
|
} else {
|
|
|
|
end_it = (rob.readTailInst(tid))->getInstListIt();
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU, "ROB is not empty, squashing insts not in ROB.\n");
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
removeInstsThisCycle = true;
|
|
|
|
|
|
|
|
ListIt inst_it = instList.end();
|
|
|
|
|
|
|
|
inst_it--;
|
|
|
|
|
|
|
|
// Walk through the instruction list, removing any instructions
|
|
|
|
// that were inserted after the given instruction iterator, end_it.
|
|
|
|
while (inst_it != end_it) {
|
|
|
|
assert(!instList.empty());
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
squashInstIt(inst_it, tid);
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
inst_it--;
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
// If the ROB was empty, then we actually need to remove the first
|
|
|
|
// instruction as well.
|
|
|
|
if (rob_empty) {
|
|
|
|
squashInstIt(inst_it, tid);
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
}
|
|
|
|
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::removeInstsUntil(const InstSeqNum &seq_num, ThreadID tid)
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
{
|
2006-04-23 00:26:48 +02:00
|
|
|
assert(!instList.empty());
|
|
|
|
|
|
|
|
removeInstsThisCycle = true;
|
|
|
|
|
|
|
|
ListIt inst_iter = instList.end();
|
|
|
|
|
|
|
|
inst_iter--;
|
|
|
|
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU, "Deleting instructions from instruction "
|
2006-04-23 00:26:48 +02:00
|
|
|
"list that are from [tid:%i] and above [sn:%lli] (end=%lli).\n",
|
|
|
|
tid, seq_num, (*inst_iter)->seqNum);
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
while ((*inst_iter)->seqNum > seq_num) {
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
bool break_loop = (inst_iter == instList.begin());
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
squashInstIt(inst_iter, tid);
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
inst_iter--;
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
if (break_loop)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
inline void
|
2009-05-26 18:23:13 +02:00
|
|
|
FullO3CPU<Impl>::squashInstIt(const ListIt &instIt, ThreadID tid)
|
2006-04-23 00:26:48 +02:00
|
|
|
{
|
|
|
|
if ((*instIt)->threadNumber == tid) {
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU, "Squashing instruction, "
|
2006-04-23 00:26:48 +02:00
|
|
|
"[tid:%i] [sn:%lli] PC %#x\n",
|
|
|
|
(*instIt)->threadNumber,
|
|
|
|
(*instIt)->seqNum,
|
|
|
|
(*instIt)->readPC());
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
|
|
|
|
// Mark it as squashed.
|
2006-04-23 00:26:48 +02:00
|
|
|
(*instIt)->setSquashed();
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
// @todo: Formulate a consistent method for deleting
|
|
|
|
// instructions from the instruction list
|
2006-04-23 00:26:48 +02:00
|
|
|
// Remove the instruction from the list.
|
|
|
|
removeList.push(instIt);
|
|
|
|
}
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
}
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::cleanUpRemovedInsts()
|
|
|
|
{
|
|
|
|
while (!removeList.empty()) {
|
2006-06-16 23:08:47 +02:00
|
|
|
DPRINTF(O3CPU, "Removing instruction, "
|
2006-04-23 00:26:48 +02:00
|
|
|
"[tid:%i] [sn:%lli] PC %#x\n",
|
|
|
|
(*removeList.front())->threadNumber,
|
|
|
|
(*removeList.front())->seqNum,
|
|
|
|
(*removeList.front())->readPC());
|
|
|
|
|
|
|
|
instList.erase(removeList.front());
|
|
|
|
|
|
|
|
removeList.pop();
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
}
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
removeInstsThisCycle = false;
|
Check in of various updates to the CPU. Mainly adds in stats, improves
branch prediction, and makes memory dependence work properly.
SConscript:
Added return address stack, tournament predictor.
cpu/base_cpu.cc:
Added debug break and print statements.
cpu/base_dyn_inst.cc:
cpu/base_dyn_inst.hh:
Comment out possibly unneeded variables.
cpu/beta_cpu/2bit_local_pred.cc:
2bit predictor no longer speculatively updates itself.
cpu/beta_cpu/alpha_dyn_inst.hh:
Comment formatting.
cpu/beta_cpu/alpha_full_cpu.hh:
Formatting
cpu/beta_cpu/alpha_full_cpu_builder.cc:
Added new parameters for branch predictors, and IQ parameters.
cpu/beta_cpu/alpha_full_cpu_impl.hh:
Register stats.
cpu/beta_cpu/alpha_params.hh:
Added parameters for IQ, branch predictors, and store sets.
cpu/beta_cpu/bpred_unit.cc:
Removed one class.
cpu/beta_cpu/bpred_unit.hh:
Add in RAS, stats. Changed branch predictor unit functionality
so that it holds a history of past branches so it can update, and also
hold a proper history of the RAS so it can be restored on branch
mispredicts.
cpu/beta_cpu/bpred_unit_impl.hh:
Added in stats, history of branches, RAS. Now bpred unit actually
modifies the instruction's predicted next PC.
cpu/beta_cpu/btb.cc:
Add in sanity checks.
cpu/beta_cpu/comm.hh:
Add in communication where needed, remove it where it's not.
cpu/beta_cpu/commit.hh:
cpu/beta_cpu/rename.hh:
cpu/beta_cpu/rename_impl.hh:
Add in stats.
cpu/beta_cpu/commit_impl.hh:
Stats, update what is sent back on branch mispredict.
cpu/beta_cpu/cpu_policy.hh:
Change the bpred unit being used.
cpu/beta_cpu/decode.hh:
cpu/beta_cpu/decode_impl.hh:
Stats.
cpu/beta_cpu/fetch.hh:
Stats, change squash so it can handle squashes from decode differently
than squashes from commit.
cpu/beta_cpu/fetch_impl.hh:
Add in stats. Change how a cache line is fetched. Update to work with
caches. Also have separate functions for different behavior if squash
is coming from decode vs commit.
cpu/beta_cpu/free_list.hh:
Remove some old comments.
cpu/beta_cpu/full_cpu.cc:
cpu/beta_cpu/full_cpu.hh:
Added function to remove instructions from back of instruction list
until a certain sequence number.
cpu/beta_cpu/iew.hh:
Stats, separate squashing behavior due to branches vs memory.
cpu/beta_cpu/iew_impl.hh:
Stats, separate squashing behavior for branches vs memory.
cpu/beta_cpu/inst_queue.cc:
Debug stuff
cpu/beta_cpu/inst_queue.hh:
Stats, change how mem dep unit works, debug stuff
cpu/beta_cpu/inst_queue_impl.hh:
Stats, change how mem dep unit works, debug stuff. Also add in
parameters that used to be hardcoded.
cpu/beta_cpu/mem_dep_unit.hh:
cpu/beta_cpu/mem_dep_unit_impl.hh:
Add in stats, change how memory dependence unit works. It now holds
the memory instructions that are waiting for their memory dependences
to resolve. It provides which instructions are ready directly to the
IQ.
cpu/beta_cpu/regfile.hh:
Fix up sanity checks.
cpu/beta_cpu/rename_map.cc:
Fix loop variable type.
cpu/beta_cpu/rob_impl.hh:
Remove intermediate DynInstPtr
cpu/beta_cpu/store_set.cc:
Add in debugging statements.
cpu/beta_cpu/store_set.hh:
Reorder function arguments to match the rest of the calls.
--HG--
extra : convert_revision : aabf9b1fecd1d743265dfc3b174d6159937c6f44
2004-10-22 00:02:36 +02:00
|
|
|
}
|
2006-05-19 21:37:52 +02:00
|
|
|
/*
|
2004-08-20 20:54:07 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::removeAllInsts()
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
|
|
|
instList.clear();
|
|
|
|
}
|
2006-05-19 21:37:52 +02:00
|
|
|
*/
|
2004-08-20 20:54:07 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::dumpInsts()
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
|
|
|
int num = 0;
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
ListIt inst_list_it = instList.begin();
|
|
|
|
|
|
|
|
cprintf("Dumping Instruction List\n");
|
|
|
|
|
|
|
|
while (inst_list_it != instList.end()) {
|
|
|
|
cprintf("Instruction:%i\nPC:%#x\n[tid:%i]\n[sn:%lli]\nIssued:%i\n"
|
|
|
|
"Squashed:%i\n\n",
|
|
|
|
num, (*inst_list_it)->readPC(), (*inst_list_it)->threadNumber,
|
|
|
|
(*inst_list_it)->seqNum, (*inst_list_it)->isIssued(),
|
|
|
|
(*inst_list_it)->isSquashed());
|
2004-08-20 20:54:07 +02:00
|
|
|
inst_list_it++;
|
|
|
|
++num;
|
|
|
|
}
|
|
|
|
}
|
2006-05-19 21:37:52 +02:00
|
|
|
/*
|
2004-08-20 20:54:07 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
2005-06-05 09:25:26 +02:00
|
|
|
FullO3CPU<Impl>::wakeDependents(DynInstPtr &inst)
|
2004-08-20 20:54:07 +02:00
|
|
|
{
|
|
|
|
iew.wakeDependents(inst);
|
|
|
|
}
|
2006-05-19 21:37:52 +02:00
|
|
|
*/
|
2006-04-23 00:26:48 +02:00
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::wakeCPU()
|
|
|
|
{
|
2006-05-19 21:37:52 +02:00
|
|
|
if (activityRec.active() || tickEvent.scheduled()) {
|
|
|
|
DPRINTF(Activity, "CPU already running.\n");
|
2006-04-23 00:26:48 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-05-19 21:37:52 +02:00
|
|
|
DPRINTF(Activity, "Waking up CPU\n");
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2007-09-28 19:21:30 +02:00
|
|
|
idleCycles += tickToCycles((curTick - 1) - lastRunningCycle);
|
|
|
|
numCycles += tickToCycles((curTick - 1) - lastRunningCycle);
|
2006-04-23 00:26:48 +02:00
|
|
|
|
2008-10-09 13:58:24 +02:00
|
|
|
schedule(tickEvent, nextCycle());
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
|
|
|
|
2009-01-24 16:27:21 +01:00
|
|
|
#if FULL_SYSTEM
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::wakeup()
|
|
|
|
{
|
|
|
|
if (this->thread[0]->status() != ThreadContext::Suspended)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this->wakeCPU();
|
|
|
|
|
|
|
|
DPRINTF(Quiesce, "Suspended Processor woken\n");
|
|
|
|
this->threadContexts[0]->activate();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-04-23 00:26:48 +02:00
|
|
|
template <class Impl>
|
2009-05-26 18:23:13 +02:00
|
|
|
ThreadID
|
2006-04-23 00:26:48 +02:00
|
|
|
FullO3CPU<Impl>::getFreeTid()
|
|
|
|
{
|
2009-05-26 18:23:13 +02:00
|
|
|
for (ThreadID tid = 0; tid < numThreads; tid++) {
|
|
|
|
if (!tids[tid]) {
|
|
|
|
tids[tid] = true;
|
|
|
|
return tid;
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
return InvalidThreadID;
|
2006-04-23 00:26:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::doContextSwitch()
|
|
|
|
{
|
|
|
|
if (contextSwitch) {
|
|
|
|
|
|
|
|
//ADD CODE TO DEACTIVE THREAD HERE (???)
|
|
|
|
|
2009-05-26 18:23:13 +02:00
|
|
|
ThreadID size = cpuWaitList.size();
|
|
|
|
for (ThreadID tid = 0; tid < size; tid++) {
|
2006-04-23 00:26:48 +02:00
|
|
|
activateWhenReady(tid);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cpuWaitList.size() == 0)
|
|
|
|
contextSwitch = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void
|
|
|
|
FullO3CPU<Impl>::updateThreadPriority()
|
|
|
|
{
|
2009-05-26 18:23:13 +02:00
|
|
|
if (activeThreads.size() > 1) {
|
2006-04-23 00:26:48 +02:00
|
|
|
//DEFAULT TO ROUND ROBIN SCHEME
|
|
|
|
//e.g. Move highest priority to end of thread list
|
2009-05-26 18:23:13 +02:00
|
|
|
list<ThreadID>::iterator list_begin = activeThreads.begin();
|
|
|
|
list<ThreadID>::iterator list_end = activeThreads.end();
|
2006-04-23 00:26:48 +02:00
|
|
|
|
|
|
|
unsigned high_thread = *list_begin;
|
|
|
|
|
|
|
|
activeThreads.erase(list_begin);
|
|
|
|
|
|
|
|
activeThreads.push_back(high_thread);
|
|
|
|
}
|
|
|
|
}
|
2004-08-20 20:54:07 +02:00
|
|
|
|
2005-06-05 09:25:26 +02:00
|
|
|
// Forward declaration of FullO3CPU.
|
2006-07-01 02:49:31 +02:00
|
|
|
template class FullO3CPU<O3CPUImpl>;
|