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/thread_context.hh"
39 #include "cpu/exetrace.hh"
40 #include "cpu/ozone/cpu.hh"
41 #include "cpu/quiesce_event.hh"
42 #include "cpu/static_inst.hh"
43 #include "sim/sim_object.hh"
44 #include "sim/stats.hh"
47 #include "arch/faults.hh"
48 #include "arch/alpha/osfpal.hh"
49 #include "arch/alpha/tlb.hh"
50 #include "arch/vtophys.hh"
51 #include "base/callback.hh"
52 //#include "base/remote_gdb.hh"
53 #include "cpu/profile.hh"
54 #include "kern/kernel_stats.hh"
55 #include "sim/faults.hh"
56 #include "sim/sim_events.hh"
57 #include "sim/sim_exit.hh"
58 #include "sim/system.hh"
60 #include "sim/process.hh"
64 #include "cpu/checker/thread_context.hh"
67 using namespace TheISA;
72 OzoneCPU<Impl>::trace_data(T data) {
74 traceData->setData(data);
79 OzoneCPU<Impl>::TickEvent::TickEvent(OzoneCPU *c, int w)
80 : Event(&mainEventQueue, CPU_Tick_Pri), cpu(c), width(w)
86 OzoneCPU<Impl>::TickEvent::process()
93 OzoneCPU<Impl>::TickEvent::description()
95 return "OzoneCPU tick event";
99 OzoneCPU<Impl>::OzoneCPU(Params *p)
101 : BaseCPU(p), thread(this, 0), tickEvent(this, p->width),
103 : BaseCPU(p), thread(this, 0, p->workload[0], 0, p->mem),
104 tickEvent(this, p->width),
106 mem(p->mem), comm(5, 5)
108 frontEnd = new FrontEnd(p);
109 backEnd = new BackEnd(p);
115 BaseCPU *temp_checker = p->checker;
116 checker = dynamic_cast<Checker<DynInstPtr> *>(temp_checker);
117 checker->setMemory(mem);
119 checker->setSystem(p->system);
121 checkerTC = new CheckerThreadContext<OzoneTC>(&ozoneTC, checker);
122 thread.tc = checkerTC;
125 panic("Checker enabled but not compiled in!");
129 thread.tc = &ozoneTC;
134 ozoneTC.thread = &thread;
136 thread.inSyscall = false;
138 thread.setStatus(ThreadContext::Suspended);
140 /***** All thread state stuff *****/
144 thread.quiesceEvent = new EndQuiesceEvent(tc);
149 physmem = p->system->physmem;
152 thread.profile = new FunctionProfile(p->system->kernelSymtab);
153 // @todo: This might be better as an ThreadContext instead of OzoneTC
155 new MakeCallback<OzoneTC,
156 &OzoneTC::dumpFuncProfile>(&ozoneTC);
157 registerExitCallback(cb);
160 // let's fill with a dummy node for now so we don't get a segfault
161 // on the first cycle when there's no node available.
162 static ProfileNode dummyNode;
163 thread.profileNode = &dummyNode;
164 thread.profilePC = 3;
167 #endif // !FULL_SYSTEM
172 threadContexts.push_back(tc);
174 frontEnd->setCPU(this);
175 backEnd->setCPU(this);
180 frontEnd->setThreadState(&thread);
181 backEnd->setThreadState(&thread);
183 frontEnd->setCommBuffer(&comm);
184 backEnd->setCommBuffer(&comm);
186 frontEnd->setBackEnd(backEnd);
187 backEnd->setFrontEnd(frontEnd);
189 decoupledFrontEnd = p->decoupledFrontEnd;
193 checkInterrupts = false;
195 for (int i = 0; i < TheISA::TotalNumRegs; ++i) {
196 thread.renameTable[i] = new DynInst(this);
197 thread.renameTable[i]->setResultReady();
200 frontEnd->renameTable.copyFrom(thread.renameTable);
201 backEnd->renameTable.copyFrom(thread.renameTable);
204 /* Use this port to for syscall emulation writes to memory. */
206 TranslatingPort *trans_port;
207 trans_port = new TranslatingPort(csprintf("%s-%d-funcport",
209 p->workload[0]->pTable,
211 mem_port = p->mem->getPort("functional");
212 mem_port->setPeer(trans_port);
213 trans_port->setPeer(mem_port);
214 thread.setMemPort(trans_port);
217 FunctionalPort *phys_port;
218 VirtualPort *virt_port;
219 phys_port = new FunctionalPort(csprintf("%s-%d-funcport",
221 mem_port = system->physmem->getPort("functional");
222 mem_port->setPeer(phys_port);
223 phys_port->setPeer(mem_port);
225 virt_port = new VirtualPort(csprintf("%s-%d-vport",
227 mem_port = system->physmem->getPort("functional");
228 mem_port->setPeer(virt_port);
229 virt_port->setPeer(mem_port);
231 thread.setPhysPort(phys_port);
232 thread.setVirtPort(virt_port);
237 DPRINTF(OzoneCPU, "OzoneCPU: Created Ozone cpu object.\n");
240 template <class Impl>
241 OzoneCPU<Impl>::~OzoneCPU()
245 template <class Impl>
247 OzoneCPU<Impl>::switchOut(Sampler *_sampler)
251 // Front end needs state from back end, so switch out the back end first.
252 backEnd->switchOut();
253 frontEnd->switchOut();
256 template <class Impl>
258 OzoneCPU<Impl>::signalSwitched()
260 if (++switchCount == 2) {
261 backEnd->doSwitchOut();
262 frontEnd->doSwitchOut();
265 checker->switchOut(sampler);
268 _status = SwitchedOut;
269 if (tickEvent.scheduled())
271 sampler->signalSwitched();
273 assert(switchCount <= 2);
276 template <class Impl>
278 OzoneCPU<Impl>::takeOverFrom(BaseCPU *oldCPU)
280 BaseCPU::takeOverFrom(oldCPU);
282 backEnd->takeOverFrom();
283 frontEnd->takeOverFrom();
284 assert(!tickEvent.scheduled());
286 // @todo: Fix hardcoded number
287 // Clear out any old information in time buffer.
288 for (int i = 0; i < 6; ++i) {
292 // if any of this CPU's ThreadContexts are active, mark the CPU as
293 // running and schedule its tick event.
294 for (int i = 0; i < threadContexts.size(); ++i) {
295 ThreadContext *tc = threadContexts[i];
296 if (tc->status() == ThreadContext::Active &&
297 _status != Running) {
299 tickEvent.schedule(curTick);
302 // Nothing running, change status to reflect that we're no longer
304 if (_status == SwitchedOut) {
309 template <class Impl>
311 OzoneCPU<Impl>::activateContext(int thread_num, int delay)
313 // Eventually change this in SMT.
314 assert(thread_num == 0);
316 assert(_status == Idle);
318 scheduleTickEvent(delay);
320 thread.setStatus(ThreadContext::Active);
321 frontEnd->wakeFromQuiesce();
324 template <class Impl>
326 OzoneCPU<Impl>::suspendContext(int thread_num)
328 // Eventually change this in SMT.
329 assert(thread_num == 0);
330 // @todo: Figure out how to initially set the status properly so
332 // assert(_status == Running);
334 unscheduleTickEvent();
338 template <class Impl>
340 OzoneCPU<Impl>::deallocateContext(int thread_num)
342 // for now, these are equivalent
343 suspendContext(thread_num);
346 template <class Impl>
348 OzoneCPU<Impl>::haltContext(int thread_num)
350 // for now, these are equivalent
351 suspendContext(thread_num);
354 template <class Impl>
356 OzoneCPU<Impl>::regStats()
358 using namespace Stats;
363 .name(name() + ".num_insts")
364 .desc("Number of instructions executed")
368 .name(name() + ".num_refs")
369 .desc("Number of memory references")
373 .name(name() + ".not_idle_fraction")
374 .desc("Percentage of non-idle cycles")
378 .name(name() + ".idle_fraction")
379 .desc("Percentage of idle cycles")
383 .name(name() + ".quiesce_cycles")
384 .desc("Number of cycles spent in quiesce")
387 idleFraction = constant(1.0) - notIdleFraction;
389 frontEnd->regStats();
393 template <class Impl>
395 OzoneCPU<Impl>::resetStats()
397 startNumInst = numInst;
398 notIdleFraction = (_status != Idle);
401 template <class Impl>
403 OzoneCPU<Impl>::init()
407 // Mark this as in syscall so it won't need to squash
408 thread.inSyscall = true;
410 for (int i = 0; i < threadContexts.size(); ++i) {
411 ThreadContext *tc = threadContexts[i];
413 // initialize CPU, including PC
414 TheISA::initCPU(tc, tc->readCpuId());
417 frontEnd->renameTable.copyFrom(thread.renameTable);
418 backEnd->renameTable.copyFrom(thread.renameTable);
420 thread.inSyscall = false;
423 template <class Impl>
425 OzoneCPU<Impl>::serialize(std::ostream &os)
427 BaseCPU::serialize(os);
428 SERIALIZE_ENUM(_status);
429 nameOut(os, csprintf("%s.tc", name()));
430 ozoneTC.serialize(os);
431 nameOut(os, csprintf("%s.tickEvent", name()));
432 tickEvent.serialize(os);
435 template <class Impl>
437 OzoneCPU<Impl>::unserialize(Checkpoint *cp, const std::string §ion)
439 BaseCPU::unserialize(cp, section);
440 UNSERIALIZE_ENUM(_status);
441 ozoneTC.unserialize(cp, csprintf("%s.tc", section));
442 tickEvent.unserialize(cp, csprintf("%s.tickEvent", section));
445 template <class Impl>
447 OzoneCPU<Impl>::copySrcTranslate(Addr src)
449 panic("Copy not implemented!\n");
452 static bool no_warn = true;
453 int blk_size = (dcacheInterface) ? dcacheInterface->getBlockSize() : 64;
454 // Only support block sizes of 64 atm.
455 assert(blk_size == 64);
456 int offset = src & (blk_size - 1);
458 // Make sure block doesn't span page
460 (src & TheISA::PageMask) != ((src + blk_size) & TheISA::PageMask) &&
461 (src >> 40) != 0xfffffc) {
462 warn("Copied block source spans pages %x.", src);
466 memReq->reset(src & ~(blk_size - 1), blk_size);
468 // translate to physical address
469 Fault fault = tc->translateDataReadReq(memReq);
471 assert(fault != Alignment_Fault);
473 if (fault == NoFault) {
474 tc->copySrcAddr = src;
475 tc->copySrcPhysAddr = memReq->paddr + offset;
478 tc->copySrcPhysAddr = 0;
484 template <class Impl>
486 OzoneCPU<Impl>::copy(Addr dest)
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 uint8_t data[blk_size];
496 //assert(tc->copySrcAddr);
497 int offset = dest & (blk_size - 1);
499 // Make sure block doesn't span page
501 (dest & TheISA::PageMask) != ((dest + blk_size) & TheISA::PageMask) &&
502 (dest >> 40) != 0xfffffc) {
504 warn("Copied block destination spans pages %x. ", dest);
507 memReq->reset(dest & ~(blk_size -1), blk_size);
508 // translate to physical address
509 Fault fault = tc->translateDataWriteReq(memReq);
511 assert(fault != Alignment_Fault);
513 if (fault == NoFault) {
514 Addr dest_addr = memReq->paddr + offset;
515 // Need to read straight from memory since we have more than 8 bytes.
516 memReq->paddr = tc->copySrcPhysAddr;
517 tc->mem->read(memReq, data);
518 memReq->paddr = dest_addr;
519 tc->mem->write(memReq, data);
520 if (dcacheInterface) {
522 memReq->completionEvent = NULL;
523 memReq->paddr = tc->copySrcPhysAddr;
524 memReq->dest = dest_addr;
526 memReq->time = curTick;
527 dcacheInterface->access(memReq);
535 template <class Impl>
537 OzoneCPU<Impl>::dbg_vtophys(Addr addr)
539 return vtophys(tc, addr);
541 #endif // FULL_SYSTEM
544 template <class Impl>
546 OzoneCPU<Impl>::post_interrupt(int int_num, int index)
548 BaseCPU::post_interrupt(int_num, index);
550 if (_status == Idle) {
551 DPRINTF(IPI,"Suspended Processor awoke\n");
552 // thread.activate();
553 // Hack for now. Otherwise might have to go through the tc, or
554 // I need to figure out what's the right thing to call.
555 activateContext(thread.readTid(), 1);
558 #endif // FULL_SYSTEM
560 /* start simulation, program loaded, processor precise state initialized */
561 template <class Impl>
563 OzoneCPU<Impl>::tick()
565 DPRINTF(OzoneCPU, "\n\nOzoneCPU: Ticking cpu.\n");
568 thread.renameTable[ZeroReg]->setIntResult(0);
569 thread.renameTable[ZeroReg+TheISA::FP_Base_DepTag]->
570 setDoubleResult(0.0);
576 // check for instruction-count-based events
577 comInstEventQueue[0]->serviceEvents(numInst);
579 if (!tickEvent.scheduled() && _status == Running)
580 tickEvent.schedule(curTick + cycles(1));
583 template <class Impl>
585 OzoneCPU<Impl>::squashFromTC()
587 thread.inSyscall = true;
588 backEnd->generateTCEvent();
592 template <class Impl>
594 OzoneCPU<Impl>::syscall(uint64_t &callnum)
596 // Not sure this copy is needed, depending on how the TC proxy is made.
597 thread.renameTable.copyFrom(backEnd->renameTable);
599 thread.inSyscall = true;
601 thread.funcExeInst++;
603 DPRINTF(OzoneCPU, "FuncExeInst: %i\n", thread.funcExeInst);
605 thread.process->syscall(callnum, tc);
607 thread.funcExeInst--;
609 thread.inSyscall = false;
611 frontEnd->renameTable.copyFrom(thread.renameTable);
612 backEnd->renameTable.copyFrom(thread.renameTable);
615 template <class Impl>
617 OzoneCPU<Impl>::setSyscallReturn(SyscallReturn return_value, int tid)
619 // check for error condition. Alpha syscall convention is to
620 // indicate success/failure in reg a3 (r19) and put the
621 // return value itself in the standard return value reg (v0).
622 if (return_value.successful()) {
624 thread.renameTable[SyscallSuccessReg]->setIntResult(0);
625 thread.renameTable[ReturnValueReg]->setIntResult(
626 return_value.value());
628 // got an error, return details
629 thread.renameTable[SyscallSuccessReg]->setIntResult((IntReg) -1);
630 thread.renameTable[ReturnValueReg]->setIntResult(
631 -return_value.value());
635 template <class Impl>
637 OzoneCPU<Impl>::hwrei()
639 // Need to move this to ISA code
640 // May also need to make this per thread
643 lockAddrList.clear();
644 thread.kernelStats->hwrei();
646 checkInterrupts = true;
648 // FIXME: XXX check for interrupts? XXX
652 template <class Impl>
654 OzoneCPU<Impl>::processInterrupts()
656 // Check for interrupts here. For now can copy the code that
657 // exists within isa_fullsys_traits.hh. Also assume that thread 0
658 // is the one that handles the interrupts.
660 // Check if there are any outstanding interrupts
661 //Handle the interrupts
665 checkInterrupts = false;
667 if (thread.readMiscReg(IPR_ASTRR))
668 panic("asynchronous traps not implemented\n");
670 if (thread.readMiscReg(IPR_SIRR)) {
671 for (int i = INTLEVEL_SOFTWARE_MIN;
672 i < INTLEVEL_SOFTWARE_MAX; i++) {
673 if (thread.readMiscReg(IPR_SIRR) & (ULL(1) << i)) {
674 // See table 4-19 of the 21164 hardware reference
675 ipl = (i - INTLEVEL_SOFTWARE_MIN) + 1;
676 summary |= (ULL(1) << i);
681 uint64_t interrupts = intr_status();
684 for (int i = INTLEVEL_EXTERNAL_MIN;
685 i < INTLEVEL_EXTERNAL_MAX; i++) {
686 if (interrupts & (ULL(1) << i)) {
687 // See table 4-19 of the 21164 hardware reference
689 summary |= (ULL(1) << i);
694 if (ipl && ipl > thread.readMiscReg(IPR_IPLR)) {
695 thread.setMiscReg(IPR_ISR, summary);
696 thread.setMiscReg(IPR_INTID, ipl);
697 // @todo: Make this more transparent
699 checker->threadBase()->setMiscReg(IPR_ISR, summary);
700 checker->threadBase()->setMiscReg(IPR_INTID, ipl);
702 Fault fault = new InterruptFault;
703 fault->invoke(thread.getTC());
704 DPRINTF(Flow, "Interrupt! IPLR=%d ipl=%d summary=%x\n",
705 thread.readMiscReg(IPR_IPLR), ipl, summary);
709 template <class Impl>
711 OzoneCPU<Impl>::simPalCheck(int palFunc)
713 // Need to move this to ISA code
714 // May also need to make this per thread
715 thread.kernelStats->callpal(palFunc, tc);
719 haltContext(thread.readTid());
720 if (--System::numSystemsRunning == 0)
721 exitSimLoop("all cpus halted");
726 if (system->breakpoint())
735 template <class Impl>
737 OzoneCPU<Impl>::OzoneTC::getCpuPtr()
742 template <class Impl>
744 OzoneCPU<Impl>::OzoneTC::setCpuId(int id)
747 thread->setCpuId(id);
751 template <class Impl>
753 OzoneCPU<Impl>::OzoneTC::delVirtPort(VirtualPort *vp)
755 delete vp->getPeer();
760 template <class Impl>
762 OzoneCPU<Impl>::OzoneTC::setStatus(Status new_status)
764 thread->setStatus(new_status);
767 template <class Impl>
769 OzoneCPU<Impl>::OzoneTC::activate(int delay)
771 cpu->activateContext(thread->readTid(), delay);
774 /// Set the status to Suspended.
775 template <class Impl>
777 OzoneCPU<Impl>::OzoneTC::suspend()
779 cpu->suspendContext(thread->readTid());
782 /// Set the status to Unallocated.
783 template <class Impl>
785 OzoneCPU<Impl>::OzoneTC::deallocate()
787 cpu->deallocateContext(thread->readTid());
790 /// Set the status to Halted.
791 template <class Impl>
793 OzoneCPU<Impl>::OzoneTC::halt()
795 cpu->haltContext(thread->readTid());
799 template <class Impl>
801 OzoneCPU<Impl>::OzoneTC::dumpFuncProfile()
805 template <class Impl>
807 OzoneCPU<Impl>::OzoneTC::takeOverFrom(ThreadContext *old_context)
809 // some things should already be set up
811 assert(getSystemPtr() == old_context->getSystemPtr());
813 assert(getProcessPtr() == old_context->getProcessPtr());
816 // copy over functional state
817 setStatus(old_context->status());
818 copyArchRegs(old_context);
819 setCpuId(old_context->readCpuId());
822 setFuncExeInst(old_context->readFuncExeInst());
824 EndQuiesceEvent *other_quiesce = old_context->getQuiesceEvent();
826 // Point the quiesce event's TC at this TC so that it wakes up
828 other_quiesce->tc = this;
830 if (thread->quiesceEvent) {
831 thread->quiesceEvent->tc = this;
834 thread->kernelStats = old_context->getKernelStats();
835 // storeCondFailures = 0;
836 cpu->lockFlag = false;
839 old_context->setStatus(ThreadContext::Unallocated);
842 template <class Impl>
844 OzoneCPU<Impl>::OzoneTC::regStats(const std::string &name)
847 thread->kernelStats = new Kernel::Statistics(cpu->system);
848 thread->kernelStats->regStats(name + ".kern");
852 template <class Impl>
854 OzoneCPU<Impl>::OzoneTC::serialize(std::ostream &os)
857 template <class Impl>
859 OzoneCPU<Impl>::OzoneTC::unserialize(Checkpoint *cp, const std::string §ion)
863 template <class Impl>
865 OzoneCPU<Impl>::OzoneTC::getQuiesceEvent()
867 return thread->quiesceEvent;
870 template <class Impl>
872 OzoneCPU<Impl>::OzoneTC::readLastActivate()
874 return thread->lastActivate;
877 template <class Impl>
879 OzoneCPU<Impl>::OzoneTC::readLastSuspend()
881 return thread->lastSuspend;
884 template <class Impl>
886 OzoneCPU<Impl>::OzoneTC::profileClear()
889 thread->profile->clear();
892 template <class Impl>
894 OzoneCPU<Impl>::OzoneTC::profileSample()
897 thread->profile->sample(thread->profileNode, thread->profilePC);
901 template <class Impl>
903 OzoneCPU<Impl>::OzoneTC::getThreadNum()
905 return thread->readTid();
908 // Also somewhat obnoxious. Really only used for the TLB fault.
909 template <class Impl>
911 OzoneCPU<Impl>::OzoneTC::getInst()
913 return thread->getInst();
916 template <class Impl>
918 OzoneCPU<Impl>::OzoneTC::copyArchRegs(ThreadContext *tc)
920 thread->PC = tc->readPC();
921 thread->nextPC = tc->readNextPC();
923 cpu->frontEnd->setPC(thread->PC);
924 cpu->frontEnd->setNextPC(thread->nextPC);
926 for (int i = 0; i < TheISA::TotalNumRegs; ++i) {
927 if (i < TheISA::FP_Base_DepTag) {
928 thread->renameTable[i]->setIntResult(tc->readIntReg(i));
929 } else if (i < (TheISA::FP_Base_DepTag + TheISA::NumFloatRegs)) {
930 int fp_idx = i - TheISA::FP_Base_DepTag;
931 thread->renameTable[i]->setDoubleResult(
932 tc->readFloatReg(fp_idx, 64));
937 thread->funcExeInst = tc->readFuncExeInst();
940 // Need to copy the TC values into the current rename table,
941 // copy the misc regs.
942 copyMiscRegs(tc, this);
945 template <class Impl>
947 OzoneCPU<Impl>::OzoneTC::clearArchRegs()
949 panic("Unimplemented!");
952 template <class Impl>
954 OzoneCPU<Impl>::OzoneTC::readIntReg(int reg_idx)
956 return thread->renameTable[reg_idx]->readIntResult();
959 template <class Impl>
961 OzoneCPU<Impl>::OzoneTC::readFloatReg(int reg_idx, int width)
963 int idx = reg_idx + TheISA::FP_Base_DepTag;
966 return thread->renameTable[idx]->readFloatResult();
968 return thread->renameTable[idx]->readDoubleResult();
970 panic("Unsupported width!");
975 template <class Impl>
977 OzoneCPU<Impl>::OzoneTC::readFloatReg(int reg_idx)
979 int idx = reg_idx + TheISA::FP_Base_DepTag;
980 return thread->renameTable[idx]->readFloatResult();
983 template <class Impl>
985 OzoneCPU<Impl>::OzoneTC::readFloatRegBits(int reg_idx, int width)
987 int idx = reg_idx + TheISA::FP_Base_DepTag;
988 return thread->renameTable[idx]->readIntResult();
991 template <class Impl>
993 OzoneCPU<Impl>::OzoneTC::readFloatRegBits(int reg_idx)
995 int idx = reg_idx + TheISA::FP_Base_DepTag;
996 return thread->renameTable[idx]->readIntResult();
999 template <class Impl>
1001 OzoneCPU<Impl>::OzoneTC::setIntReg(int reg_idx, uint64_t val)
1003 thread->renameTable[reg_idx]->setIntResult(val);
1005 if (!thread->inSyscall) {
1006 cpu->squashFromTC();
1010 template <class Impl>
1012 OzoneCPU<Impl>::OzoneTC::setFloatReg(int reg_idx, FloatReg val, int width)
1014 int idx = reg_idx + TheISA::FP_Base_DepTag;
1017 panic("Unimplemented!");
1020 thread->renameTable[idx]->setDoubleResult(val);
1023 panic("Unsupported width!");
1026 if (!thread->inSyscall) {
1027 cpu->squashFromTC();
1031 template <class Impl>
1033 OzoneCPU<Impl>::OzoneTC::setFloatReg(int reg_idx, FloatReg val)
1035 int idx = reg_idx + TheISA::FP_Base_DepTag;
1037 thread->renameTable[idx]->setDoubleResult(val);
1039 if (!thread->inSyscall) {
1040 cpu->squashFromTC();
1044 template <class Impl>
1046 OzoneCPU<Impl>::OzoneTC::setFloatRegBits(int reg_idx, FloatRegBits val,
1049 panic("Unimplemented!");
1052 template <class Impl>
1054 OzoneCPU<Impl>::OzoneTC::setFloatRegBits(int reg_idx, FloatRegBits val)
1056 panic("Unimplemented!");
1059 template <class Impl>
1061 OzoneCPU<Impl>::OzoneTC::setPC(Addr val)
1064 cpu->frontEnd->setPC(val);
1066 if (!thread->inSyscall) {
1067 cpu->squashFromTC();
1071 template <class Impl>
1073 OzoneCPU<Impl>::OzoneTC::setNextPC(Addr val)
1075 thread->nextPC = val;
1076 cpu->frontEnd->setNextPC(val);
1078 if (!thread->inSyscall) {
1079 cpu->squashFromTC();
1083 template <class Impl>
1085 OzoneCPU<Impl>::OzoneTC::readMiscReg(int misc_reg)
1087 return thread->miscRegFile.readReg(misc_reg);
1090 template <class Impl>
1092 OzoneCPU<Impl>::OzoneTC::readMiscRegWithEffect(int misc_reg, Fault &fault)
1094 return thread->miscRegFile.readRegWithEffect(misc_reg,
1098 template <class Impl>
1100 OzoneCPU<Impl>::OzoneTC::setMiscReg(int misc_reg, const MiscReg &val)
1102 // Needs to setup a squash event unless we're in syscall mode
1103 Fault ret_fault = thread->miscRegFile.setReg(misc_reg, val);
1105 if (!thread->inSyscall) {
1106 cpu->squashFromTC();
1112 template <class Impl>
1114 OzoneCPU<Impl>::OzoneTC::setMiscRegWithEffect(int misc_reg, const MiscReg &val)
1116 // Needs to setup a squash event unless we're in syscall mode
1117 Fault ret_fault = thread->miscRegFile.setRegWithEffect(misc_reg, val,
1120 if (!thread->inSyscall) {
1121 cpu->squashFromTC();