1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 169 unchanged lines hidden (view full) ---

178 UNSERIALIZE_ENUM(_status);
179 BaseSimpleCPU::unserialize(cp, section);
180 tickEvent.unserialize(cp, csprintf("%s.tickEvent", section));
181}
182
183void
184AtomicSimpleCPU::resume()
185{
186 DPRINTF(SimpleCPU, "Resume\n");
187 if (_status != SwitchedOut && _status != Idle) {
188 assert(system->getMemoryMode() == Enums::atomic);
189
190 changeState(SimObject::Running);
191 if (thread->status() == ThreadContext::Active) {
192 if (!tickEvent.scheduled()) {
193 tickEvent.schedule(nextCycle());
194 }

--- 32 unchanged lines hidden (view full) ---

227 _status = Idle;
228 }
229}
230
231
232void
233AtomicSimpleCPU::activateContext(int thread_num, int delay)
234{
235 DPRINTF(SimpleCPU, "ActivateContext %d (%d cycles)\n", thread_num, delay);
236
237 assert(thread_num == 0);
238 assert(thread);
239
240 assert(_status == Idle);
241 assert(!tickEvent.scheduled());
242
243 notIdleFraction++;
244
245 //Make sure ticks are still on multiples of cycles
246 tickEvent.schedule(nextCycle(curTick + cycles(delay)));
247 _status = Running;
248}
249
250
251void
252AtomicSimpleCPU::suspendContext(int thread_num)
253{
254 DPRINTF(SimpleCPU, "SuspendContext %d\n", thread_num);
255
256 assert(thread_num == 0);
257 assert(thread);
258
259 assert(_status == Running);
260
261 // tick event may not be scheduled if this gets called from inside
262 // an instruction's execution, e.g. "quiesce"
263 if (tickEvent.scheduled())

--- 219 unchanged lines hidden (view full) ---

483{
484 return write((uint32_t)data, addr, flags, res);
485}
486
487
488void
489AtomicSimpleCPU::tick()
490{
491 DPRINTF(SimpleCPU, "Tick\n");
492
493 Tick latency = cycles(1); // instruction takes one cycle by default
494
495 for (int i = 0; i < width; ++i) {
496 numCycles++;
497
498 if (!curStaticInst || !curStaticInst->isDelayedCommit())
499 checkForInterrupts();
500

--- 97 unchanged lines hidden ---