Go to the documentation of this file.
40 #include "arch/utility.hh"
44 #include "debug/Drain.hh"
45 #include "debug/MinorCPU.hh"
46 #include "debug/Quiesce.hh"
50 threadPolicy(params.threadPolicy),
74 fatal(
"The Minor model doesn't support checking (yet)\n");
102 if (!
params().switched_out &&
105 fatal(
"The Minor CPU requires the memory system to be in "
110 for (
ThreadID thread_id = 0; thread_id <
threads.size(); thread_id++) {
154 DPRINTF(Drain,
"[tid:%d] MinorCPU wakeup\n", tid);
180 DPRINTF(Drain,
"Minor CPU switched out, draining not needed.\n");
184 DPRINTF(Drain,
"MinorCPU drain\n");
189 DPRINTF(Drain,
"MinorCPU drained\n");
192 DPRINTF(Drain,
"MinorCPU not finished draining\n");
200 DPRINTF(Drain,
"MinorCPU drain done\n");
213 DPRINTF(Drain,
"drainResume while switched out. Ignoring\n");
217 DPRINTF(Drain,
"MinorCPU drainResume\n");
220 fatal(
"The Minor CPU requires the memory system to be in "
237 DPRINTF(Drain,
"MinorCPU memWriteback\n");
272 threads[thread_id]->activate();
275 if (!
threads[thread_id]->getUseForClone())
282 {
pipeline->wakeupFetch(thread_id); },
"wakeupFetch");
302 DPRINTF(Quiesce,
"Event wakeup from stage %d\n", stage_id);
327 ret += (*i)->numInst;
#define fatal(...)
This implements a cprintf based fatal() function.
void wakeup(ThreadID tid) override
void regStats() override
Callback to set stat parameters.
Counter totalInsts() const override
Simple inst count interface from BaseCPU.
void wakeupOnEvent(unsigned int stage_id)
Interface for stages to signal that they have become active after a callback or eventq event where th...
Port & getInstPort() override
Return a reference to the instruction port.
bool isTimingMode() const
Is the system in timing mode?
void init() override
Starting, waking and initialisation.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
int16_t ThreadID
Thread index/ID type.
void suspendContext(ThreadID thread_id) override
Notify the CPU that the indicated context is now suspended.
Minor::MinorActivityRecorder * activityRecorder
Activity recording for pipeline.
MinorCPU(const MinorCPUParams ¶ms)
SimpleThread MinorThread
Minor will use the SimpleThread state for now.
Minor::MinorStats stats
Processor-specific statistics.
void deschedulePowerGatingEvent()
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
virtual ThreadContext * getContext(int tn)
Given a thread num get tho thread context for it.
The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interf...
std::vector< Minor::MinorThread * > threads
These are thread state-representing objects for this CPU.
@ Drained
Buffers drained, ready for serialization/handover.
DrainState
Object drain/handover states.
int64_t Counter
Statistics counter type.
void startup() override
startup() is the final initialization call before simulation.
void takeOverFrom(BaseCPU *old_cpu) override
Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be sw...
void schedule(Event &event, Tick when)
virtual void initMemProxies(ThreadContext *tc)=0
Initialise the physical and virtual port proxies and tie them to the data port of the CPU.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
void setStatus(Status newStatus) override
ThreadContext * getTC()
Returns the pointer to this SimpleThread's ThreadContext.
MinorCPU is an in-order CPU model with four fixed pipeline stages:
static void init()
Initialise the class.
@ Halted
Permanently shut down.
void switchOut() override
Switching interface from BaseCPU.
void memWriteback() override
Write back dirty buffers to memory using functional writes.
Ports are used to interface objects to each other.
The constructed pipeline.
void drainResume() override
Resume execution after a successful drain.
std::vector< ThreadContext * > threadContexts
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
virtual void activateContext(ThreadID thread_num)
Notify the CPU that the indicated context is now active.
void activateContext(ThreadID thread_id) override
Thread activation interface from BaseCPU.
void signalDrainDone() const
Signal that an object is drained.
Minor::Pipeline * pipeline
pipeline is a container for the clockable pipeline stage objects.
void regStats() override
Stats interface from SimObject (by way of BaseCPU)
void reset()
Clears the time buffer and the activity count.
void signalDrainDone()
Signal from Pipeline that MinorCPU should signal that a drain is complete and set its drainState.
Counter totalOps() const override
EventFunctionWrapper * fetchEventWrapper
void unserializeThread(CheckpointIn &cp, ThreadID tid) override
Unserialize one thread.
Enums::MemoryMode getMemoryMode() const
Get the memory mode of the system.
@ Suspended
Temporarily inactive.
void schedulePowerGatingEvent()
virtual void takeOverFrom(BaseCPU *cpu)
Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be sw...
Stats::Scalar quiesceCycles
Number of cycles in quiescent state.
virtual void switchOut()
Prepare for another CPU to take over execution.
ThreadID numThreads
Number of threads we're actually simulating (<= SMT_MAX_THREADS).
Cycles is a wrapper class for representing cycle counts, i.e.
std::ostream CheckpointOut
void startup() override
startup() is the final initialization call before simulation.
void activateStage(const int idx)
Marks a stage as active.
virtual void suspendContext(ThreadID thread_num)
Notify the CPU that the indicated context is now suspended.
Port & getDataPort() override
Return a reference to the data port.
const Params & params() const
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
bool switchedOut() const
Determine if the CPU is switched out.
void serializeThread(CheckpointOut &cp, ThreadID tid) const override
Serialize a single thread.
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
void serialize(CheckpointOut &cp) const override
Serialize pipeline data.
DrainState drain() override
Drain interface.
@ Draining
Draining buffers pending serialization/handover.
Generated on Tue Mar 23 2021 19:41:18 for gem5 by doxygen 1.8.17