2 * Copyright (c) 2006 The Regents of The University of Michigan
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include "config/full_system.hh"
33 #include "config/use_checker.hh"
35 #include "arch/isa_traits.hh" // For MachInst
36 #include "base/trace.hh"
37 #include "cpu/base.hh"
38 #include "cpu/simple_thread.hh"
39 #include "cpu/thread_context.hh"
40 #include "cpu/exetrace.hh"
41 #include "cpu/ozone/cpu.hh"
42 #include "cpu/quiesce_event.hh"
43 #include "cpu/static_inst.hh"
44 #include "sim/sim_object.hh"
45 #include "sim/stats.hh"
48 #include "arch/faults.hh"
49 #include "arch/alpha/osfpal.hh"
50 #include "arch/tlb.hh"
51 #include "arch/types.hh"
52 #include "arch/kernel_stats.hh"
53 #include "arch/vtophys.hh"
54 #include "base/callback.hh"
55 #include "cpu/profile.hh"
56 #include "sim/faults.hh"
57 #include "sim/sim_events.hh"
58 #include "sim/sim_exit.hh"
59 #include "sim/system.hh"
61 #include "sim/process.hh"
65 #include "cpu/checker/thread_context.hh"
68 using namespace TheISA;
71 OzoneCPU<Impl>::TickEvent::TickEvent(OzoneCPU *c, int w)
72 : Event(&mainEventQueue, CPU_Tick_Pri), cpu(c), width(w)
78 OzoneCPU<Impl>::TickEvent::process()
85 OzoneCPU<Impl>::TickEvent::description() const
87 return "OzoneCPU tick";
91 OzoneCPU<Impl>::OzoneCPU(Params *p)
93 : BaseCPU(p), thread(this, 0), tickEvent(this, p->width),
95 : BaseCPU(p), thread(this, 0, p->workload[0], 0),
96 tickEvent(this, p->width),
103 frontEnd = new FrontEnd(p);
104 backEnd = new BackEnd(p);
110 BaseCPU *temp_checker = p->checker;
111 checker = dynamic_cast<Checker<DynInstPtr> *>(temp_checker);
113 checker->setSystem(p->system);
115 checkerTC = new CheckerThreadContext<OzoneTC>(&ozoneTC, checker);
116 thread.tc = checkerTC;
119 panic("Checker enabled but not compiled in!");
122 // If checker is not being used, then the xcProxy points
123 // directly to the CPU's ExecContext.
125 thread.tc = &ozoneTC;
130 ozoneTC.thread = &thread;
132 thread.inSyscall = false;
134 thread.setStatus(ThreadContext::Suspended);
138 // Setup thread state stuff.
142 thread.quiesceEvent = new EndQuiesceEvent(tc);
145 physmem = p->system->physmem;
148 thread.profile = new FunctionProfile(p->system->kernelSymtab);
149 // @todo: This might be better as an ThreadContext instead of OzoneTC
151 new MakeCallback<OzoneTC,
152 &OzoneTC::dumpFuncProfile>(&ozoneTC);
153 registerExitCallback(cb);
156 // let's fill with a dummy node for now so we don't get a segfault
157 // on the first cycle when there's no node available.
158 static ProfileNode dummyNode;
159 thread.profileNode = &dummyNode;
160 thread.profilePC = 3;
163 #endif // !FULL_SYSTEM
168 threadContexts.push_back(tc);
170 frontEnd->setCPU(this);
171 backEnd->setCPU(this);
176 frontEnd->setThreadState(&thread);
177 backEnd->setThreadState(&thread);
179 frontEnd->setCommBuffer(&comm);
180 backEnd->setCommBuffer(&comm);
182 frontEnd->setBackEnd(backEnd);
183 backEnd->setFrontEnd(frontEnd);
189 // Setup rename table, initializing all values to ready.
190 for (int i = 0; i < TheISA::TotalNumRegs; ++i) {
191 thread.renameTable[i] = new DynInst(this);
192 thread.renameTable[i]->setResultReady();
195 frontEnd->renameTable.copyFrom(thread.renameTable);
196 backEnd->renameTable.copyFrom(thread.renameTable);
200 FunctionalPort *phys_port;
201 VirtualPort *virt_port;
202 phys_port = new FunctionalPort(csprintf("%s-%d-funcport",
204 mem_port = system->physmem->getPort("functional");
205 mem_port->setPeer(phys_port);
206 phys_port->setPeer(mem_port);
208 virt_port = new VirtualPort(csprintf("%s-%d-vport",
210 mem_port = system->physmem->getPort("functional");
211 mem_port->setPeer(virt_port);
212 virt_port->setPeer(mem_port);
214 thread.setPhysPort(phys_port);
215 thread.setVirtPort(virt_port);
218 DPRINTF(OzoneCPU, "OzoneCPU: Created Ozone cpu object.\n");
221 template <class Impl>
222 OzoneCPU<Impl>::~OzoneCPU()
226 template <class Impl>
228 OzoneCPU<Impl>::switchOut()
230 BaseCPU::switchOut();
232 // Front end needs state from back end, so switch out the back end first.
233 backEnd->switchOut();
234 frontEnd->switchOut();
237 template <class Impl>
239 OzoneCPU<Impl>::signalSwitched()
241 // Only complete the switchout when both the front end and back
242 // end have signalled they are ready to switch.
243 if (++switchCount == 2) {
244 backEnd->doSwitchOut();
245 frontEnd->doSwitchOut();
248 checker->switchOut();
251 _status = SwitchedOut;
253 // Loop through all registers
254 for (int i = 0; i < AlphaISA::TotalNumRegs; ++i) {
255 assert(thread.renameTable[i] == frontEnd->renameTable[i]);
257 assert(thread.renameTable[i] == backEnd->renameTable[i]);
259 DPRINTF(OzoneCPU, "Checking if register %i matches.\n", i);
263 if (tickEvent.scheduled())
266 assert(switchCount <= 2);
269 template <class Impl>
271 OzoneCPU<Impl>::takeOverFrom(BaseCPU *oldCPU)
273 BaseCPU::takeOverFrom(oldCPU);
275 thread.trapPending = false;
276 thread.inSyscall = false;
278 backEnd->takeOverFrom();
279 frontEnd->takeOverFrom();
280 frontEnd->renameTable.copyFrom(thread.renameTable);
281 backEnd->renameTable.copyFrom(thread.renameTable);
282 assert(!tickEvent.scheduled());
285 // Check rename table.
286 for (int i = 0; i < TheISA::TotalNumRegs; ++i) {
287 assert(thread.renameTable[i]->isResultReady());
291 // @todo: Fix hardcoded number
292 // Clear out any old information in time buffer.
293 for (int i = 0; i < 15; ++i) {
297 // if any of this CPU's ThreadContexts are active, mark the CPU as
298 // running and schedule its tick event.
299 for (int i = 0; i < threadContexts.size(); ++i) {
300 ThreadContext *tc = threadContexts[i];
301 if (tc->status() == ThreadContext::Active &&
302 _status != Running) {
304 tickEvent.schedule(curTick);
307 // Nothing running, change status to reflect that we're no longer
309 if (_status == SwitchedOut) {
314 template <class Impl>
316 OzoneCPU<Impl>::activateContext(int thread_num, int delay)
318 // Eventually change this in SMT.
319 assert(thread_num == 0);
321 assert(_status == Idle);
323 scheduleTickEvent(delay);
326 if (thread.quiesceEvent && thread.quiesceEvent->scheduled())
327 thread.quiesceEvent->deschedule();
329 thread.setStatus(ThreadContext::Active);
330 frontEnd->wakeFromQuiesce();
333 template <class Impl>
335 OzoneCPU<Impl>::suspendContext(int thread_num)
337 // Eventually change this in SMT.
338 assert(thread_num == 0);
339 // @todo: Figure out how to initially set the status properly so
341 // assert(_status == Running);
343 unscheduleTickEvent();
347 template <class Impl>
349 OzoneCPU<Impl>::deallocateContext(int thread_num, int delay)
351 // for now, these are equivalent
352 suspendContext(thread_num);
355 template <class Impl>
357 OzoneCPU<Impl>::haltContext(int thread_num)
359 // for now, these are equivalent
360 suspendContext(thread_num);
363 template <class Impl>
365 OzoneCPU<Impl>::regStats()
367 using namespace Stats;
372 .name(name() + ".num_insts")
373 .desc("Number of instructions executed")
377 .name(name() + ".num_refs")
378 .desc("Number of memory references")
382 .name(name() + ".not_idle_fraction")
383 .desc("Percentage of non-idle cycles")
387 .name(name() + ".idle_fraction")
388 .desc("Percentage of idle cycles")
392 .name(name() + ".quiesce_cycles")
393 .desc("Number of cycles spent in quiesce")
396 idleFraction = constant(1.0) - notIdleFraction;
398 frontEnd->regStats();
402 template <class Impl>
404 OzoneCPU<Impl>::resetStats()
406 // startNumInst = numInst;
407 notIdleFraction = (_status != Idle);
410 template <class Impl>
412 OzoneCPU<Impl>::init()
416 // Mark this as in syscall so it won't need to squash
417 thread.inSyscall = true;
419 for (int i = 0; i < threadContexts.size(); ++i) {
420 ThreadContext *tc = threadContexts[i];
422 // initialize CPU, including PC
423 TheISA::initCPU(tc, tc->contextId());
426 frontEnd->renameTable.copyFrom(thread.renameTable);
427 backEnd->renameTable.copyFrom(thread.renameTable);
429 thread.inSyscall = false;
432 template <class Impl>
434 OzoneCPU<Impl>::getPort(const std::string &if_name, int idx)
436 if (if_name == "dcache_port")
437 return backEnd->getDcachePort();
438 else if (if_name == "icache_port")
439 return frontEnd->getIcachePort();
441 panic("No Such Port\n");
444 template <class Impl>
446 OzoneCPU<Impl>::serialize(std::ostream &os)
448 BaseCPU::serialize(os);
449 SERIALIZE_ENUM(_status);
450 nameOut(os, csprintf("%s.tc", name()));
451 ozoneTC.serialize(os);
452 nameOut(os, csprintf("%s.tickEvent", name()));
453 tickEvent.serialize(os);
455 // Use SimpleThread's ability to checkpoint to make it easier to
456 // write out the registers. Also make this static so it doesn't
457 // get instantiated multiple times (causes a panic in statistics).
458 static SimpleThread temp;
460 nameOut(os, csprintf("%s.xc.0", name()));
461 temp.copyTC(thread.getTC());
465 template <class Impl>
467 OzoneCPU<Impl>::unserialize(Checkpoint *cp, const std::string §ion)
469 BaseCPU::unserialize(cp, section);
470 UNSERIALIZE_ENUM(_status);
471 ozoneTC.unserialize(cp, csprintf("%s.tc", section));
472 tickEvent.unserialize(cp, csprintf("%s.tickEvent", section));
474 // Use SimpleThread's ability to checkpoint to make it easier to
475 // read in the registers. Also make this static so it doesn't
476 // get instantiated multiple times (causes a panic in statistics).
477 static SimpleThread temp;
479 temp.copyTC(thread.getTC());
480 temp.unserialize(cp, csprintf("%s.xc.0", section));
481 thread.getTC()->copyArchRegs(temp.getTC());
484 template <class Impl>
486 OzoneCPU<Impl>::copySrcTranslate(Addr src)
488 panic("Copy not implemented!\n");
491 static bool no_warn = true;
492 int blk_size = (dcacheInterface) ? dcacheInterface->getBlockSize() : 64;
493 // Only support block sizes of 64 atm.
494 assert(blk_size == 64);
495 int offset = src & (blk_size - 1);
497 // Make sure block doesn't span page
499 (src & TheISA::PageMask) != ((src + blk_size) & TheISA::PageMask) &&
500 (src >> 40) != 0xfffffc) {
501 warn("Copied block source spans pages %x.", src);
505 memReq->reset(src & ~(blk_size - 1), blk_size);
507 // translate to physical address
508 Fault fault = tc->translateDataReadReq(memReq);
510 assert(fault != Alignment_Fault);
512 if (fault == NoFault) {
513 tc->copySrcAddr = src;
514 tc->copySrcPhysAddr = memReq->paddr + offset;
517 tc->copySrcPhysAddr = 0;
523 template <class Impl>
525 OzoneCPU<Impl>::copy(Addr dest)
527 panic("Copy not implemented!\n");
530 static bool no_warn = true;
531 int blk_size = (dcacheInterface) ? dcacheInterface->getBlockSize() : 64;
532 // Only support block sizes of 64 atm.
533 assert(blk_size == 64);
534 uint8_t data[blk_size];
535 //assert(tc->copySrcAddr);
536 int offset = dest & (blk_size - 1);
538 // Make sure block doesn't span page
540 (dest & TheISA::PageMask) != ((dest + blk_size) & TheISA::PageMask) &&
541 (dest >> 40) != 0xfffffc) {
543 warn("Copied block destination spans pages %x. ", dest);
546 memReq->reset(dest & ~(blk_size -1), blk_size);
547 // translate to physical address
548 Fault fault = tc->translateDataWriteReq(memReq);
550 assert(fault != Alignment_Fault);
552 if (fault == NoFault) {
553 Addr dest_addr = memReq->paddr + offset;
554 // Need to read straight from memory since we have more than 8 bytes.
555 memReq->paddr = tc->copySrcPhysAddr;
556 tc->mem->read(memReq, data);
557 memReq->paddr = dest_addr;
558 tc->mem->write(memReq, data);
559 if (dcacheInterface) {
561 memReq->completionEvent = NULL;
562 memReq->paddr = tc->copySrcPhysAddr;
563 memReq->dest = dest_addr;
565 memReq->time = curTick;
566 dcacheInterface->access(memReq);
574 template <class Impl>
576 OzoneCPU<Impl>::dbg_vtophys(Addr addr)
578 return vtophys(tc, addr);
580 #endif // FULL_SYSTEM
583 template <class Impl>
585 OzoneCPU<Impl>::wakeup()
587 if (_status == Idle) {
588 DPRINTF(IPI,"Suspended Processor awoke\n");
589 // thread.activate();
590 // Hack for now. Otherwise might have to go through the tc, or
591 // I need to figure out what's the right thing to call.
592 activateContext(thread.threadId(), 1);
595 #endif // FULL_SYSTEM
597 /* start simulation, program loaded, processor precise state initialized */
598 template <class Impl>
600 OzoneCPU<Impl>::tick()
602 DPRINTF(OzoneCPU, "\n\nOzoneCPU: Ticking cpu.\n");
605 thread.renameTable[ZeroReg]->setIntResult(0);
606 thread.renameTable[ZeroReg+TheISA::FP_Base_DepTag]->
607 setDoubleResult(0.0);
613 // check for instruction-count-based events
614 comInstEventQueue[0]->serviceEvents(numInst);
616 if (!tickEvent.scheduled() && _status == Running)
617 tickEvent.schedule(curTick + ticks(1));
620 template <class Impl>
622 OzoneCPU<Impl>::squashFromTC()
624 thread.inSyscall = true;
625 backEnd->generateTCEvent();
629 template <class Impl>
631 OzoneCPU<Impl>::syscall(uint64_t &callnum)
633 // Not sure this copy is needed, depending on how the TC proxy is made.
634 thread.renameTable.copyFrom(backEnd->renameTable);
636 thread.inSyscall = true;
638 thread.funcExeInst++;
640 DPRINTF(OzoneCPU, "FuncExeInst: %i\n", thread.funcExeInst);
642 thread.process->syscall(callnum, tc);
644 thread.funcExeInst--;
646 thread.inSyscall = false;
648 frontEnd->renameTable.copyFrom(thread.renameTable);
649 backEnd->renameTable.copyFrom(thread.renameTable);
652 template <class Impl>
654 OzoneCPU<Impl>::setSyscallReturn(SyscallReturn return_value, int tid)
656 // check for error condition. Alpha syscall convention is to
657 // indicate success/failure in reg a3 (r19) and put the
658 // return value itself in the standard return value reg (v0).
659 if (return_value.successful()) {
661 thread.renameTable[SyscallSuccessReg]->setIntResult(0);
662 thread.renameTable[ReturnValueReg]->setIntResult(
663 return_value.value());
665 // got an error, return details
666 thread.renameTable[SyscallSuccessReg]->setIntResult((IntReg) -1);
667 thread.renameTable[ReturnValueReg]->setIntResult(
668 -return_value.value());
672 template <class Impl>
674 OzoneCPU<Impl>::hwrei()
676 // Need to move this to ISA code
677 // May also need to make this per thread
680 lockAddrList.clear();
681 thread.kernelStats->hwrei();
683 // FIXME: XXX check for interrupts? XXX
687 template <class Impl>
689 OzoneCPU<Impl>::processInterrupts()
691 // Check for interrupts here. For now can copy the code that
692 // exists within isa_fullsys_traits.hh. Also assume that thread 0
693 // is the one that handles the interrupts.
695 // Check if there are any outstanding interrupts
696 //Handle the interrupts
697 Fault interrupt = this->interrupts->getInterrupt(thread.getTC());
699 if (interrupt != NoFault) {
700 this->interrupts->updateIntrInfo(thread.getTC());
701 interrupt->invoke(thread.getTC());
705 template <class Impl>
707 OzoneCPU<Impl>::simPalCheck(int palFunc)
709 // Need to move this to ISA code
710 // May also need to make this per thread
711 thread.kernelStats->callpal(palFunc, tc);
715 haltContext(thread.threadId());
716 if (--System::numSystemsRunning == 0)
717 exitSimLoop("all cpus halted");
722 if (system->breakpoint())
731 template <class Impl>
733 OzoneCPU<Impl>::OzoneTC::getCpuPtr()
738 template <class Impl>
740 OzoneCPU<Impl>::OzoneTC::setStatus(Status new_status)
742 thread->setStatus(new_status);
745 template <class Impl>
747 OzoneCPU<Impl>::OzoneTC::activate(int delay)
749 cpu->activateContext(thread->threadId(), delay);
752 /// Set the status to Suspended.
753 template <class Impl>
755 OzoneCPU<Impl>::OzoneTC::suspend()
757 cpu->suspendContext(thread->threadId());
760 /// Set the status to Unallocated.
761 template <class Impl>
763 OzoneCPU<Impl>::OzoneTC::deallocate(int delay)
765 cpu->deallocateContext(thread->threadId(), delay);
768 /// Set the status to Halted.
769 template <class Impl>
771 OzoneCPU<Impl>::OzoneTC::halt()
773 cpu->haltContext(thread->threadId());
777 template <class Impl>
779 OzoneCPU<Impl>::OzoneTC::dumpFuncProfile()
781 thread->dumpFuncProfile();
785 template <class Impl>
787 OzoneCPU<Impl>::OzoneTC::takeOverFrom(ThreadContext *old_context)
789 // some things should already be set up
791 assert(getSystemPtr() == old_context->getSystemPtr());
793 assert(getProcessPtr() == old_context->getProcessPtr());
796 // copy over functional state
797 setStatus(old_context->status());
798 copyArchRegs(old_context);
799 setCpuId(old_context->cpuId());
800 setContextId(old_context->contextId());
802 thread->setInst(old_context->getInst());
804 setFuncExeInst(old_context->readFuncExeInst());
806 EndQuiesceEvent *other_quiesce = old_context->getQuiesceEvent();
808 // Point the quiesce event's TC at this TC so that it wakes up
810 other_quiesce->tc = this;
812 if (thread->quiesceEvent) {
813 thread->quiesceEvent->tc = this;
816 // Copy kernel stats pointer from old context.
817 thread->kernelStats = old_context->getKernelStats();
818 // storeCondFailures = 0;
819 cpu->lockFlag = false;
822 old_context->setStatus(ThreadContext::Unallocated);
825 template <class Impl>
827 OzoneCPU<Impl>::OzoneTC::regStats(const std::string &name)
830 thread->kernelStats = new TheISA::Kernel::Statistics(cpu->system);
831 thread->kernelStats->regStats(name + ".kern");
835 template <class Impl>
837 OzoneCPU<Impl>::OzoneTC::serialize(std::ostream &os)
839 // Once serialization is added, serialize the quiesce event and
840 // kernel stats. Will need to make sure there aren't multiple
841 // things that serialize them.
844 template <class Impl>
846 OzoneCPU<Impl>::OzoneTC::unserialize(Checkpoint *cp, const std::string §ion)
850 template <class Impl>
852 OzoneCPU<Impl>::OzoneTC::getQuiesceEvent()
854 return thread->quiesceEvent;
857 template <class Impl>
859 OzoneCPU<Impl>::OzoneTC::readLastActivate()
861 return thread->lastActivate;
864 template <class Impl>
866 OzoneCPU<Impl>::OzoneTC::readLastSuspend()
868 return thread->lastSuspend;
871 template <class Impl>
873 OzoneCPU<Impl>::OzoneTC::profileClear()
875 thread->profileClear();
878 template <class Impl>
880 OzoneCPU<Impl>::OzoneTC::profileSample()
882 thread->profileSample();
886 template <class Impl>
888 OzoneCPU<Impl>::OzoneTC::threadId()
890 return thread->threadId();
893 template <class Impl>
895 OzoneCPU<Impl>::OzoneTC::getInst()
897 return thread->getInst();
900 template <class Impl>
902 OzoneCPU<Impl>::OzoneTC::copyArchRegs(ThreadContext *tc)
904 thread->PC = tc->readPC();
905 thread->nextPC = tc->readNextPC();
907 cpu->frontEnd->setPC(thread->PC);
908 cpu->frontEnd->setNextPC(thread->nextPC);
910 // First loop through the integer registers.
911 for (int i = 0; i < TheISA::NumIntRegs; ++i) {
912 /* DPRINTF(OzoneCPU, "Copying over register %i, had data %lli, "
913 "now has data %lli.\n",
914 i, thread->renameTable[i]->readIntResult(),
917 thread->renameTable[i]->setIntResult(tc->readIntReg(i));
920 // Then loop through the floating point registers.
921 for (int i = 0; i < TheISA::NumFloatRegs; ++i) {
922 int fp_idx = i + TheISA::FP_Base_DepTag;
923 thread->renameTable[fp_idx]->setIntResult(tc->readFloatRegBits(i));
927 thread->funcExeInst = tc->readFuncExeInst();
930 // Need to copy the TC values into the current rename table,
931 // copy the misc regs.
932 copyMiscRegs(tc, this);
935 template <class Impl>
937 OzoneCPU<Impl>::OzoneTC::clearArchRegs()
939 panic("Unimplemented!");
942 template <class Impl>
944 OzoneCPU<Impl>::OzoneTC::readIntReg(int reg_idx)
946 return thread->renameTable[reg_idx]->readIntResult();
949 template <class Impl>
951 OzoneCPU<Impl>::OzoneTC::readFloatReg(int reg_idx, int width)
953 int idx = reg_idx + TheISA::FP_Base_DepTag;
956 return thread->renameTable[idx]->readFloatResult();
958 return thread->renameTable[idx]->readDoubleResult();
960 panic("Unsupported width!");
965 template <class Impl>
967 OzoneCPU<Impl>::OzoneTC::readFloatReg(int reg_idx)
969 int idx = reg_idx + TheISA::FP_Base_DepTag;
970 return thread->renameTable[idx]->readFloatResult();
973 template <class Impl>
975 OzoneCPU<Impl>::OzoneTC::readFloatRegBits(int reg_idx, int width)
977 int idx = reg_idx + TheISA::FP_Base_DepTag;
978 return thread->renameTable[idx]->readIntResult();
981 template <class Impl>
983 OzoneCPU<Impl>::OzoneTC::readFloatRegBits(int reg_idx)
985 int idx = reg_idx + TheISA::FP_Base_DepTag;
986 return thread->renameTable[idx]->readIntResult();
989 template <class Impl>
991 OzoneCPU<Impl>::OzoneTC::setIntReg(int reg_idx, uint64_t val)
993 thread->renameTable[reg_idx]->setIntResult(val);
995 if (!thread->inSyscall) {
1000 template <class Impl>
1002 OzoneCPU<Impl>::OzoneTC::setFloatReg(int reg_idx, FloatReg val, int width)
1004 int idx = reg_idx + TheISA::FP_Base_DepTag;
1007 panic("Unimplemented!");
1010 thread->renameTable[idx]->setDoubleResult(val);
1013 panic("Unsupported width!");
1016 if (!thread->inSyscall) {
1017 cpu->squashFromTC();
1021 template <class Impl>
1023 OzoneCPU<Impl>::OzoneTC::setFloatReg(int reg_idx, FloatReg val)
1025 int idx = reg_idx + TheISA::FP_Base_DepTag;
1027 thread->renameTable[idx]->setDoubleResult(val);
1029 if (!thread->inSyscall) {
1030 cpu->squashFromTC();
1034 template <class Impl>
1036 OzoneCPU<Impl>::OzoneTC::setFloatRegBits(int reg_idx, FloatRegBits val,
1039 panic("Unimplemented!");
1042 template <class Impl>
1044 OzoneCPU<Impl>::OzoneTC::setFloatRegBits(int reg_idx, FloatRegBits val)
1046 panic("Unimplemented!");
1049 template <class Impl>
1051 OzoneCPU<Impl>::OzoneTC::setPC(Addr val)
1054 cpu->frontEnd->setPC(val);
1056 if (!thread->inSyscall) {
1057 cpu->squashFromTC();
1061 template <class Impl>
1063 OzoneCPU<Impl>::OzoneTC::setNextPC(Addr val)
1065 thread->nextPC = val;
1066 cpu->frontEnd->setNextPC(val);
1068 if (!thread->inSyscall) {
1069 cpu->squashFromTC();
1073 template <class Impl>
1075 OzoneCPU<Impl>::OzoneTC::readMiscRegNoEffect(int misc_reg)
1077 return thread->miscRegFile.readRegNoEffect(misc_reg);
1080 template <class Impl>
1082 OzoneCPU<Impl>::OzoneTC::readMiscReg(int misc_reg)
1084 return thread->miscRegFile.readReg(misc_reg, this);
1087 template <class Impl>
1089 OzoneCPU<Impl>::OzoneTC::setMiscRegNoEffect(int misc_reg, const MiscReg &val)
1091 // Needs to setup a squash event unless we're in syscall mode
1092 thread->miscRegFile.setRegNoEffect(misc_reg, val);
1094 if (!thread->inSyscall) {
1095 cpu->squashFromTC();
1099 template <class Impl>
1101 OzoneCPU<Impl>::OzoneTC::setMiscReg(int misc_reg, const MiscReg &val)
1103 // Needs to setup a squash event unless we're in syscall mode
1104 thread->miscRegFile.setReg(misc_reg, val, this);
1106 if (!thread->inSyscall) {
1107 cpu->squashFromTC();