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"
60 allow_idling(params.enableIdling),
61 f1ToF2(cpu.
name() +
".f1ToF2",
"lines",
62 params.fetch1ToFetch2ForwardDelay),
63 f2ToF1(cpu.
name() +
".f2ToF1",
"prediction",
64 params.fetch1ToFetch2BackwardDelay, true),
65 f2ToD(cpu.
name() +
".f2ToD",
"insts",
66 params.fetch2ToDecodeForwardDelay),
67 dToE(cpu.
name() +
".dToE",
"insts",
68 params.decodeToExecuteForwardDelay),
69 eToF1(cpu.
name() +
".eToF1",
"branch",
70 params.executeBranchDelay),
71 execute(cpu.
name() +
".execute", cpu, params,
72 dToE.
output(), eToF1.input()),
73 decode(cpu.
name() +
".decode", cpu, params,
74 f2ToD.
output(), dToE.input(), execute.inputBuffer),
75 fetch2(cpu.
name() +
".fetch2", cpu, params,
76 f1ToF2.
output(), eToF1.
output(), f2ToF1.input(), f2ToD.input(),
78 fetch1(cpu.
name() +
".fetch1", cpu, params,
79 eToF1.
output(), f1ToF2.input(), f2ToF1.
output(), fetch2.inputBuffer),
80 activityRecorder(cpu.
name() +
".activity", Num_StageId,
82 std::max(params.fetch1ToFetch2ForwardDelay,
83 std::max(params.fetch2ToDecodeForwardDelay,
84 std::max(params.decodeToExecuteForwardDelay,
85 params.executeBranchDelay)))),
86 needToSignalDrained(false)
88 if (params.fetch1ToFetch2ForwardDelay < 1) {
89 fatal(
"%s: fetch1ToFetch2ForwardDelay must be >= 1 (%d)\n",
90 cpu.
name(), params.fetch1ToFetch2ForwardDelay);
93 if (params.fetch2ToDecodeForwardDelay < 1) {
94 fatal(
"%s: fetch2ToDecodeForwardDelay must be >= 1 (%d)\n",
95 cpu.
name(), params.fetch2ToDecodeForwardDelay);
98 if (params.decodeToExecuteForwardDelay < 1) {
99 fatal(
"%s: decodeToExecuteForwardDelay must be >= 1 (%d)\n",
100 cpu.
name(), params.decodeToExecuteForwardDelay);
103 if (params.executeBranchDelay < 1) {
104 fatal(
"%s: executeBranchDelay must be >= 1\n",
105 cpu.
name(), params.executeBranchDelay);
138 if (debug::MinorTrace)
155 DPRINTF(Quiesce,
"Suspending as the processor is idle\n");
172 DPRINTF(Drain,
"Still draining\n");
174 DPRINTF(Drain,
"Signalling end of draining\n");
204 " Execution should drain naturally\n");
219 DPRINTF(Drain,
"Drain resume\n");
236 bool f1_to_f2_drained =
f1ToF2.empty();
237 bool f2_to_f1_drained =
f2ToF1.empty();
238 bool f2_to_d_drained =
f2ToD.empty();
239 bool d_to_e_drained =
dToE.empty();
241 bool ret = fetch1_drained && fetch2_drained &&
242 decode_drained && execute_drained &&
243 f1_to_f2_drained && f2_to_f1_drained &&
244 f2_to_d_drained && d_to_e_drained;
246 DPRINTF(
MinorCPU,
"Pipeline undrained stages state:%s%s%s%s%s%s%s%s\n",
247 (fetch1_drained ?
"" :
" Fetch1"),
248 (fetch2_drained ?
"" :
" Fetch2"),
249 (decode_drained ?
"" :
" Decode"),
250 (execute_drained ?
"" :
" Execute"),
251 (f1_to_f2_drained ?
"" :
" F1->F2"),
252 (f2_to_f1_drained ?
"" :
" F2->F1"),
253 (f2_to_d_drained ?
"" :
" F2->D"),
254 (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 ...
Provide a non-protected base class for Minor's Ports as derived classes are created by Fetch1 and Exe...
Pipeline(MinorCPU &cpu_, const BaseMinorCPUParams ¶ms)
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
ThreadID numThreads
Number of threads we're actually simulating (<= SMT_MAX_THREADS).
bool drain()
Try to drain the CPU.
Latch< ForwardLineData > f1ToF2
MinorCPU::MinorCPUPort & getIcachePort()
Returns the IcachePort owned by this Fetch1.
virtual std::string name() const
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.
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 Sun Jul 30 2023 01:56:52 for gem5 by doxygen 1.8.17