Go to the documentation of this file.
46 #include "debug/Drain.hh"
47 #include "debug/MinorCPU.hh"
48 #include "debug/MinorTrace.hh"
49 #include "debug/Quiesce.hh"
57 allow_idling(params.enableIdling),
58 f1ToF2(cpu.
name() +
".f1ToF2",
"lines",
59 params.fetch1ToFetch2ForwardDelay),
60 f2ToF1(cpu.
name() +
".f2ToF1",
"prediction",
61 params.fetch1ToFetch2BackwardDelay, true),
62 f2ToD(cpu.
name() +
".f2ToD",
"insts",
63 params.fetch2ToDecodeForwardDelay),
64 dToE(cpu.
name() +
".dToE",
"insts",
65 params.decodeToExecuteForwardDelay),
66 eToF1(cpu.
name() +
".eToF1",
"branch",
67 params.executeBranchDelay),
68 execute(cpu.
name() +
".execute", cpu, params,
69 dToE.
output(), eToF1.input()),
70 decode(cpu.
name() +
".decode", cpu, params,
71 f2ToD.
output(), dToE.input(), execute.inputBuffer),
72 fetch2(cpu.
name() +
".fetch2", cpu, params,
73 f1ToF2.
output(), eToF1.
output(), f2ToF1.input(), f2ToD.input(),
75 fetch1(cpu.
name() +
".fetch1", cpu, params,
76 eToF1.
output(), f1ToF2.input(), f2ToF1.
output(), fetch2.inputBuffer),
77 activityRecorder(cpu.
name() +
".activity", Num_StageId,
79 std::max(params.fetch1ToFetch2ForwardDelay,
80 std::max(params.fetch2ToDecodeForwardDelay,
81 std::max(params.decodeToExecuteForwardDelay,
82 params.executeBranchDelay)))),
83 needToSignalDrained(false)
85 if (params.fetch1ToFetch2ForwardDelay < 1) {
86 fatal(
"%s: fetch1ToFetch2ForwardDelay must be >= 1 (%d)\n",
87 cpu.name(), params.fetch1ToFetch2ForwardDelay);
90 if (params.fetch2ToDecodeForwardDelay < 1) {
91 fatal(
"%s: fetch2ToDecodeForwardDelay must be >= 1 (%d)\n",
92 cpu.name(), params.fetch2ToDecodeForwardDelay);
95 if (params.decodeToExecuteForwardDelay < 1) {
96 fatal(
"%s: decodeToExecuteForwardDelay must be >= 1 (%d)\n",
97 cpu.name(), params.decodeToExecuteForwardDelay);
100 if (params.executeBranchDelay < 1) {
101 fatal(
"%s: executeBranchDelay must be >= 1\n",
102 cpu.name(), params.executeBranchDelay);
149 DPRINTF(Quiesce,
"Suspending as the processor is idle\n");
166 DPRINTF(Drain,
"Still draining\n");
168 DPRINTF(Drain,
"Signalling end of draining\n");
198 " Execution should drain naturally\n");
213 DPRINTF(Drain,
"Drain resume\n");
230 bool f1_to_f2_drained =
f1ToF2.empty();
231 bool f2_to_f1_drained =
f2ToF1.empty();
232 bool f2_to_d_drained =
f2ToD.empty();
233 bool d_to_e_drained =
dToE.empty();
235 bool ret = fetch1_drained && fetch2_drained &&
236 decode_drained && execute_drained &&
237 f1_to_f2_drained && f2_to_f1_drained &&
238 f2_to_d_drained && d_to_e_drained;
240 DPRINTF(
MinorCPU,
"Pipeline undrained stages state:%s%s%s%s%s%s%s%s\n",
241 (fetch1_drained ?
"" :
" Fetch1"),
242 (fetch2_drained ?
"" :
" Fetch2"),
243 (decode_drained ?
"" :
" Decode"),
244 (execute_drained ?
"" :
" Execute"),
245 (f1_to_f2_drained ?
"" :
" F1->F2"),
246 (f2_to_f1_drained ?
"" :
" F2->F1"),
247 (f2_to_d_drained ?
"" :
" F2->D"),
248 (d_to_e_drained ?
"" :
" D->E")
#define fatal(...)
This implements a cprintf based fatal() function.
MinorCPU::MinorCPUPort & getDataPort()
Return the DcachePort belonging to Execute for the CPU.
static void output(const char *filename)
void evaluate()
Pass on input/buffer data to the output if you can.
MinorActivityRecorder activityRecorder
Activity recording for the pipeline.
int16_t ThreadID
Thread index/ID type.
void evaluate()
Pass on input/buffer data to the output if you can.
bool drain()
Try to drain the CPU.
bool isDrained()
Test to see if the CPU is drained.
Latch< ForwardLineData > f1ToF2
bool needToSignalDrained
True after drain is called but draining isn't complete.
Latch< ForwardInstData > f2ToD
bool active()
Returns if the CPU should be active.
bool isDrained()
After thread suspension, has Execute been drained of in-flight instructions and memory accesses.
void evaluate()
Pass on input/buffer data to the output if you can.
MinorCPU::MinorCPUPort & getDcachePort()
Returns the DcachePort owned by this Execute to pass upwards.
void wakeupFetch(ThreadID tid)
Initiate fetch1 fetching.
MinorCPU::MinorCPUPort & getIcachePort()
Returns the IcachePort owned by this Fetch1.
Latch< BranchData > f2ToF1
bool allow_idling
Allow cycles to be skipped when the pipeline is idle.
MinorCPU is an in-order CPU model with four fixed pipeline stages:
void evaluate()
Pass on input/buffer data to the output if you can.
void stop()
Cancel the next tick event and issue no more.
unsigned int drain()
Like the drain interface on SimObject.
Ticked attaches gem5's event queue/scheduler to evaluate calls and provides a start/stop interface to...
Pipeline(MinorCPU &cpu_, MinorCPUParams ¶ms)
Latch< BranchData > eToF1
bool isDrained()
Is this stage drained? For Decoed, draining is initiated by Execute halting Fetch1 causing Fetch2 to ...
Provide a non-protected base class for Minor's Ports as derived classes are created by Fetch1 and Exe...
Latch< ForwardInstData > dToE
void signalDrainDone()
Signal from Pipeline that MinorCPU should signal that a drain is complete and set its drainState.
const std::string & name()
void evaluate()
Ticked interface.
Overload hash function for BasicBlockRange type.
void evaluate() override
A custom evaluate allows report in the right place (between stages and pipeline advance)
bool isDrained()
Is this stage drained? For Fetch1, draining is initiated by Execute signalling a branch with the reas...
void wakeupFetch(ThreadID tid)
Wake up the Fetch unit.
ThreadID numThreads
Number of threads we're actually simulating (<= SMT_MAX_THREADS).
bool isDrained()
Is this stage drained? For Fetch2, draining is initiated by Execute halting Fetch1 causing Fetch2 to ...
void deactivateStage(const int idx)
Deactivates a stage.
MinorCPU::MinorCPUPort & getInstPort()
Functions below here are BaseCPU operations passed on to pipeline stages.
Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17