// Alpha IPR register accessors
inline bool PcPAL(Addr addr) { return addr & 0x3; }
inline void startupCPU(ThreadContext *tc, int cpuId)
-{ tc->activate(Cycles(0)); }
+{ tc->activate(); }
////////////////////////////////////////////////////////////////////////
//
inline void startupCPU(ThreadContext *tc, int cpuId)
{
- tc->activate(Cycles(0));
+ tc->activate();
}
void copyRegs(ThreadContext *src, ThreadContext *dest);
// TODO: SET PC WITH AN EVENT INSTEAD OF INSTANTANEOUSLY
tc->pcState(restartPC);
- tc->activate(Cycles(0));
+ tc->activate();
warn("%i: Restoring thread %i in %s @ PC %x",
curTick(), tc->threadId(), tc->getCpuPtr()->name(), restartPC);
void
startupCPU(ThreadContext *tc, int cpuId)
{
- tc->activate(Cycles(0));
+ tc->activate();
}
void
inline void
startupCPU(ThreadContext *tc, int cpuId)
{
- tc->activate(Cycles(0));
+ tc->activate();
}
void
{
// Other CPUs will get activated by IPIs
if (cpuId == 0 || !FullSystem)
- tc->activate(Cycles(0));
+ tc->activate();
}
void copyRegs(ThreadContext *src, ThreadContext *dest);
void startupCPU(ThreadContext *tc, int cpuId)
{
if (cpuId == 0 || !FullSystem) {
- tc->activate(Cycles(0));
+ tc->activate();
} else {
// This is an application processor (AP). It should be initialized to
// look like only the BIOS POST has run on it and put then put it into
// a halted state.
- tc->suspend(Cycles(0));
+ tc->suspend();
}
}
/// Provide access to the tracer pointer
Trace::InstTracer * getTracer() { return tracer; }
- /// Notify the CPU that the indicated context is now active. The
- /// delay parameter indicates the number of ticks to wait before
- /// executing (typically 0 or 1).
- virtual void activateContext(ThreadID thread_num, Cycles delay) {}
+ /// Notify the CPU that the indicated context is now active.
+ virtual void activateContext(ThreadID thread_num) {}
/// Notify the CPU that the indicated context is now suspended.
virtual void suspendContext(ThreadID thread_num) {}
virtual void startup();
virtual void regStats();
- virtual void activateWhenReady(ThreadID tid) {};
-
void registerThreadContexts();
/**
checkerTC->setStatus(new_status);
}
- /// Set the status to Active. Optional delay indicates number of
- /// cycles to wait before beginning execution.
- void activate(Cycles delay = Cycles(1))
- { actualTC->activate(delay); }
+ /// Set the status to Active.
+ void activate() { actualTC->activate(); }
/// Set the status to Suspended.
- void suspend(Cycles delay) { actualTC->suspend(delay); }
+ void suspend() { actualTC->suspend(); }
/// Set the status to Halted.
- void halt(Cycles delay) { actualTC->halt(delay); }
+ void halt() { actualTC->halt(); }
void dumpFuncProfile() { actualTC->dumpFuncProfile(); }
}
void
-InOrderCPU::deactivateContext(ThreadID tid, Cycles delay)
+InOrderCPU::deactivateContext(ThreadID tid)
{
DPRINTF(InOrderCPU,"[tid:%i]: Deactivating ...\n", tid);
- scheduleCpuEvent(DeactivateThread, NoFault, tid, dummyInst[tid], delay);
+ scheduleCpuEvent(DeactivateThread, NoFault, tid, dummyInst[tid]);
// Be sure to signal that there's some activity so the CPU doesn't
// deschedule itself.
}
void
-InOrderCPU::activateContext(ThreadID tid, Cycles delay)
+InOrderCPU::activateContext(ThreadID tid)
{
DPRINTF(InOrderCPU,"[tid:%i]: Activating ...\n", tid);
- scheduleCpuEvent(ActivateThread, NoFault, tid, dummyInst[tid], delay);
+ scheduleCpuEvent(ActivateThread, NoFault, tid, dummyInst[tid]);
// Be sure to signal that there's some activity so the CPU doesn't
// deschedule itself.
}
void
-InOrderCPU::activateNextReadyContext(Cycles delay)
+InOrderCPU::activateNextReadyContext()
{
DPRINTF(InOrderCPU,"Activating next ready thread\n");
scheduleCpuEvent(ActivateNextReadyThread, NoFault, 0/*tid*/, dummyInst[0],
- delay, ActivateNextReadyThread_Pri);
+ Cycles(0), ActivateNextReadyThread_Pri);
// Be sure to signal that there's some activity so the CPU doesn't
// deschedule itself.
void trap(const Fault &fault, ThreadID tid, DynInstPtr inst);
/** Schedule thread activation on the CPU */
- void activateContext(ThreadID tid, Cycles delay = Cycles(0));
+ void activateContext(ThreadID tid);
/** Add Thread to Active Threads List. */
void activateThread(ThreadID tid);
void activateThreadInPipeline(ThreadID tid);
/** Schedule Thread Activation from Ready List */
- void activateNextReadyContext(Cycles delay = Cycles(0));
+ void activateNextReadyContext();
/** Add Thread From Ready List to Active Threads List. */
void activateNextReadyThread();
/** Schedule a thread deactivation on the CPU */
- void deactivateContext(ThreadID tid, Cycles delay = Cycles(0));
+ void deactivateContext(ThreadID tid);
/** Remove from Active Thread List */
void deactivateThread(ThreadID tid);
}
void
-InOrderThreadContext::activate(Cycles delay)
+InOrderThreadContext::activate()
{
DPRINTF(InOrderCPU, "Calling activate on Thread Context %d\n",
getThreadNum());
thread->setStatus(ThreadContext::Active);
- cpu->activateContext(thread->threadId(), delay);
+ cpu->activateContext(thread->threadId());
}
void
-InOrderThreadContext::suspend(Cycles delay)
+InOrderThreadContext::suspend()
{
DPRINTF(InOrderCPU, "Calling suspend on Thread Context %d\n",
getThreadNum());
}
void
-InOrderThreadContext::halt(Cycles delay)
+InOrderThreadContext::halt()
{
DPRINTF(InOrderCPU, "Calling halt on Thread Context %d\n",
getThreadNum());
void setStatus(Status new_status)
{ thread->setStatus(new_status); }
- /** Set the status to Active. Optional delay indicates number of
- * cycles to wait before beginning execution. */
- void activate(Cycles delay = Cycles(1));
+ /** Set the status to Active. */
+ void activate();
/** Set the status to Suspended. */
- void suspend(Cycles delay = Cycles(0));
+ void suspend();
/** Set the status to Halted. */
- void halt(Cycles delay = Cycles(0));
+ void halt();
/** Takes over execution of a thread from another CPU. */
void takeOverFrom(ThreadContext *old_context);
int flattenMiscIndex(int reg)
{ return cpu->isa[thread->threadId()]->flattenMiscIndex(reg); }
- void activateContext(Cycles delay)
- { cpu->activateContext(thread->threadId(), delay); }
+ void activateContext()
+ { cpu->activateContext(thread->threadId()); }
void deallocateContext()
{ cpu->deallocateContext(thread->threadId()); }
}
void
-BaseKvmCPU::activateContext(ThreadID thread_num, Cycles delay)
+BaseKvmCPU::activateContext(ThreadID thread_num)
{
- DPRINTF(Kvm, "ActivateContext %d (%d cycles)\n", thread_num, delay);
+ DPRINTF(Kvm, "ActivateContext %d\n", thread_num);
assert(thread_num == 0);
assert(thread);
numCycles += ticksToCycles(thread->lastActivate - thread->lastSuspend);
- schedule(tickEvent, clockEdge(delay));
+ schedule(tickEvent, clockEdge(Cycles(0)));
_status = Running;
}
MasterPort &getInstPort() { return instPort; }
void wakeup();
- void activateContext(ThreadID thread_num, Cycles delay);
+ void activateContext(ThreadID thread_num);
void suspendContext(ThreadID thread_num);
void deallocateContext(ThreadID thread_num);
void haltContext(ThreadID thread_num);
}
threads.push_back(thread);
- threadActivateEvents.push_back(new ThreadActivateEvent(*this, 0));
thread->setStatus(ThreadContext::Halted);
for (ThreadID thread_id = 0; thread_id < threads.size(); thread_id++) {
delete threads[thread_id];
- delete threadActivateEvents[thread_id];
}
}
for (auto i = threads.begin(); i != threads.end(); i ++)
(*i)->startup();
+
+ /* CPU state setup, activate initial context */
+ activateContext(0);
}
unsigned int
}
void
-MinorCPU::activateContext(ThreadID thread_id, Cycles delay)
-{
- DPRINTF(MinorCPU, "ActivateContext thread: %d delay: %d\n",
- thread_id, delay);
-
- if (!threadActivateEvents[thread_id]->scheduled()) {
- schedule(threadActivateEvents[thread_id], clockEdge(delay));
- }
-}
-
-void
-MinorCPU::ThreadActivateEvent::process()
+MinorCPU::activateContext(ThreadID thread_id)
{
- DPRINTFS(MinorCPU, (&cpu), "Activating thread: %d\n", thread_id);
+ DPRINTF(MinorCPU, "ActivateContext thread: %d", thread_id);
/* Do some cycle accounting. lastStopped is reset to stop the
* wakeup call on the pipeline from adding the quiesce period
* to BaseCPU::numCycles */
- cpu.stats.quiesceCycles += cpu.pipeline->cyclesSinceLastStopped();
- cpu.pipeline->resetLastStopped();
+ stats.quiesceCycles += pipeline->cyclesSinceLastStopped();
+ pipeline->resetLastStopped();
/* Wake up the thread, wakeup the pipeline tick */
- cpu.threads[thread_id]->activate();
- cpu.wakeupOnEvent(Minor::Pipeline::CPUStageId);
- cpu.pipeline->wakeupFetch();
+ threads[thread_id]->activate();
+ wakeupOnEvent(Minor::Pipeline::CPUStageId);
+ pipeline->wakeupFetch();
}
void
class MinorCPU : public BaseCPU
{
protected:
- /** Event for delayed wakeup of a thread */
- class ThreadActivateEvent : public Event
- {
- public:
- MinorCPU &cpu;
- ThreadID thread_id;
-
- ThreadActivateEvent(MinorCPU &cpu_, ThreadID thread_id_) :
- cpu(cpu_), thread_id(thread_id_)
- { }
-
- void process();
- };
-
- /** Events to wakeup each thread */
- std::vector<ThreadActivateEvent *> threadActivateEvents;
-
/** pipeline is a container for the clockable pipeline stage objects.
* Elements of pipeline call TheISA to implement the model. */
Minor::Pipeline *pipeline;
void takeOverFrom(BaseCPU *old_cpu);
/** Thread activation interface from BaseCPU. */
- void activateContext(ThreadID thread_id, Cycles delay);
+ void activateContext(ThreadID thread_id);
void suspendContext(ThreadID thread_id);
/** Interface for stages to signal that they have become active after
return "FullO3CPU tick";
}
-template <class Impl>
-FullO3CPU<Impl>::ActivateThreadEvent::ActivateThreadEvent()
- : Event(CPU_Switch_Pri)
-{
-}
-
-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 *
-FullO3CPU<Impl>::ActivateThreadEvent::description() const
-{
- return "FullO3CPU \"Activate Thread\"";
-}
-
-template <class Impl>
-FullO3CPU<Impl>::DeallocateContextEvent::DeallocateContextEvent()
- : Event(CPU_Tick_Pri), tid(0), remove(false), cpu(NULL)
-{
-}
-
-template <class Impl>
-void
-FullO3CPU<Impl>::DeallocateContextEvent::init(int thread_num,
- FullO3CPU<Impl> *thread_cpu)
-{
- tid = thread_num;
- cpu = thread_cpu;
- remove = false;
-}
-
-template <class Impl>
-void
-FullO3CPU<Impl>::DeallocateContextEvent::process()
-{
- cpu->deactivateThread(tid);
- if (remove)
- cpu->removeThread(tid);
-}
-
-template <class Impl>
-const char *
-FullO3CPU<Impl>::DeallocateContextEvent::description() const
-{
- return "FullO3CPU \"Deallocate Context\"";
-}
-
template <class Impl>
FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
: BaseO3CPU(params),
renameMap[tid].init(®File, TheISA::ZeroReg, fpZeroReg,
&freeList);
-
- activateThreadEvent[tid].init(tid, this);
- deallocateContextEvent[tid].init(tid, this);
}
// Initialize rename map to assign physical registers to the
globalSeqNum[tid] = 1;
#endif
- contextSwitch = false;
DPRINTF(O3CPU, "Creating O3CPU object.\n");
// Setup any thread state.
commit.tick();
- if (!FullSystem)
- doContextSwitch();
-
// Now advance the time buffers
timeBuffer.advance();
template <class Impl>
void
-FullO3CPU<Impl>::activateContext(ThreadID tid, Cycles delay)
+FullO3CPU<Impl>::activateContext(ThreadID tid)
{
assert(!switchedOut());
// Needs to set each stage to running as well.
- if (delay){
- DPRINTF(O3CPU, "[tid:%i]: Scheduling thread context to activate "
- "on cycle %d\n", tid, clockEdge(delay));
- scheduleActivateThreadEvent(tid, delay);
- } else {
- activateThread(tid);
- }
+ activateThread(tid);
// We don't want to wake the CPU if it is drained. In that case,
// we just want to flag the thread as active and schedule the tick
// If we are time 0 or if the last activation time is in the past,
// schedule the next tick and wake up the fetch unit
if (lastActivatedCycle == 0 || lastActivatedCycle < curTick()) {
- scheduleTickEvent(delay);
+ scheduleTickEvent(Cycles(0));
// Be sure to signal that there's some activity so the CPU doesn't
// deschedule itself.
}
template <class Impl>
-bool
-FullO3CPU<Impl>::scheduleDeallocateContext(ThreadID tid, bool remove,
- Cycles delay)
-{
- // Schedule removal of thread data from CPU
- if (delay){
- DPRINTF(O3CPU, "[tid:%i]: Scheduling thread context to deallocate "
- "on tick %d\n", tid, clockEdge(delay));
- scheduleDeallocateContextEvent(tid, remove, delay);
- return false;
- } else {
- deactivateThread(tid);
- if (remove)
- removeThread(tid);
- return true;
- }
+void
+FullO3CPU<Impl>::deallocateContext(ThreadID tid, bool remove)
+{
+ deactivateThread(tid);
+ if (remove)
+ removeThread(tid);
}
template <class Impl>
{
DPRINTF(O3CPU,"[tid: %i]: Suspending Thread Context.\n", tid);
assert(!switchedOut());
- bool deallocated = scheduleDeallocateContext(tid, false, Cycles(1));
+ deallocateContext(tid, false);
+
// If this was the last thread then unschedule the tick event.
- if ((activeThreads.size() == 1 && !deallocated) ||
- activeThreads.size() == 0)
+ if (activeThreads.size() == 0)
unscheduleTickEvent();
DPRINTF(Quiesce, "Suspending Context\n");
//For now, this is the same as deallocate
DPRINTF(O3CPU,"[tid:%i]: Halt Context called. Deallocating", tid);
assert(!switchedOut());
- scheduleDeallocateContext(tid, true, Cycles(1));
+ deallocateContext(tid, true);
}
template <class Impl>
src_tc->setStatus(ThreadContext::Active);
- activateContext(tid, Cycles(1));
+ activateContext(tid);
//Reset ROB/IQ/LSQ Entries
commit.rob->resetEntries();
*/
}
-
-template <class Impl>
-void
-FullO3CPU<Impl>::activateWhenReady(ThreadID tid)
-{
- DPRINTF(O3CPU,"[tid:%i]: Checking if resources are available for incoming"
- "(e.g. PhysRegs/ROB/IQ/LSQ) \n",
- tid);
-
- bool ready = true;
-
- // Should these all be '<' not '>='? This seems backwards...
- if (freeList.numFreeIntRegs() >= TheISA::NumIntRegs) {
- DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
- "Phys. Int. Regs.\n",
- tid);
- ready = false;
- } else if (freeList.numFreeFloatRegs() >= TheISA::NumFloatRegs) {
- DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
- "Phys. Float. Regs.\n",
- tid);
- ready = false;
- } else if (freeList.numFreeCCRegs() >= TheISA::NumCCRegs) {
- DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
- "Phys. CC. Regs.\n",
- tid);
- ready = false;
- } else if (commit.rob->numFreeEntries() >=
- commit.rob->entryAmount(activeThreads.size() + 1)) {
- DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
- "ROB entries.\n",
- tid);
- ready = false;
- } else if (iew.instQueue.numFreeEntries() >=
- iew.instQueue.entryAmount(activeThreads.size() + 1)) {
- DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
- "IQ entries.\n",
- tid);
- ready = false;
- } else if (iew.ldstQueue.numFreeLoadEntries() >=
- iew.ldstQueue.entryAmount(activeThreads.size() + 1)) {
- DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
- "LQ entries.\n",
- tid);
- ready = false;
- } else if (iew.ldstQueue.numFreeStoreEntries() >=
- iew.ldstQueue.entryAmount(activeThreads.size() + 1)) {
- DPRINTF(O3CPU,"[tid:%i] Suspending thread due to not enough "
- "SQ entries.\n",
- tid);
- ready = false;
- }
-
- if (ready) {
- insertThread(tid);
-
- contextSwitch = false;
-
- cpuWaitList.remove(tid);
- } else {
- suspendContext(tid);
-
- //blocks fetch
- contextSwitch = true;
-
- //@todo: dont always add to waitlist
- //do waitlist
- cpuWaitList.push_back(tid);
- }
-}
-
template <class Impl>
Fault
FullO3CPU<Impl>::hwrei(ThreadID tid)
{
bool drained(true);
- for (ThreadID i = 0; i < thread.size(); ++i) {
- if (activateThreadEvent[i].scheduled()) {
- DPRINTF(Drain, "CPU not drained, tread %i has a "
- "pending activate event\n", i);
- drained = false;
- }
- if (deallocateContextEvent[i].scheduled()) {
- DPRINTF(Drain, "CPU not drained, tread %i has a "
- "pending deallocate context event\n", i);
- drained = false;
- }
- }
-
if (!instList.empty() || !removeList.empty()) {
DPRINTF(Drain, "Main CPU structures not drained.\n");
drained = false;
return InvalidThreadID;
}
-template <class Impl>
-void
-FullO3CPU<Impl>::doContextSwitch()
-{
- if (contextSwitch) {
-
- //ADD CODE TO DEACTIVE THREAD HERE (???)
-
- ThreadID size = cpuWaitList.size();
- for (ThreadID tid = 0; tid < size; tid++) {
- activateWhenReady(tid);
- }
-
- if (cpuWaitList.size() == 0)
- contextSwitch = true;
- }
-}
-
template <class Impl>
void
FullO3CPU<Impl>::updateThreadPriority()
tickEvent.squash();
}
- class ActivateThreadEvent : public Event
- {
- private:
- /** Number of Thread to Activate */
- ThreadID tid;
-
- /** Pointer to the CPU. */
- FullO3CPU<Impl> *cpu;
-
- public:
- /** Constructs the event. */
- ActivateThreadEvent();
-
- /** Initialize Event */
- void init(int thread_num, FullO3CPU<Impl> *thread_cpu);
-
- /** Processes the event, calling activateThread() on the CPU. */
- void process();
-
- /** Returns the description of the event. */
- const char *description() const;
- };
-
- /** Schedule thread to activate , regardless of its current state. */
- void
- scheduleActivateThreadEvent(ThreadID tid, Cycles delay)
- {
- // Schedule thread to activate, regardless of its current state.
- if (activateThreadEvent[tid].squashed())
- reschedule(activateThreadEvent[tid],
- clockEdge(delay));
- else if (!activateThreadEvent[tid].scheduled()) {
- Tick when = clockEdge(delay);
-
- // Check if the deallocateEvent is also scheduled, and make
- // sure they do not happen at same time causing a sleep that
- // is never woken from.
- if (deallocateContextEvent[tid].scheduled() &&
- deallocateContextEvent[tid].when() == when) {
- when++;
- }
-
- schedule(activateThreadEvent[tid], when);
- }
- }
-
- /** Unschedule actiavte thread event, regardless of its current state. */
- void
- unscheduleActivateThreadEvent(ThreadID tid)
- {
- if (activateThreadEvent[tid].scheduled())
- activateThreadEvent[tid].squash();
- }
-
- /** The tick event used for scheduling CPU ticks. */
- ActivateThreadEvent activateThreadEvent[Impl::MaxThreads];
-
- class DeallocateContextEvent : public Event
- {
- private:
- /** Number of Thread to deactivate */
- ThreadID tid;
-
- /** Should the thread be removed from the CPU? */
- bool remove;
-
- /** Pointer to the CPU. */
- FullO3CPU<Impl> *cpu;
-
- public:
- /** Constructs the event. */
- DeallocateContextEvent();
-
- /** Initialize Event */
- void init(int thread_num, FullO3CPU<Impl> *thread_cpu);
-
- /** Processes the event, calling activateThread() on the CPU. */
- void process();
-
- /** Sets whether the thread should also be removed from the CPU. */
- void setRemove(bool _remove) { remove = _remove; }
-
- /** Returns the description of the event. */
- const char *description() const;
- };
-
- /** Schedule cpu to deallocate thread context.*/
- void
- scheduleDeallocateContextEvent(ThreadID tid, bool remove, Cycles delay)
- {
- // Schedule thread to activate, regardless of its current state.
- if (deallocateContextEvent[tid].squashed())
- reschedule(deallocateContextEvent[tid],
- clockEdge(delay));
- else if (!deallocateContextEvent[tid].scheduled())
- schedule(deallocateContextEvent[tid],
- clockEdge(delay));
- }
-
- /** Unschedule thread deallocation in CPU */
- void
- unscheduleDeallocateContextEvent(ThreadID tid)
- {
- if (deallocateContextEvent[tid].scheduled())
- deallocateContextEvent[tid].squash();
- }
-
- /** The tick event used for scheduling CPU ticks. */
- DeallocateContextEvent deallocateContextEvent[Impl::MaxThreads];
-
/**
* Check if the pipeline has drained and signal the DrainManager.
*
virtual Counter totalOps() const;
/** Add Thread to Active Threads List. */
- void activateContext(ThreadID tid, Cycles delay);
+ void activateContext(ThreadID tid);
/** Remove Thread from Active Threads List */
void suspendContext(ThreadID tid);
/** Remove Thread from Active Threads List &&
* Possibly Remove Thread Context from CPU.
*/
- bool scheduleDeallocateContext(ThreadID tid, bool remove,
- Cycles delay = Cycles(1));
+ void deallocateContext(ThreadID tid, bool remove);
/** Remove Thread from Active Threads List &&
* Remove Thread Context from CPU.
*/
void haltContext(ThreadID tid);
- /** Activate a Thread When CPU Resources are Available. */
- void activateWhenReady(ThreadID tid);
-
- /** Add or Remove a Thread Context in the CPU. */
- void doContextSwitch();
-
/** Update The Order In Which We Process Threads. */
void updateThreadPriority();
/** Pointers to all of the threads in the CPU. */
std::vector<Thread *> thread;
- /** Is there a context switch pending? */
- bool contextSwitch;
-
/** Threads Scheduled to Enter CPU */
std::list<int> cpuWaitList;
{
bool ret_val = false;
- if (cpu->contextSwitch) {
- DPRINTF(Fetch,"[tid:%i]: Stalling for a context switch.\n",tid);
- ret_val = true;
- } else if (stalls[tid].drain) {
+ if (stalls[tid].drain) {
assert(cpu->isDraining());
DPRINTF(Fetch,"[tid:%i]: Drain stall detected.\n",tid);
ret_val = true;
}
// If there was activity this cycle, inform the CPU of it.
- if (wroteToTimeBuffer || cpu->contextSwitch) {
+ if (wroteToTimeBuffer) {
DPRINTF(Activity, "Activity this cycle.\n");
-
cpu->activityThisCycle();
}
virtual void setStatus(Status new_status)
{ thread->setStatus(new_status); }
- /** Set the status to Active. Optional delay indicates number of
- * cycles to wait before beginning execution. */
- virtual void activate(Cycles delay = Cycles(1));
+ /** Set the status to Active. */
+ virtual void activate();
/** Set the status to Suspended. */
- virtual void suspend(Cycles delay = Cycles(0));
+ virtual void suspend();
/** Set the status to Halted. */
- virtual void halt(Cycles delay = Cycles(0));
+ virtual void halt();
/** Dumps the function profiling information.
* @todo: Implement.
template <class Impl>
void
-O3ThreadContext<Impl>::activate(Cycles delay)
+O3ThreadContext<Impl>::activate()
{
DPRINTF(O3CPU, "Calling activate on Thread Context %d\n",
threadId());
thread->setStatus(ThreadContext::Active);
// status() == Suspended
- cpu->activateContext(thread->threadId(), delay);
+ cpu->activateContext(thread->threadId());
}
template <class Impl>
void
-O3ThreadContext<Impl>::suspend(Cycles delay)
+O3ThreadContext<Impl>::suspend()
{
DPRINTF(O3CPU, "Calling suspend on Thread Context %d\n",
threadId());
template <class Impl>
void
-O3ThreadContext<Impl>::halt(Cycles delay)
+O3ThreadContext<Impl>::halt()
{
- DPRINTF(O3CPU, "Calling halt on Thread Context %d\n",
- threadId());
+ DPRINTF(O3CPU, "Calling halt on Thread Context %d\n", threadId());
if (thread->status() == ThreadContext::Halted)
return;
}
void
-AtomicSimpleCPU::activateContext(ThreadID thread_num, Cycles delay)
+AtomicSimpleCPU::activateContext(ThreadID thread_num)
{
- DPRINTF(SimpleCPU, "ActivateContext %d (%d cycles)\n", thread_num, delay);
+ DPRINTF(SimpleCPU, "ActivateContext %d\n", thread_num);
assert(thread_num == 0);
assert(thread);
numCycles += ticksToCycles(thread->lastActivate - thread->lastSuspend);
//Make sure ticks are still on multiples of cycles
- schedule(tickEvent, clockEdge(delay));
+ schedule(tickEvent, clockEdge(Cycles(0)));
_status = BaseSimpleCPU::Running;
}
void verifyMemoryMode() const;
- virtual void activateContext(ThreadID thread_num, Cycles delay);
+ virtual void activateContext(ThreadID thread_num);
virtual void suspendContext(ThreadID thread_num);
Fault readMem(Addr addr, uint8_t *data, unsigned size, unsigned flags);
}
void
-TimingSimpleCPU::activateContext(ThreadID thread_num, Cycles delay)
+TimingSimpleCPU::activateContext(ThreadID thread_num)
{
- DPRINTF(SimpleCPU, "ActivateContext %d (%d cycles)\n", thread_num, delay);
+ DPRINTF(SimpleCPU, "ActivateContext %d\n", thread_num);
assert(thread_num == 0);
assert(thread);
_status = BaseSimpleCPU::Running;
// kick things off by initiating the fetch of the next instruction
- schedule(fetchEvent, clockEdge(delay));
+ schedule(fetchEvent, clockEdge(Cycles(0)));
}
void verifyMemoryMode() const;
- virtual void activateContext(ThreadID thread_num, Cycles delay);
+ virtual void activateContext(ThreadID thread_num);
virtual void suspendContext(ThreadID thread_num);
Fault readMem(Addr addr, uint8_t *data, unsigned size, unsigned flags);
}
void
-SimpleThread::activate(Cycles delay)
+SimpleThread::activate()
{
if (status() == ThreadContext::Active)
return;
lastActivate = curTick();
-
-// if (status() == ThreadContext::Unallocated) {
-// cpu->activateWhenReady(_threadId);
-// return;
-// }
-
_status = ThreadContext::Active;
-
- // status() == Suspended
- baseCpu->activateContext(_threadId, delay);
+ baseCpu->activateContext(_threadId);
}
void
void setStatus(Status newStatus) { _status = newStatus; }
- /// Set the status to Active. Optional delay indicates number of
- /// cycles to wait before beginning execution.
- void activate(Cycles delay = Cycles(1));
+ /// Set the status to Active.
+ void activate();
/// Set the status to Suspended.
void suspend();
virtual void setStatus(Status new_status) = 0;
- /// Set the status to Active. Optional delay indicates number of
- /// cycles to wait before beginning execution.
- virtual void activate(Cycles delay = Cycles(1)) = 0;
+ /// Set the status to Active.
+ virtual void activate() = 0;
/// Set the status to Suspended.
- virtual void suspend(Cycles delay = Cycles(0)) = 0;
+ virtual void suspend() = 0;
/// Set the status to Halted.
- virtual void halt(Cycles delay = Cycles(0)) = 0;
+ virtual void halt() = 0;
virtual void dumpFuncProfile() = 0;
void setStatus(Status new_status) { actualTC->setStatus(new_status); }
- /// Set the status to Active. Optional delay indicates number of
- /// cycles to wait before beginning execution.
- void activate(Cycles delay = Cycles(1))
- { actualTC->activate(delay); }
+ /// Set the status to Active.
+ void activate() { actualTC->activate(); }
/// Set the status to Suspended.
- void suspend(Cycles delay = Cycles(0)) { actualTC->suspend(); }
+ void suspend() { actualTC->suspend(); }
/// Set the status to Halted.
- void halt(Cycles delay = Cycles(0)) { actualTC->halt(); }
+ void halt() { actualTC->halt(); }
void dumpFuncProfile() { actualTC->dumpFuncProfile(); }
ThreadContext *tc = system->getThreadContext(contextIds[0]);
// mark this context as active so it will start ticking.
- tc->activate(Cycles(0));
+ tc->activate();
pTable->initState(tc);
}