46 #include "arch/stacktrace.hh" 47 #include "arch/utility.hh" 48 #include "arch/vtophys.hh" 57 #include "config/the_isa.hh" 69 #include "debug/Decode.hh" 70 #include "debug/Fetch.hh" 71 #include "debug/Quiesce.hh" 74 #include "params/BaseSimpleCPU.hh" 90 branchPred(p->branchPred),
100 p->itb, p->dtb, p->isa[
i]);
103 p->itb, p->dtb, p->isa[
i]);
112 fatal(
"Checker currently does not support SMT");
114 BaseCPU *temp_checker = p->checker;
132 tc->initMemProxies(tc);
145 }
while (oldpc != pc);
185 total_inst += t_info->numInst;
196 total_op += t_info->numOp;
218 using namespace Stats;
225 std::string thread_str =
name();
230 .
name(thread_str +
".committedInsts")
231 .
desc(
"Number of instructions committed")
235 .
name(thread_str +
".committedOps")
236 .
desc(
"Number of ops (including micro ops) committed")
240 .
name(thread_str +
".num_int_alu_accesses")
241 .
desc(
"Number of integer alu accesses")
245 .
name(thread_str +
".num_fp_alu_accesses")
246 .
desc(
"Number of float alu accesses")
250 .
name(thread_str +
".num_vec_alu_accesses")
251 .
desc(
"Number of vector alu accesses")
255 .
name(thread_str +
".num_func_calls")
256 .
desc(
"number of times a function call or return occured")
260 .
name(thread_str +
".num_conditional_control_insts")
261 .
desc(
"number of instructions that are conditional controls")
265 .
name(thread_str +
".num_int_insts")
266 .
desc(
"number of integer instructions")
270 .
name(thread_str +
".num_fp_insts")
271 .
desc(
"number of float instructions")
275 .
name(thread_str +
".num_vec_insts")
276 .
desc(
"number of vector instructions")
280 .
name(thread_str +
".num_int_register_reads")
281 .
desc(
"number of times the integer registers were read")
285 .
name(thread_str +
".num_int_register_writes")
286 .
desc(
"number of times the integer registers were written")
290 .
name(thread_str +
".num_fp_register_reads")
291 .
desc(
"number of times the floating registers were read")
295 .
name(thread_str +
".num_fp_register_writes")
296 .
desc(
"number of times the floating registers were written")
300 .
name(thread_str +
".num_vec_register_reads")
301 .
desc(
"number of times the vector registers were read")
305 .
name(thread_str +
".num_vec_register_writes")
306 .
desc(
"number of times the vector registers were written")
310 .
name(thread_str +
".num_cc_register_reads")
311 .
desc(
"number of times the CC registers were read")
316 .
name(thread_str +
".num_cc_register_writes")
317 .
desc(
"number of times the CC registers were written")
322 .
name(thread_str +
".num_mem_refs")
323 .
desc(
"number of memory refs")
327 .
name(thread_str +
".num_store_insts")
328 .
desc(
"Number of store instructions")
332 .
name(thread_str +
".num_load_insts")
333 .
desc(
"Number of load instructions")
337 .
name(thread_str +
".not_idle_fraction")
338 .
desc(
"Percentage of non-idle cycles")
342 .
name(thread_str +
".idle_fraction")
343 .
desc(
"Percentage of idle cycles")
347 .
name(thread_str +
".num_busy_cycles")
348 .
desc(
"Number of busy cycles")
352 .
name(thread_str +
".num_idle_cycles")
353 .
desc(
"Number of idle cycles")
357 .
name(thread_str +
".icache_stall_cycles")
358 .
desc(
"ICache total stall cycles")
363 .
name(thread_str +
".dcache_stall_cycles")
364 .
desc(
"DCache total stall cycles")
369 .
init(Enums::Num_OpClass)
370 .
name(thread_str +
".op_class")
371 .
desc(
"Class of executed instruction")
384 .
name(thread_str +
".Branches")
385 .
desc(
"Number of branches fetched")
389 .
name(thread_str +
".predictedBranches")
390 .
desc(
"Number of branches predicted as taken")
394 .
name(thread_str +
".BranchMispred")
395 .
desc(
"Number of branch mispredictions")
439 DPRINTF(Quiesce,
"[tid:%d] Suspended Processor awoke\n", tid);
457 interrupt->invoke(tc);
474 DPRINTF(Fetch,
"Fetch: Inst PC:%08p, Fetch PC:%08p\n", instAddr, fetchPC);
489 #if THE_ISA == ALPHA_ISA 517 decoder->moreBytes(pcState, fetchPC,
inst);
523 instPtr = decoder->decode(pcState);
552 DPRINTF(Decode,
"Decode: Decoded %s instruction: %#x\n",
563 const bool predict_taken(
581 Addr instAddr = pc.instAddr();
584 thread->
profilePC = usermode ? 1 : instAddr;
667 const bool branching(thread->
pcState().branching());
706 t_info->thread->startup();
StaticInstPtr curStaticInst
Counter totalInsts() const override
void advancePC(const Fault &fault)
const FlagsType pdf
Print the percent of the total that this entry represents.
Stats::Scalar numFpAluAccesses
ProfileNode * profileNode
virtual void probeInstCommit(const StaticInstPtr &inst, Addr pc)
Helper method to trigger PMU probes for a committed instruction.
std::list< ThreadID > activeThreads
decltype(nullptr) constexpr NoFault
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation...
AddressMonitor * getCpuAddrMonitor(ThreadID tid)
#define fatal(...)
This implements a cprintf based fatal() function.
FunctionProfile * profile
Stats::Average notIdleFraction
bool isDelayedCommit() const
ThreadID numThreads
Number of threads we're actually simulating (<= SMT_MAX_THREADS).
void startup() override
startup() is the final initialization call before simulation.
Stats::Scalar numLoadInsts
Stats::Scalar numIntAluAccesses
void traceFunctions(Addr pc)
Stats::Vector statExecutedInstType
Addr dbg_vtophys(Addr addr)
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
std::vector< BaseInterrupts * > interrupts
std::shared_ptr< Request > RequestPtr
TheISA::MachInst inst
Current instruction.
virtual InstRecord * getInstRecord(Tick when, ThreadContext *tc, const StaticInstPtr staticInst, TheISA::PCState pc, const StaticInstPtr macroStaticInst=NULL)=0
void wakeup(ThreadID tid) override
Stats::Scalar numCCRegReads
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
TheISA::PCState pcState() const override
Stats::Scalar numFpRegWrites
Stats::Scalar numIntRegReads
The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interf...
std::string getName()
Return name of machine instruction.
void checkForInterrupts()
void update(const InstSeqNum &done_sn, ThreadID tid)
Tells the branch predictor to commit any updates until the given sequence number. ...
Overload hash function for BasicBlockRange type.
Stats::Formula numIdleCycles
BaseSimpleCPU(BaseSimpleCPUParams *params)
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
void resetStats() override
Callback to reset stats.
Derived & init(size_type size)
Set this vector to have the given size.
void regStats() override
Callback to set stat parameters.
void setupFetchRequest(const RequestPtr &req)
Derived ThreadContext class for use with the Checker.
void setIntReg(RegIndex reg_idx, RegVal val) override
void change_thread_state(ThreadID tid, int activate, int priority)
Changes the status and priority of the thread with the given number.
std::vector< ThreadContext * > threadContexts
Stats::Scalar icacheStallCycles
void setPredicate(bool val) override
const ExtMachInst machInst
The binary machine instruction.
void swAutoBegin(ThreadContext *tc, Addr next_pc)
Tick curTick()
The current simulated tick.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void setFloatReg(RegIndex reg_idx, RegVal val) override
void haltContext(ThreadID thread_num) override
Notify the CPU that the indicated context is now halted.
Stats::Scalar numPredictedBranches
Number of branches predicted as taken.
void unserializeThread(CheckpointIn &cp, ThreadID tid) override
Unserialize one thread.
virtual StaticInstPtr fetchMicroop(MicroPC upc) const
Return the microop that goes with a particular micropc.
void setMemAccPredicate(bool val) override
void updateCycleCounters(CPUState state)
base method keeping track of cycle progression
Stats::Scalar numVecRegReads
bool checkInterrupts(ThreadContext *tc) const
Derived & prereq(const Stat &prereq)
Set the prerequisite stat and marks this stat to print at the end of simulation.
Stats::Scalar dcacheStallCycles
void startup() override
startup() is the final initialization call before simulation.
TheISA::MicrocodeRom microcodeRom
Stats::Scalar numVecRegWrites
Stats::Scalar numIntRegWrites
bool predict(const StaticInstPtr &inst, const InstSeqNum &seqNum, TheISA::PCState &pc, ThreadID tid)
Predicts whether or not the instruction is a taken branch, and the target of the branch if it is take...
void serviceEvents(Tick when)
Stats::Scalar numIntInsts
StaticInstPtr curMacroStaticInst
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
ThreadContext * getTC()
Returns the pointer to this SimpleThread's ThreadContext.
Declaration of IniFile object.
bool inUserMode(ThreadContext *tc)
Stats::Formula numBusyCycles
virtual const std::string name() const
void advancePC(PCState &pc, const StaticInstPtr &inst)
int64_t Counter
Statistics counter type.
static bool isRomMicroPC(MicroPC upc)
Stats::Scalar numBranches
Addr instAddr() const override
OpClass opClass() const
Operation class. Used to select appropriate function unit in issue.
The request was an instruction fetch.
const FlagsType total
Print the total.
void serializeThread(CheckpointOut &cp, ThreadID tid) const override
Serialize a single thread.
Counter numInst
PER-THREAD STATS.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
int16_t ThreadID
Thread index/ID type.
Stats::Scalar numCallsReturns
Stats::Scalar numFpRegReads
Declaration of the Packet class.
Counter totalOps() const override
std::ostream CheckpointOut
void setSystem(System *system)
Trace::InstRecord * traceData
static const OpClass Num_OpClasses
GenericISA::SimplePCState< MachInst > PCState
std::vector< SimpleExecContext * > threadInfo
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Stats::Scalar numStoreInsts
Stats::Scalar numVecAluAccesses
Trace::InstTracer * tracer
void regStats() override
Callback to set stat parameters.
void squash(const InstSeqNum &squashed_sn, ThreadID tid)
Squashes all outstanding updates until a given sequence number.
Stats::Scalar numCCRegWrites
Stats::Formula idleFraction
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Stats::Scalar numVecInsts
static StaticInstPtr nullStaticInstPtr
Pointer to a statically allocated "null" instruction object.
EventQueue comInstEventQueue
An instruction-based event queue.
ProfileNode * consume(ThreadContext *tc, const StaticInstPtr &inst)
const FlagsType nozero
Don't print if this is zero.
const FlagsType dist
Print the distribution.
std::shared_ptr< FaultBase > Fault
Stats::Scalar numBranchMispred
Number of misprediced branches.
const std::string to_string(sc_enc enc)
MasterID instMasterId() const
Reads this CPU's unique instruction requestor ID.
virtual void suspendContext(ThreadID thread_num)
Notify the CPU that the indicated context is now suspended.
bool isLastMicroop() const
Stats::Scalar numCondCtrlInsts