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), predecoder(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 //This should go away once the constructor can be set up properly
374 predecoder.setTC(thread->getTC());
375 //If more fetch data is needed, pass it in.
376 if(predecoder.needMoreBytes())
377 predecoder.moreBytes(thread->readPC(), 0, inst);
378 else
379 predecoder.process();
380 //If an instruction is ready, decode it
381 if (predecoder.extMachInstReady())
382 instPtr = StaticInst::decode(predecoder.getExtMachInst());
383
384 //If we decoded an instruction and it's microcoded, start pulling
385 //out micro ops
386 if (instPtr && instPtr->isMacroOp()) {
387 curMacroStaticInst = instPtr;
388 curStaticInst = curMacroStaticInst->
389 fetchMicroOp(thread->readMicroPC());
390 } else {

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

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