Deleted Added
sdiff udiff text old ( 4181:6edaeff44647 ) new ( 4182:5b2c0d266107 )
full compact
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;

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

65#else // !FULL_SYSTEM
66#include "mem/mem_object.hh"
67#endif // FULL_SYSTEM
68
69using namespace std;
70using namespace TheISA;
71
72BaseSimpleCPU::BaseSimpleCPU(Params *p)
73 : BaseCPU(p), thread(NULL)
74{
75#if FULL_SYSTEM
76 thread = new SimpleThread(this, 0, p->system, p->itb, p->dtb);
77#else
78 thread = new SimpleThread(this, /* thread_num */ 0, p->process,
79 /* asid */ 0);
80#endif // !FULL_SYSTEM
81

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

365
366 // decode the instruction
367 inst = gtoh(inst);
368 //If we're not in the middle of a macro instruction
369 if (!curMacroStaticInst) {
370 StaticInstPtr instPtr = NULL;
371
372 //Predecode, ie bundle up an ExtMachInst
373 unsigned int result =
374 predecode(extMachInst, thread->readPC(), inst, thread->getTC());
375 //If an instruction is ready, decode it
376 if (result & ExtMIReady)
377 instPtr = StaticInst::decode(extMachInst);
378
379 //If we decoded an instruction and it's microcoded, start pulling
380 //out micro ops
381 if (instPtr && instPtr->isMacroOp()) {
382 curMacroStaticInst = instPtr;
383 curStaticInst = curMacroStaticInst->
384 fetchMicroOp(thread->readMicroPC());
385 } else {

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

441void
442BaseSimpleCPU::advancePC(Fault fault)
443{
444 if (fault != NoFault) {
445 curMacroStaticInst = StaticInst::nullStaticInstPtr;
446 fault->invoke(tc);
447 thread->setMicroPC(0);
448 thread->setNextMicroPC(1);
449 } else {
450 //If we're at the last micro op for this instruction
451 if (curStaticInst->isLastMicroOp()) {
452 //We should be working with a macro op
453 assert(curMacroStaticInst);
454 //Close out this macro op, and clean up the
455 //microcode state
456 curMacroStaticInst = StaticInst::nullStaticInstPtr;
457 thread->setMicroPC(0);
458 thread->setNextMicroPC(1);
459 }
460 //If we're still in a macro op
461 if (curMacroStaticInst) {
462 //Advance the micro pc
463 thread->setMicroPC(thread->readNextMicroPC());
464 //Advance the "next" micro pc. Note that there are no delay
465 //slots, and micro ops are "word" addressed.
466 thread->setNextMicroPC(thread->readNextMicroPC() + 1);
467 } else {
468 // go to the next instruction
469 thread->setPC(thread->readNextPC());
470#if ISA_HAS_DELAY_SLOT
471 thread->setNextPC(thread->readNextNPC());
472 thread->setNextNPC(thread->readNextNPC() + sizeof(MachInst));
473 assert(thread->readNextPC() != thread->readNextNPC());
474#else
475 thread->setNextPC(thread->readNextPC() + sizeof(MachInst));
476#endif
477 }
478 }
479
480#if FULL_SYSTEM
481 Addr oldpc;
482 do {
483 oldpc = thread->readPC();
484 system->pcEventQueue.service(tc);
485 } while (oldpc != thread->readPC());
486#endif
487}
488