2 * Copyright (c) 2007 MIPS Technologies, Inc.
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.
28 * Authors: Korey Sewell
34 #include "arch/utility.hh"
35 #include "base/bigint.hh"
36 #include "config/full_system.hh"
37 #include "config/the_isa.hh"
38 #include "cpu/inorder/resources/resource_list.hh"
39 #include "cpu/inorder/cpu.hh"
40 #include "cpu/inorder/first_stage.hh"
41 #include "cpu/inorder/inorder_dyn_inst.hh"
42 #include "cpu/inorder/pipeline_traits.hh"
43 #include "cpu/inorder/resource_pool.hh"
44 #include "cpu/inorder/thread_context.hh"
45 #include "cpu/inorder/thread_state.hh"
46 #include "cpu/activity.hh"
47 #include "cpu/base.hh"
48 #include "cpu/exetrace.hh"
49 #include "cpu/simple_thread.hh"
50 #include "cpu/thread_context.hh"
51 #include "debug/Activity.hh"
52 #include "debug/InOrderCPU.hh"
53 #include "debug/RefCount.hh"
54 #include "debug/SkedCache.hh"
55 #include "mem/translating_port.hh"
56 #include "params/InOrderCPU.hh"
57 #include "sim/process.hh"
58 #include "sim/stat_control.hh"
61 #include "cpu/quiesce_event.hh"
62 #include "sim/system.hh"
65 #if THE_ISA == ALPHA_ISA
66 #include "arch/alpha/osfpal.hh"
70 using namespace TheISA
;
71 using namespace ThePipeline
;
73 InOrderCPU::TickEvent::TickEvent(InOrderCPU
*c
)
74 : Event(CPU_Tick_Pri
), cpu(c
)
79 InOrderCPU::TickEvent::process()
86 InOrderCPU::TickEvent::description()
88 return "InOrderCPU tick event";
91 InOrderCPU::CPUEvent::CPUEvent(InOrderCPU
*_cpu
, CPUEventType e_type
,
92 Fault fault
, ThreadID _tid
, DynInstPtr inst
,
93 CPUEventPri event_pri
)
94 : Event(event_pri
), cpu(_cpu
)
96 setEvent(e_type
, fault
, _tid
, inst
);
100 std::string
InOrderCPU::eventNames
[NumCPUEvents
] =
103 "ActivateNextReadyThread",
109 "SquashFromMemStall",
114 InOrderCPU::CPUEvent::process()
116 switch (cpuEventType
)
119 cpu
->activateThread(tid
);
120 cpu
->resPool
->activateThread(tid
);
123 case ActivateNextReadyThread
:
124 cpu
->activateNextReadyThread();
127 case DeactivateThread
:
128 cpu
->deactivateThread(tid
);
129 cpu
->resPool
->deactivateThread(tid
);
133 cpu
->haltThread(tid
);
134 cpu
->resPool
->deactivateThread(tid
);
138 cpu
->suspendThread(tid
);
139 cpu
->resPool
->suspendThread(tid
);
142 case SquashFromMemStall
:
143 cpu
->squashDueToMemStall(inst
->squashingStage
, inst
->seqNum
, tid
);
144 cpu
->resPool
->squashDueToMemStall(inst
, inst
->squashingStage
,
149 DPRINTF(InOrderCPU
, "Trapping CPU\n");
150 cpu
->trap(fault
, tid
, inst
);
151 cpu
->resPool
->trap(fault
, tid
, inst
);
155 fatal("Unrecognized Event Type %s", eventNames
[cpuEventType
]);
158 cpu
->cpuEventRemoveList
.push(this);
164 InOrderCPU::CPUEvent::description()
166 return "InOrderCPU event";
170 InOrderCPU::CPUEvent::scheduleEvent(int delay
)
172 assert(!scheduled() || squashed());
173 cpu
->reschedule(this, cpu
->nextCycle(curTick() + cpu
->ticks(delay
)), true);
177 InOrderCPU::CPUEvent::unscheduleEvent()
183 InOrderCPU::InOrderCPU(Params
*params
)
185 cpu_id(params
->cpu_id
),
189 stageWidth(params
->stageWidth
),
191 removeInstsThisCycle(false),
192 activityRec(params
->name
, NumStages
, 10, params
->activity
),
194 system(params
->system
),
195 physmem(system
->physmem
),
196 #endif // FULL_SYSTEM
202 deferRegistration(false/*params->deferRegistration*/),
203 stageTracing(params
->stageTracing
),
206 ThreadID active_threads
;
209 resPool
= new ResourcePool(this, params
);
211 // Resize for Multithreading CPUs
212 thread
.resize(numThreads
);
217 active_threads
= params
->workload
.size();
219 if (active_threads
> MaxThreads
) {
220 panic("Workload Size too large. Increase the 'MaxThreads'"
221 "in your InOrder implementation or "
222 "edit your workload size.");
226 if (active_threads
> 1) {
227 threadModel
= (InOrderCPU::ThreadModel
) params
->threadModel
;
229 if (threadModel
== SMT
) {
230 DPRINTF(InOrderCPU
, "Setting Thread Model to SMT.\n");
231 } else if (threadModel
== SwitchOnCacheMiss
) {
232 DPRINTF(InOrderCPU
, "Setting Thread Model to "
233 "Switch On Cache Miss\n");
237 threadModel
= Single
;
244 // Bind the fetch & data ports from the resource pool.
245 fetchPortIdx
= resPool
->getPortIdx(params
->fetchMemPort
);
246 if (fetchPortIdx
== 0) {
247 fatal("Unable to find port to fetch instructions from.\n");
250 dataPortIdx
= resPool
->getPortIdx(params
->dataMemPort
);
251 if (dataPortIdx
== 0) {
252 fatal("Unable to find port for data.\n");
255 for (ThreadID tid
= 0; tid
< numThreads
; ++tid
) {
257 // SMT is not supported in FS mode yet.
258 assert(numThreads
== 1);
259 thread
[tid
] = new Thread(this, 0);
261 if (tid
< (ThreadID
)params
->workload
.size()) {
262 DPRINTF(InOrderCPU
, "Workload[%i] process is %#x\n",
263 tid
, params
->workload
[tid
]->prog_fname
);
265 new Thread(this, tid
, params
->workload
[tid
]);
267 //Allocate Empty thread so M5 can use later
268 //when scheduling threads to CPU
269 Process
* dummy_proc
= params
->workload
[0];
270 thread
[tid
] = new Thread(this, tid
, dummy_proc
);
273 // Eventually set this with parameters...
277 // Setup the TC that will serve as the interface to the threads/CPU.
278 InOrderThreadContext
*tc
= new InOrderThreadContext
;
280 tc
->thread
= thread
[tid
];
282 // Give the thread the TC.
283 thread
[tid
]->tc
= tc
;
284 thread
[tid
]->setFuncExeInst(0);
285 globalSeqNum
[tid
] = 1;
287 // Add the TC to the CPU's list of TC's.
288 this->threadContexts
.push_back(tc
);
291 // Initialize TimeBuffer Stage Queues
292 for (int stNum
=0; stNum
< NumStages
- 1; stNum
++) {
293 stageQueue
[stNum
] = new StageQueue(NumStages
, NumStages
);
294 stageQueue
[stNum
]->id(stNum
);
298 // Set Up Pipeline Stages
299 for (int stNum
=0; stNum
< NumStages
; stNum
++) {
301 pipelineStage
[stNum
] = new FirstStage(params
, stNum
);
303 pipelineStage
[stNum
] = new PipelineStage(params
, stNum
);
305 pipelineStage
[stNum
]->setCPU(this);
306 pipelineStage
[stNum
]->setActiveThreads(&activeThreads
);
307 pipelineStage
[stNum
]->setTimeBuffer(&timeBuffer
);
309 // Take Care of 1st/Nth stages
311 pipelineStage
[stNum
]->setPrevStageQueue(stageQueue
[stNum
- 1]);
312 if (stNum
< NumStages
- 1)
313 pipelineStage
[stNum
]->setNextStageQueue(stageQueue
[stNum
]);
316 // Initialize thread specific variables
317 for (ThreadID tid
= 0; tid
< numThreads
; tid
++) {
318 archRegDepMap
[tid
].setCPU(this);
320 nonSpecInstActive
[tid
] = false;
321 nonSpecSeqNum
[tid
] = 0;
323 squashSeqNum
[tid
] = MaxAddr
;
324 lastSquashCycle
[tid
] = 0;
326 memset(intRegs
[tid
], 0, sizeof(intRegs
[tid
]));
327 memset(floatRegs
.i
[tid
], 0, sizeof(floatRegs
.i
[tid
]));
330 // Define dummy instructions and resource requests to be used.
331 dummyInst
[tid
] = new InOrderDynInst(this,
337 dummyReq
[tid
] = new ResourceRequest(resPool
->getResource(0));
340 dummyReqInst
= new InOrderDynInst(this, NULL
, 0, 0, 0);
341 dummyReqInst
->setSquashed();
342 dummyReqInst
->resetInstCount();
344 dummyBufferInst
= new InOrderDynInst(this, NULL
, 0, 0, 0);
345 dummyBufferInst
->setSquashed();
346 dummyBufferInst
->resetInstCount();
348 endOfSkedIt
= skedCache
.end();
349 frontEndSked
= createFrontEndSked();
351 lastRunningCycle
= curTick();
353 // Reset CPU to reset state.
355 Fault resetFault
= new ResetFault();
356 resetFault
->invoke(tcBase());
360 // Schedule First Tick Event, CPU will reschedule itself from here on out.
361 scheduleTickEvent(0);
364 InOrderCPU::~InOrderCPU()
368 SkedCacheIt sked_it
= skedCache
.begin();
369 SkedCacheIt sked_end
= skedCache
.end();
371 while (sked_it
!= sked_end
) {
372 delete (*sked_it
).second
;
378 m5::hash_map
<InOrderCPU::SkedID
, ThePipeline::RSkedPtr
> InOrderCPU::skedCache
;
381 InOrderCPU::createFrontEndSked()
383 RSkedPtr res_sked
= new ResourceSked();
385 StageScheduler
F(res_sked
, stage_num
++);
386 StageScheduler
D(res_sked
, stage_num
++);
389 F
.needs(FetchSeq
, FetchSeqUnit::AssignNextPC
);
390 F
.needs(ICache
, FetchUnit::InitiateFetch
);
393 D
.needs(ICache
, FetchUnit::CompleteFetch
);
394 D
.needs(Decode
, DecodeUnit::DecodeInst
);
395 D
.needs(BPred
, BranchPredictor::PredictBranch
);
396 D
.needs(FetchSeq
, FetchSeqUnit::UpdateTargetPC
);
399 DPRINTF(SkedCache
, "Resource Sked created for instruction \"front_end\"\n");
405 InOrderCPU::createBackEndSked(DynInstPtr inst
)
407 RSkedPtr res_sked
= lookupSked(inst
);
408 if (res_sked
!= NULL
) {
409 DPRINTF(SkedCache
, "Found %s in sked cache.\n",
413 res_sked
= new ResourceSked();
416 int stage_num
= ThePipeline::BackEndStartStage
;
417 StageScheduler
X(res_sked
, stage_num
++);
418 StageScheduler
M(res_sked
, stage_num
++);
419 StageScheduler
W(res_sked
, stage_num
++);
421 if (!inst
->staticInst
) {
422 warn_once("Static Instruction Object Not Set. Can't Create"
423 " Back End Schedule");
428 X
.needs(RegManager
, UseDefUnit::MarkDestRegs
);
429 for (int idx
=0; idx
< inst
->numSrcRegs(); idx
++) {
430 if (!idx
|| !inst
->isStore()) {
431 X
.needs(RegManager
, UseDefUnit::ReadSrcReg
, idx
);
435 //@todo: schedule non-spec insts to operate on this cycle
436 // as long as all previous insts are done
437 if ( inst
->isNonSpeculative() ) {
438 // skip execution of non speculative insts until later
439 } else if ( inst
->isMemRef() ) {
440 if ( inst
->isLoad() ) {
441 X
.needs(AGEN
, AGENUnit::GenerateAddr
);
443 } else if (inst
->opClass() == IntMultOp
|| inst
->opClass() == IntDivOp
) {
444 X
.needs(MDU
, MultDivUnit::StartMultDiv
);
446 X
.needs(ExecUnit
, ExecutionUnit::ExecuteInst
);
450 if (!inst
->isNonSpeculative()) {
451 if (inst
->opClass() == IntMultOp
|| inst
->opClass() == IntDivOp
) {
452 M
.needs(MDU
, MultDivUnit::EndMultDiv
);
455 if ( inst
->isLoad() ) {
456 M
.needs(DCache
, CacheUnit::InitiateReadData
);
458 M
.needs(DCache
, CacheUnit::InitSecondSplitRead
);
459 } else if ( inst
->isStore() ) {
460 for (int i
= 1; i
< inst
->numSrcRegs(); i
++ ) {
461 M
.needs(RegManager
, UseDefUnit::ReadSrcReg
, i
);
463 M
.needs(AGEN
, AGENUnit::GenerateAddr
);
464 M
.needs(DCache
, CacheUnit::InitiateWriteData
);
466 M
.needs(DCache
, CacheUnit::InitSecondSplitWrite
);
471 if (!inst
->isNonSpeculative()) {
472 if ( inst
->isLoad() ) {
473 W
.needs(DCache
, CacheUnit::CompleteReadData
);
475 W
.needs(DCache
, CacheUnit::CompleteSecondSplitRead
);
476 } else if ( inst
->isStore() ) {
477 W
.needs(DCache
, CacheUnit::CompleteWriteData
);
479 W
.needs(DCache
, CacheUnit::CompleteSecondSplitWrite
);
482 // Finally, Execute Speculative Data
483 if (inst
->isMemRef()) {
484 if (inst
->isLoad()) {
485 W
.needs(AGEN
, AGENUnit::GenerateAddr
);
486 W
.needs(DCache
, CacheUnit::InitiateReadData
);
488 W
.needs(DCache
, CacheUnit::InitSecondSplitRead
);
489 W
.needs(DCache
, CacheUnit::CompleteReadData
);
491 W
.needs(DCache
, CacheUnit::CompleteSecondSplitRead
);
492 } else if (inst
->isStore()) {
493 if ( inst
->numSrcRegs() >= 2 ) {
494 W
.needs(RegManager
, UseDefUnit::ReadSrcReg
, 1);
496 W
.needs(AGEN
, AGENUnit::GenerateAddr
);
497 W
.needs(DCache
, CacheUnit::InitiateWriteData
);
499 W
.needs(DCache
, CacheUnit::InitSecondSplitWrite
);
500 W
.needs(DCache
, CacheUnit::CompleteWriteData
);
502 W
.needs(DCache
, CacheUnit::CompleteSecondSplitWrite
);
505 W
.needs(ExecUnit
, ExecutionUnit::ExecuteInst
);
509 W
.needs(Grad
, GraduationUnit::GraduateInst
);
511 for (int idx
=0; idx
< inst
->numDestRegs(); idx
++) {
512 W
.needs(RegManager
, UseDefUnit::WriteDestReg
, idx
);
515 if (inst
->isControl())
516 W
.needs(BPred
, BranchPredictor::UpdatePredictor
);
518 // Insert Back Schedule into our cache of
519 // resource schedules
520 addToSkedCache(inst
, res_sked
);
522 DPRINTF(SkedCache
, "Back End Sked Created for instruction: %s (%08p)\n",
523 inst
->instName(), inst
->getMachInst());
530 InOrderCPU::regStats()
532 /* Register the Resource Pool's stats here.*/
535 /* Register for each Pipeline Stage */
536 for (int stage_num
=0; stage_num
< ThePipeline::NumStages
; stage_num
++) {
537 pipelineStage
[stage_num
]->regStats();
540 /* Register any of the InOrderCPU's stats here.*/
542 .name(name() + ".instsPerContextSwitch")
543 .desc("Instructions Committed Per Context Switch")
544 .prereq(instsPerCtxtSwitch
);
547 .name(name() + ".contextSwitches")
548 .desc("Number of context switches");
551 .name(name() + ".comLoads")
552 .desc("Number of Load instructions committed");
555 .name(name() + ".comStores")
556 .desc("Number of Store instructions committed");
559 .name(name() + ".comBranches")
560 .desc("Number of Branches instructions committed");
563 .name(name() + ".comNops")
564 .desc("Number of Nop instructions committed");
567 .name(name() + ".comNonSpec")
568 .desc("Number of Non-Speculative instructions committed");
571 .name(name() + ".comInts")
572 .desc("Number of Integer instructions committed");
575 .name(name() + ".comFloats")
576 .desc("Number of Floating Point instructions committed");
579 .name(name() + ".timesIdled")
580 .desc("Number of times that the entire CPU went into an idle state and"
581 " unscheduled itself")
585 .name(name() + ".idleCycles")
586 .desc("Number of cycles cpu's stages were not processed");
589 .name(name() + ".runCycles")
590 .desc("Number of cycles cpu stages are processed.");
593 .name(name() + ".activity")
594 .desc("Percentage of cycles cpu is active")
596 activity
= (runCycles
/ numCycles
) * 100;
600 .name(name() + ".threadCycles")
601 .desc("Total Number of Cycles A Thread Was Active in CPU (Per-Thread)");
604 .name(name() + ".smtCycles")
605 .desc("Total number of cycles that the CPU was in SMT-mode");
609 .name(name() + ".committedInsts")
610 .desc("Number of Instructions Simulated (Per-Thread)");
614 .name(name() + ".smtCommittedInsts")
615 .desc("Number of SMT Instructions Simulated (Per-Thread)");
618 .name(name() + ".committedInsts_total")
619 .desc("Number of Instructions Simulated (Total)");
622 .name(name() + ".cpi")
623 .desc("CPI: Cycles Per Instruction (Per-Thread)")
625 cpi
= numCycles
/ committedInsts
;
628 .name(name() + ".smt_cpi")
629 .desc("CPI: Total SMT-CPI")
631 smtCpi
= smtCycles
/ smtCommittedInsts
;
634 .name(name() + ".cpi_total")
635 .desc("CPI: Total CPI of All Threads")
637 totalCpi
= numCycles
/ totalCommittedInsts
;
640 .name(name() + ".ipc")
641 .desc("IPC: Instructions Per Cycle (Per-Thread)")
643 ipc
= committedInsts
/ numCycles
;
646 .name(name() + ".smt_ipc")
647 .desc("IPC: Total SMT-IPC")
649 smtIpc
= smtCommittedInsts
/ smtCycles
;
652 .name(name() + ".ipc_total")
653 .desc("IPC: Total IPC of All Threads")
655 totalIpc
= totalCommittedInsts
/ numCycles
;
664 DPRINTF(InOrderCPU
, "\n\nInOrderCPU: Ticking main, InOrderCPU.\n");
668 bool pipes_idle
= true;
670 //Tick each of the stages
671 for (int stNum
=NumStages
- 1; stNum
>= 0 ; stNum
--) {
672 pipelineStage
[stNum
]->tick();
674 pipes_idle
= pipes_idle
&& pipelineStage
[stNum
]->idle
;
682 // Now advance the time buffers one tick
683 timeBuffer
.advance();
684 for (int sqNum
=0; sqNum
< NumStages
- 1; sqNum
++) {
685 stageQueue
[sqNum
]->advance();
687 activityRec
.advance();
689 // Any squashed events, or insts then remove them now
690 cleanUpRemovedEvents();
691 cleanUpRemovedInsts();
693 // Re-schedule CPU for this cycle
694 if (!tickEvent
.scheduled()) {
695 if (_status
== SwitchedOut
) {
697 lastRunningCycle
= curTick();
698 } else if (!activityRec
.active()) {
699 DPRINTF(InOrderCPU
, "sleeping CPU.\n");
700 lastRunningCycle
= curTick();
703 //Tick next_tick = curTick() + cycles(1);
704 //tickEvent.schedule(next_tick);
705 schedule(&tickEvent
, nextCycle(curTick() + 1));
706 DPRINTF(InOrderCPU
, "Scheduled CPU for next tick @ %i.\n",
707 nextCycle(curTick() + 1));
712 updateThreadPriority();
719 if (!deferRegistration
) {
720 registerThreadContexts();
723 // Set inSyscall so that the CPU doesn't squash when initially
724 // setting up registers.
725 for (ThreadID tid
= 0; tid
< numThreads
; ++tid
)
726 thread
[tid
]->inSyscall
= true;
729 for (ThreadID tid
= 0; tid
< numThreads
; tid
++) {
730 ThreadContext
*src_tc
= threadContexts
[tid
];
731 TheISA::initCPU(src_tc
, src_tc
->contextId());
736 for (ThreadID tid
= 0; tid
< numThreads
; ++tid
)
737 thread
[tid
]->inSyscall
= false;
739 // Call Initializiation Routine for Resource Pool
744 InOrderCPU::getPort(const std::string
&if_name
, int idx
)
746 return resPool
->getPort(if_name
, idx
);
751 InOrderCPU::hwrei(ThreadID tid
)
753 panic("hwrei: Unimplemented");
760 InOrderCPU::simPalCheck(int palFunc
, ThreadID tid
)
762 panic("simPalCheck: Unimplemented");
769 InOrderCPU::getInterrupts()
771 // Check if there are any outstanding interrupts
772 return interrupts
->getInterrupt(threadContexts
[0]);
777 InOrderCPU::processInterrupts(Fault interrupt
)
779 // Check for interrupts here. For now can copy the code that
780 // exists within isa_fullsys_traits.hh. Also assume that thread 0
781 // is the one that handles the interrupts.
782 // @todo: Possibly consolidate the interrupt checking code.
783 // @todo: Allow other threads to handle interrupts.
785 assert(interrupt
!= NoFault
);
786 interrupts
->updateIntrInfo(threadContexts
[0]);
788 DPRINTF(InOrderCPU
, "Interrupt %s being handled\n", interrupt
->name());
790 // Note: Context ID ok here? Impl. of FS mode needs to revisit this
791 trap(interrupt
, threadContexts
[0]->contextId(), dummyBufferInst
);
796 InOrderCPU::updateMemPorts()
798 // Update all ThreadContext's memory ports (Functional/Virtual
800 ThreadID size
= thread
.size();
801 for (ThreadID i
= 0; i
< size
; ++i
)
802 thread
[i
]->connectMemPorts(thread
[i
]->getTC());
807 InOrderCPU::trapContext(Fault fault
, ThreadID tid
, DynInstPtr inst
, int delay
)
809 scheduleCpuEvent(Trap
, fault
, tid
, inst
, delay
);
813 InOrderCPU::trap(Fault fault
, ThreadID tid
, DynInstPtr inst
)
815 fault
->invoke(tcBase(tid
), inst
->staticInst
);
819 InOrderCPU::squashFromMemStall(DynInstPtr inst
, ThreadID tid
, int delay
)
821 scheduleCpuEvent(SquashFromMemStall
, NoFault
, tid
, inst
, delay
);
826 InOrderCPU::squashDueToMemStall(int stage_num
, InstSeqNum seq_num
,
829 DPRINTF(InOrderCPU
, "Squashing Pipeline Stages Due to Memory Stall...\n");
831 // Squash all instructions in each stage including
832 // instruction that caused the squash (seq_num - 1)
833 // NOTE: The stage bandwidth needs to be cleared so thats why
834 // the stalling instruction is squashed as well. The stalled
835 // instruction is previously placed in another intermediate buffer
836 // while it's stall is being handled.
837 InstSeqNum squash_seq_num
= seq_num
- 1;
839 for (int stNum
=stage_num
; stNum
>= 0 ; stNum
--) {
840 pipelineStage
[stNum
]->squashDueToMemStall(squash_seq_num
, tid
);
845 InOrderCPU::scheduleCpuEvent(CPUEventType c_event
, Fault fault
,
846 ThreadID tid
, DynInstPtr inst
,
847 unsigned delay
, CPUEventPri event_pri
)
849 CPUEvent
*cpu_event
= new CPUEvent(this, c_event
, fault
, tid
, inst
,
852 Tick sked_tick
= nextCycle(curTick() + ticks(delay
));
854 DPRINTF(InOrderCPU
, "Scheduling CPU Event (%s) for cycle %i, [tid:%i].\n",
855 eventNames
[c_event
], curTick() + delay
, tid
);
856 schedule(cpu_event
, sked_tick
);
858 cpu_event
->process();
859 cpuEventRemoveList
.push(cpu_event
);
862 // Broadcast event to the Resource Pool
863 // Need to reset tid just in case this is a dummy instruction
865 resPool
->scheduleEvent(c_event
, inst
, 0, 0, tid
);
869 InOrderCPU::isThreadActive(ThreadID tid
)
871 list
<ThreadID
>::iterator isActive
=
872 std::find(activeThreads
.begin(), activeThreads
.end(), tid
);
874 return (isActive
!= activeThreads
.end());
878 InOrderCPU::isThreadReady(ThreadID tid
)
880 list
<ThreadID
>::iterator isReady
=
881 std::find(readyThreads
.begin(), readyThreads
.end(), tid
);
883 return (isReady
!= readyThreads
.end());
887 InOrderCPU::isThreadSuspended(ThreadID tid
)
889 list
<ThreadID
>::iterator isSuspended
=
890 std::find(suspendedThreads
.begin(), suspendedThreads
.end(), tid
);
892 return (isSuspended
!= suspendedThreads
.end());
896 InOrderCPU::activateNextReadyThread()
898 if (readyThreads
.size() >= 1) {
899 ThreadID ready_tid
= readyThreads
.front();
901 // Activate in Pipeline
902 activateThread(ready_tid
);
904 // Activate in Resource Pool
905 resPool
->activateThread(ready_tid
);
907 list
<ThreadID
>::iterator ready_it
=
908 std::find(readyThreads
.begin(), readyThreads
.end(), ready_tid
);
909 readyThreads
.erase(ready_it
);
912 "Attempting to activate new thread, but No Ready Threads to"
915 "Unable to switch to next active thread.\n");
920 InOrderCPU::activateThread(ThreadID tid
)
922 if (isThreadSuspended(tid
)) {
924 "Removing [tid:%i] from suspended threads list.\n", tid
);
926 list
<ThreadID
>::iterator susp_it
=
927 std::find(suspendedThreads
.begin(), suspendedThreads
.end(),
929 suspendedThreads
.erase(susp_it
);
932 if (threadModel
== SwitchOnCacheMiss
&&
933 numActiveThreads() == 1) {
935 "Ignoring activation of [tid:%i], since [tid:%i] is "
936 "already running.\n", tid
, activeThreadId());
938 DPRINTF(InOrderCPU
,"Placing [tid:%i] on ready threads list\n",
941 readyThreads
.push_back(tid
);
943 } else if (!isThreadActive(tid
)) {
945 "Adding [tid:%i] to active threads list.\n", tid
);
946 activeThreads
.push_back(tid
);
948 activateThreadInPipeline(tid
);
950 thread
[tid
]->lastActivate
= curTick();
952 tcBase(tid
)->setStatus(ThreadContext::Active
);
961 InOrderCPU::activateThreadInPipeline(ThreadID tid
)
963 for (int stNum
=0; stNum
< NumStages
; stNum
++) {
964 pipelineStage
[stNum
]->activateThread(tid
);
969 InOrderCPU::deactivateContext(ThreadID tid
, int delay
)
971 DPRINTF(InOrderCPU
,"[tid:%i]: Deactivating ...\n", tid
);
973 scheduleCpuEvent(DeactivateThread
, NoFault
, tid
, dummyInst
[tid
], delay
);
975 // Be sure to signal that there's some activity so the CPU doesn't
976 // deschedule itself.
977 activityRec
.activity();
983 InOrderCPU::deactivateThread(ThreadID tid
)
985 DPRINTF(InOrderCPU
, "[tid:%i]: Calling deactivate thread.\n", tid
);
987 if (isThreadActive(tid
)) {
988 DPRINTF(InOrderCPU
,"[tid:%i]: Removing from active threads list\n",
990 list
<ThreadID
>::iterator thread_it
=
991 std::find(activeThreads
.begin(), activeThreads
.end(), tid
);
993 removePipelineStalls(*thread_it
);
995 activeThreads
.erase(thread_it
);
997 // Ideally, this should be triggered from the
998 // suspendContext/Thread functions
999 tcBase(tid
)->setStatus(ThreadContext::Suspended
);
1002 assert(!isThreadActive(tid
));
1006 InOrderCPU::removePipelineStalls(ThreadID tid
)
1008 DPRINTF(InOrderCPU
,"[tid:%i]: Removing all pipeline stalls\n",
1011 for (int stNum
= 0; stNum
< NumStages
; stNum
++) {
1012 pipelineStage
[stNum
]->removeStalls(tid
);
1018 InOrderCPU::updateThreadPriority()
1020 if (activeThreads
.size() > 1)
1022 //DEFAULT TO ROUND ROBIN SCHEME
1023 //e.g. Move highest priority to end of thread list
1024 list
<ThreadID
>::iterator list_begin
= activeThreads
.begin();
1025 list
<ThreadID
>::iterator list_end
= activeThreads
.end();
1027 unsigned high_thread
= *list_begin
;
1029 activeThreads
.erase(list_begin
);
1031 activeThreads
.push_back(high_thread
);
1036 InOrderCPU::tickThreadStats()
1038 /** Keep track of cycles that each thread is active */
1039 list
<ThreadID
>::iterator thread_it
= activeThreads
.begin();
1040 while (thread_it
!= activeThreads
.end()) {
1041 threadCycles
[*thread_it
]++;
1045 // Keep track of cycles where SMT is active
1046 if (activeThreads
.size() > 1) {
1052 InOrderCPU::activateContext(ThreadID tid
, int delay
)
1054 DPRINTF(InOrderCPU
,"[tid:%i]: Activating ...\n", tid
);
1057 scheduleCpuEvent(ActivateThread
, NoFault
, tid
, dummyInst
[tid
], delay
);
1059 // Be sure to signal that there's some activity so the CPU doesn't
1060 // deschedule itself.
1061 activityRec
.activity();
1067 InOrderCPU::activateNextReadyContext(int delay
)
1069 DPRINTF(InOrderCPU
,"Activating next ready thread\n");
1071 // NOTE: Add 5 to the event priority so that we always activate
1072 // threads after we've finished deactivating, squashing,etc.
1074 scheduleCpuEvent(ActivateNextReadyThread
, NoFault
, 0/*tid*/, dummyInst
[0],
1075 delay
, ActivateNextReadyThread_Pri
);
1077 // Be sure to signal that there's some activity so the CPU doesn't
1078 // deschedule itself.
1079 activityRec
.activity();
1085 InOrderCPU::haltContext(ThreadID tid
, int delay
)
1087 DPRINTF(InOrderCPU
, "[tid:%i]: Calling Halt Context...\n", tid
);
1089 scheduleCpuEvent(HaltThread
, NoFault
, tid
, dummyInst
[tid
], delay
);
1091 activityRec
.activity();
1095 InOrderCPU::haltThread(ThreadID tid
)
1097 DPRINTF(InOrderCPU
, "[tid:%i]: Placing on Halted Threads List...\n", tid
);
1098 deactivateThread(tid
);
1099 squashThreadInPipeline(tid
);
1100 haltedThreads
.push_back(tid
);
1102 tcBase(tid
)->setStatus(ThreadContext::Halted
);
1104 if (threadModel
== SwitchOnCacheMiss
) {
1105 activateNextReadyContext();
1110 InOrderCPU::suspendContext(ThreadID tid
, int delay
)
1112 scheduleCpuEvent(SuspendThread
, NoFault
, tid
, dummyInst
[tid
], delay
);
1116 InOrderCPU::suspendThread(ThreadID tid
)
1118 DPRINTF(InOrderCPU
, "[tid:%i]: Placing on Suspended Threads List...\n",
1120 deactivateThread(tid
);
1121 suspendedThreads
.push_back(tid
);
1122 thread
[tid
]->lastSuspend
= curTick();
1124 tcBase(tid
)->setStatus(ThreadContext::Suspended
);
1128 InOrderCPU::squashThreadInPipeline(ThreadID tid
)
1130 //Squash all instructions in each stage
1131 for (int stNum
=NumStages
- 1; stNum
>= 0 ; stNum
--) {
1132 pipelineStage
[stNum
]->squash(0 /*seq_num*/, tid
);
1137 InOrderCPU::getPipeStage(int stage_num
)
1139 return pipelineStage
[stage_num
];
1144 InOrderCPU::flattenRegIdx(RegIndex reg_idx
, RegType
®_type
, ThreadID tid
)
1146 if (reg_idx
< FP_Base_DepTag
) {
1148 return isa
[tid
].flattenIntIndex(reg_idx
);
1149 } else if (reg_idx
< Ctrl_Base_DepTag
) {
1150 reg_type
= FloatType
;
1151 reg_idx
-= FP_Base_DepTag
;
1152 return isa
[tid
].flattenFloatIndex(reg_idx
);
1154 reg_type
= MiscType
;
1155 return reg_idx
- TheISA::Ctrl_Base_DepTag
;
1160 InOrderCPU::readIntReg(RegIndex reg_idx
, ThreadID tid
)
1162 DPRINTF(IntRegs
, "[tid:%i]: Reading Int. Reg %i as %x\n",
1163 tid
, reg_idx
, intRegs
[tid
][reg_idx
]);
1165 return intRegs
[tid
][reg_idx
];
1169 InOrderCPU::readFloatReg(RegIndex reg_idx
, ThreadID tid
)
1171 return floatRegs
.f
[tid
][reg_idx
];
1175 InOrderCPU::readFloatRegBits(RegIndex reg_idx
, ThreadID tid
)
1177 return floatRegs
.i
[tid
][reg_idx
];
1181 InOrderCPU::setIntReg(RegIndex reg_idx
, uint64_t val
, ThreadID tid
)
1183 if (reg_idx
== TheISA::ZeroReg
) {
1184 DPRINTF(IntRegs
, "[tid:%i]: Ignoring Setting of ISA-ZeroReg "
1185 "(Int. Reg %i) to %x\n", tid
, reg_idx
, val
);
1188 DPRINTF(IntRegs
, "[tid:%i]: Setting Int. Reg %i to %x\n",
1191 intRegs
[tid
][reg_idx
] = val
;
1197 InOrderCPU::setFloatReg(RegIndex reg_idx
, FloatReg val
, ThreadID tid
)
1199 floatRegs
.f
[tid
][reg_idx
] = val
;
1204 InOrderCPU::setFloatRegBits(RegIndex reg_idx
, FloatRegBits val
, ThreadID tid
)
1206 floatRegs
.i
[tid
][reg_idx
] = val
;
1210 InOrderCPU::readRegOtherThread(unsigned reg_idx
, ThreadID tid
)
1212 // If Default value is set, then retrieve target thread
1213 if (tid
== InvalidThreadID
) {
1214 tid
= TheISA::getTargetThread(tcBase(tid
));
1217 if (reg_idx
< FP_Base_DepTag
) {
1218 // Integer Register File
1219 return readIntReg(reg_idx
, tid
);
1220 } else if (reg_idx
< Ctrl_Base_DepTag
) {
1221 // Float Register File
1222 reg_idx
-= FP_Base_DepTag
;
1223 return readFloatRegBits(reg_idx
, tid
);
1225 reg_idx
-= Ctrl_Base_DepTag
;
1226 return readMiscReg(reg_idx
, tid
); // Misc. Register File
1230 InOrderCPU::setRegOtherThread(unsigned reg_idx
, const MiscReg
&val
,
1233 // If Default value is set, then retrieve target thread
1234 if (tid
== InvalidThreadID
) {
1235 tid
= TheISA::getTargetThread(tcBase(tid
));
1238 if (reg_idx
< FP_Base_DepTag
) { // Integer Register File
1239 setIntReg(reg_idx
, val
, tid
);
1240 } else if (reg_idx
< Ctrl_Base_DepTag
) { // Float Register File
1241 reg_idx
-= FP_Base_DepTag
;
1242 setFloatRegBits(reg_idx
, val
, tid
);
1244 reg_idx
-= Ctrl_Base_DepTag
;
1245 setMiscReg(reg_idx
, val
, tid
); // Misc. Register File
1250 InOrderCPU::readMiscRegNoEffect(int misc_reg
, ThreadID tid
)
1252 return isa
[tid
].readMiscRegNoEffect(misc_reg
);
1256 InOrderCPU::readMiscReg(int misc_reg
, ThreadID tid
)
1258 return isa
[tid
].readMiscReg(misc_reg
, tcBase(tid
));
1262 InOrderCPU::setMiscRegNoEffect(int misc_reg
, const MiscReg
&val
, ThreadID tid
)
1264 isa
[tid
].setMiscRegNoEffect(misc_reg
, val
);
1268 InOrderCPU::setMiscReg(int misc_reg
, const MiscReg
&val
, ThreadID tid
)
1270 isa
[tid
].setMiscReg(misc_reg
, val
, tcBase(tid
));
1275 InOrderCPU::addInst(DynInstPtr inst
)
1277 ThreadID tid
= inst
->readTid();
1279 instList
[tid
].push_back(inst
);
1281 return --(instList
[tid
].end());
1285 InOrderCPU::findInst(InstSeqNum seq_num
, ThreadID tid
)
1287 ListIt it
= instList
[tid
].begin();
1288 ListIt end
= instList
[tid
].end();
1291 if ((*it
)->seqNum
== seq_num
)
1293 else if ((*it
)->seqNum
> seq_num
)
1299 return instList
[tid
].end();
1303 InOrderCPU::updateContextSwitchStats()
1305 // Set Average Stat Here, then reset to 0
1306 instsPerCtxtSwitch
= instsPerSwitch
;
1312 InOrderCPU::instDone(DynInstPtr inst
, ThreadID tid
)
1314 // Set the nextPC to be fetched if this is the last instruction
1317 // This contributes to the precise state of the CPU
1318 // which can be used when restoring a thread to the CPU after after any
1319 // type of context switching activity (fork, exception, etc.)
1320 TheISA::PCState comm_pc
= inst
->pcState();
1321 lastCommittedPC
[tid
] = comm_pc
;
1322 TheISA::advancePC(comm_pc
, inst
->staticInst
);
1323 pcState(comm_pc
, tid
);
1325 //@todo: may be unnecessary with new-ISA-specific branch handling code
1326 if (inst
->isControl()) {
1327 thread
[tid
]->lastGradIsBranch
= true;
1328 thread
[tid
]->lastBranchPC
= inst
->pcState();
1329 TheISA::advancePC(thread
[tid
]->lastBranchPC
, inst
->staticInst
);
1331 thread
[tid
]->lastGradIsBranch
= false;
1335 // Finalize Trace Data For Instruction
1336 if (inst
->traceData
) {
1337 //inst->traceData->setCycle(curTick());
1338 inst
->traceData
->setFetchSeq(inst
->seqNum
);
1339 //inst->traceData->setCPSeq(cpu->tcBase(tid)->numInst);
1340 inst
->traceData
->dump();
1341 delete inst
->traceData
;
1342 inst
->traceData
= NULL
;
1345 // Increment active thread's instruction count
1348 // Increment thread-state's instruction count
1349 thread
[tid
]->numInst
++;
1351 // Increment thread-state's instruction stats
1352 thread
[tid
]->numInsts
++;
1354 // Count committed insts per thread stats
1355 committedInsts
[tid
]++;
1357 // Count total insts committed stat
1358 totalCommittedInsts
++;
1360 // Count SMT-committed insts per thread stat
1361 if (numActiveThreads() > 1) {
1362 smtCommittedInsts
[tid
]++;
1365 // Instruction-Mix Stats
1366 if (inst
->isLoad()) {
1368 } else if (inst
->isStore()) {
1370 } else if (inst
->isControl()) {
1372 } else if (inst
->isNop()) {
1374 } else if (inst
->isNonSpeculative()) {
1376 } else if (inst
->isInteger()) {
1378 } else if (inst
->isFloating()) {
1382 // Check for instruction-count-based events.
1383 comInstEventQueue
[tid
]->serviceEvents(thread
[tid
]->numInst
);
1385 // Broadcast to other resources an instruction
1386 // has been completed
1387 resPool
->scheduleEvent((CPUEventType
)ResourcePool::InstGraduated
, inst
,
1390 // Finally, remove instruction from CPU
1394 // currently unused function, but substitute repetitive code w/this function
1397 InOrderCPU::addToRemoveList(DynInstPtr inst
)
1399 removeInstsThisCycle
= true;
1400 if (!inst
->isRemoveList()) {
1401 DPRINTF(InOrderCPU
, "Pushing instruction [tid:%i] PC %s "
1402 "[sn:%lli] to remove list\n",
1403 inst
->threadNumber
, inst
->pcState(), inst
->seqNum
);
1404 inst
->setRemoveList();
1405 removeList
.push(inst
->getInstListIt());
1407 DPRINTF(InOrderCPU
, "Ignoring instruction removal for [tid:%i] PC %s "
1408 "[sn:%lli], already remove list\n",
1409 inst
->threadNumber
, inst
->pcState(), inst
->seqNum
);
1415 InOrderCPU::removeInst(DynInstPtr inst
)
1417 DPRINTF(InOrderCPU
, "Removing graduated instruction [tid:%i] PC %s "
1419 inst
->threadNumber
, inst
->pcState(), inst
->seqNum
);
1421 removeInstsThisCycle
= true;
1423 // Remove the instruction.
1424 if (!inst
->isRemoveList()) {
1425 DPRINTF(InOrderCPU
, "Pushing instruction [tid:%i] PC %s "
1426 "[sn:%lli] to remove list\n",
1427 inst
->threadNumber
, inst
->pcState(), inst
->seqNum
);
1428 inst
->setRemoveList();
1429 removeList
.push(inst
->getInstListIt());
1431 DPRINTF(InOrderCPU
, "Ignoring instruction removal for [tid:%i] PC %s "
1432 "[sn:%lli], already on remove list\n",
1433 inst
->threadNumber
, inst
->pcState(), inst
->seqNum
);
1439 InOrderCPU::removeInstsUntil(const InstSeqNum
&seq_num
, ThreadID tid
)
1441 //assert(!instList[tid].empty());
1443 removeInstsThisCycle
= true;
1445 ListIt inst_iter
= instList
[tid
].end();
1449 DPRINTF(InOrderCPU
, "Squashing instructions from CPU instruction "
1450 "list that are from [tid:%i] and above [sn:%lli] (end=%lli).\n",
1451 tid
, seq_num
, (*inst_iter
)->seqNum
);
1453 while ((*inst_iter
)->seqNum
> seq_num
) {
1455 bool break_loop
= (inst_iter
== instList
[tid
].begin());
1457 squashInstIt(inst_iter
, tid
);
1468 InOrderCPU::squashInstIt(const ListIt inst_it
, ThreadID tid
)
1470 DynInstPtr inst
= (*inst_it
);
1471 if (inst
->threadNumber
== tid
) {
1472 DPRINTF(InOrderCPU
, "Squashing instruction, "
1473 "[tid:%i] [sn:%lli] PC %s\n",
1478 inst
->setSquashed();
1479 archRegDepMap
[tid
].remove(inst
);
1481 if (!inst
->isRemoveList()) {
1482 DPRINTF(InOrderCPU
, "Pushing instruction [tid:%i] PC %s "
1483 "[sn:%lli] to remove list\n",
1484 inst
->threadNumber
, inst
->pcState(),
1486 inst
->setRemoveList();
1487 removeList
.push(inst_it
);
1489 DPRINTF(InOrderCPU
, "Ignoring instruction removal for [tid:%i]"
1490 " PC %s [sn:%lli], already on remove list\n",
1491 inst
->threadNumber
, inst
->pcState(),
1501 InOrderCPU::cleanUpRemovedInsts()
1503 while (!removeList
.empty()) {
1504 DPRINTF(InOrderCPU
, "Removing instruction, "
1505 "[tid:%i] [sn:%lli] PC %s\n",
1506 (*removeList
.front())->threadNumber
,
1507 (*removeList
.front())->seqNum
,
1508 (*removeList
.front())->pcState());
1510 DynInstPtr inst
= *removeList
.front();
1511 ThreadID tid
= inst
->threadNumber
;
1513 // Remove From Register Dependency Map, If Necessary
1514 // archRegDepMap[tid].remove(inst);
1516 // Clear if Non-Speculative
1517 if (inst
->staticInst
&&
1518 inst
->seqNum
== nonSpecSeqNum
[tid
] &&
1519 nonSpecInstActive
[tid
] == true) {
1520 nonSpecInstActive
[tid
] = false;
1523 inst
->onInstList
= false;
1525 instList
[tid
].erase(removeList
.front());
1530 removeInstsThisCycle
= false;
1534 InOrderCPU::cleanUpRemovedEvents()
1536 while (!cpuEventRemoveList
.empty()) {
1537 Event
*cpu_event
= cpuEventRemoveList
.front();
1538 cpuEventRemoveList
.pop();
1545 InOrderCPU::dumpInsts()
1549 ListIt inst_list_it
= instList
[0].begin();
1551 cprintf("Dumping Instruction List\n");
1553 while (inst_list_it
!= instList
[0].end()) {
1554 cprintf("Instruction:%i\nPC:%s\n[tid:%i]\n[sn:%lli]\nIssued:%i\n"
1556 num
, (*inst_list_it
)->pcState(),
1557 (*inst_list_it
)->threadNumber
,
1558 (*inst_list_it
)->seqNum
, (*inst_list_it
)->isIssued(),
1559 (*inst_list_it
)->isSquashed());
1566 InOrderCPU::wakeCPU()
1568 if (/*activityRec.active() || */tickEvent
.scheduled()) {
1569 DPRINTF(Activity
, "CPU already running.\n");
1573 DPRINTF(Activity
, "Waking up CPU\n");
1575 Tick extra_cycles
= tickToCycles((curTick() - 1) - lastRunningCycle
);
1577 idleCycles
+= extra_cycles
;
1578 for (int stage_num
= 0; stage_num
< NumStages
; stage_num
++) {
1579 pipelineStage
[stage_num
]->idleCycles
+= extra_cycles
;
1582 numCycles
+= extra_cycles
;
1584 schedule(&tickEvent
, nextCycle(curTick()));
1590 InOrderCPU::wakeup()
1592 if (thread
[0]->status() != ThreadContext::Suspended
)
1597 DPRINTF(Quiesce
, "Suspended Processor woken\n");
1598 threadContexts
[0]->activate();
1604 InOrderCPU::syscall(int64_t callnum
, ThreadID tid
)
1606 DPRINTF(InOrderCPU
, "[tid:%i] Executing syscall().\n\n", tid
);
1608 DPRINTF(Activity
,"Activity: syscall() called.\n");
1610 // Temporarily increase this by one to account for the syscall
1612 ++(this->thread
[tid
]->funcExeInst
);
1614 // Execute the actual syscall.
1615 this->thread
[tid
]->syscall(callnum
);
1617 // Decrease funcExeInst by one as the normal commit will handle
1619 --(this->thread
[tid
]->funcExeInst
);
1621 // Clear Non-Speculative Block Variable
1622 nonSpecInstActive
[tid
] = false;
1627 InOrderCPU::getITBPtr()
1629 CacheUnit
*itb_res
=
1630 dynamic_cast<CacheUnit
*>(resPool
->getResource(fetchPortIdx
));
1631 return itb_res
->tlb();
1636 InOrderCPU::getDTBPtr()
1638 CacheUnit
*dtb_res
=
1639 dynamic_cast<CacheUnit
*>(resPool
->getResource(dataPortIdx
));
1640 return dtb_res
->tlb();
1644 InOrderCPU::read(DynInstPtr inst
, Addr addr
,
1645 uint8_t *data
, unsigned size
, unsigned flags
)
1647 //@TODO: Generalize name "CacheUnit" to "MemUnit" just in case
1648 // you want to run w/out caches?
1649 CacheUnit
*cache_res
=
1650 dynamic_cast<CacheUnit
*>(resPool
->getResource(dataPortIdx
));
1652 return cache_res
->read(inst
, addr
, data
, size
, flags
);
1656 InOrderCPU::write(DynInstPtr inst
, uint8_t *data
, unsigned size
,
1657 Addr addr
, unsigned flags
, uint64_t *write_res
)
1659 //@TODO: Generalize name "CacheUnit" to "MemUnit" just in case
1660 // you want to run w/out caches?
1661 CacheUnit
*cache_res
=
1662 dynamic_cast<CacheUnit
*>(resPool
->getResource(dataPortIdx
));
1663 return cache_res
->write(inst
, data
, size
, addr
, flags
, write_res
);