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"
59 Ticked(cpu_, &(cpu_.BaseCPU::baseStats.numCycles)),
61 allow_idling(params.enableIdling),
62 f1ToF2(cpu.
name() +
".f1ToF2",
"lines",
63 params.fetch1ToFetch2ForwardDelay),
64 f2ToF1(cpu.
name() +
".f2ToF1",
"prediction",
65 params.fetch1ToFetch2BackwardDelay, true),
66 f2ToD(cpu.
name() +
".f2ToD",
"insts",
67 params.fetch2ToDecodeForwardDelay),
68 dToE(cpu.
name() +
".dToE",
"insts",
69 params.decodeToExecuteForwardDelay),
70 eToF1(cpu.
name() +
".eToF1",
"branch",
71 params.executeBranchDelay),
72 execute(cpu.
name() +
".execute", cpu, params,
73 dToE.
output(), eToF1.input()),
74 decode(cpu.
name() +
".decode", cpu, params,
75 f2ToD.
output(), dToE.input(), execute.inputBuffer),
76 fetch2(cpu.
name() +
".fetch2", cpu, params,
77 f1ToF2.
output(), eToF1.
output(), f2ToF1.input(), f2ToD.input(),
79 fetch1(cpu.
name() +
".fetch1", cpu, params,
80 eToF1.
output(), f1ToF2.input(), f2ToF1.
output(), fetch2.inputBuffer),
81 activityRecorder(cpu.
name() +
".activity", Num_StageId,
83 std::max(params.fetch1ToFetch2ForwardDelay,
84 std::max(params.fetch2ToDecodeForwardDelay,
85 std::max(params.decodeToExecuteForwardDelay,
86 params.executeBranchDelay)))),
87 needToSignalDrained(false)
89 if (params.fetch1ToFetch2ForwardDelay < 1) {
90 fatal(
"%s: fetch1ToFetch2ForwardDelay must be >= 1 (%d)\n",
91 cpu.name(), params.fetch1ToFetch2ForwardDelay);
94 if (params.fetch2ToDecodeForwardDelay < 1) {
95 fatal(
"%s: fetch2ToDecodeForwardDelay must be >= 1 (%d)\n",
96 cpu.name(), params.fetch2ToDecodeForwardDelay);
99 if (params.decodeToExecuteForwardDelay < 1) {
100 fatal(
"%s: decodeToExecuteForwardDelay must be >= 1 (%d)\n",
101 cpu.name(), params.decodeToExecuteForwardDelay);
104 if (params.executeBranchDelay < 1) {
105 fatal(
"%s: executeBranchDelay must be >= 1\n",
106 cpu.name(), params.executeBranchDelay);
139 if (debug::MinorTrace)
156 DPRINTF(Quiesce,
"Suspending as the processor is idle\n");
173 DPRINTF(Drain,
"Still draining\n");
175 DPRINTF(Drain,
"Signalling end of draining\n");
205 " Execution should drain naturally\n");
220 DPRINTF(Drain,
"Drain resume\n");
222 for (
ThreadID tid = 0; tid <
cpu.numThreads; tid++) {
237 bool f1_to_f2_drained =
f1ToF2.empty();
238 bool f2_to_f1_drained =
f2ToF1.empty();
239 bool f2_to_d_drained =
f2ToD.empty();
240 bool d_to_e_drained =
dToE.empty();
242 bool ret = fetch1_drained && fetch2_drained &&
243 decode_drained && execute_drained &&
244 f1_to_f2_drained && f2_to_f1_drained &&
245 f2_to_d_drained && d_to_e_drained;
247 DPRINTF(
MinorCPU,
"Pipeline undrained stages state:%s%s%s%s%s%s%s%s\n",
248 (fetch1_drained ?
"" :
" Fetch1"),
249 (fetch2_drained ?
"" :
" Fetch2"),
250 (decode_drained ?
"" :
" Decode"),
251 (execute_drained ?
"" :
" Execute"),
252 (f1_to_f2_drained ?
"" :
" F1->F2"),
253 (f2_to_f1_drained ?
"" :
" F2->F1"),
254 (f2_to_d_drained ?
"" :
" F2->D"),
255 (d_to_e_drained ?
"" :
" D->E")
#define fatal(...)
This implements a cprintf based fatal() function.
void wakeupFetch(ThreadID tid)
Wake up the Fetch unit.
bool isDrained()
Test to see if the CPU is drained.
Latch< ForwardInstData > f2ToD
unsigned int drain()
Like the drain interface on SimObject.
static void output(const char *filename)
void tick()
The tick method in the MinorCPU is simply updating the cycle counters as the ticking of the pipeline ...
Pipeline(MinorCPU &cpu_, const MinorCPUParams ¶ms)
Provide a non-protected base class for Minor's Ports as derived classes are created by Fetch1 and Exe...
bool isDrained()
Is this stage drained? For Decoed, draining is initiated by Execute halting Fetch1 causing Fetch2 to ...
MinorCPU is an in-order CPU model with four fixed pipeline stages:
Ticked attaches gem5's event queue/scheduler to evaluate calls and provides a start/stop interface to...
void evaluate()
Pass on input/buffer data to the output if you can.
Latch< BranchData > eToF1
bool drain()
Try to drain the CPU.
Latch< ForwardLineData > f1ToF2
MinorCPU::MinorCPUPort & getIcachePort()
Returns the IcachePort owned by this Fetch1.
bool isDrained()
After thread suspension, has Execute been drained of in-flight instructions and memory accesses.
MinorCPU::MinorCPUPort & getDcachePort()
Returns the DcachePort owned by this Execute to pass upwards.
void evaluate() override
A custom evaluate allows report in the right place (between stages and pipeline advance)
void evaluate()
Pass on input/buffer data to the output if you can.
MinorActivityRecorder activityRecorder
Activity recording for the pipeline.
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
void signalDrainDone()
Signal from Pipeline that MinorCPU should signal that a drain is complete and set its drainState.
void evaluate()
Pass on input/buffer data to the output if you can.
const std::string & name()
bool isDrained()
Is this stage drained? For Fetch2, draining is initiated by Execute halting Fetch1 causing Fetch2 to ...
Latch< ForwardInstData > dToE
bool allow_idling
Allow cycles to be skipped when the pipeline is idle.
void wakeupFetch(ThreadID tid)
Initiate fetch1 fetching.
Overload hash function for BasicBlockRange type.
Latch< BranchData > f2ToF1
bool active()
Returns if the CPU should be active.
void stop()
Cancel the next tick event and issue no more.
void evaluate()
Ticked interface.
void evaluate()
Pass on input/buffer data to the output if you can.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
void deactivateStage(const int idx)
Deactivates a stage.
MinorCPU::MinorCPUPort & getInstPort()
Functions below here are BaseCPU operations passed on to pipeline stages.
bool isDrained()
Is this stage drained? For Fetch1, draining is initiated by Execute signalling a branch with the reas...
MinorCPU::MinorCPUPort & getDataPort()
Return the DcachePort belonging to Execute for the CPU.
bool needToSignalDrained
True after drain is called but draining isn't complete.
int16_t ThreadID
Thread index/ID type.
Generated on Tue Dec 21 2021 11:34:26 for gem5 by doxygen 1.8.17