Go to the documentation of this file.
58 #include "debug/Loader.hh"
59 #include "debug/Quiesce.hh"
60 #include "debug/WorkItems.hh"
62 #include "params/BaseCPU.hh"
74 using namespace statistics;
92 const std::string DEFAULT =
"";
96 const std::string DIST_RANK =
"dist-rank";
100 const std::string DIST_SIZE =
"dist-size";
107 DPRINTF(PseudoInst,
"pseudo_inst::arm()\n");
117 DPRINTF(PseudoInst,
"pseudo_inst::quiesce()\n");
124 DPRINTF(PseudoInst,
"pseudo_inst::quiesceSkip()\n");
131 DPRINTF(PseudoInst,
"pseudo_inst::quiesceNs(%i)\n",
ns);
138 DPRINTF(PseudoInst,
"pseudo_inst::quiesceCycles(%i)\n", cycles);
145 DPRINTF(PseudoInst,
"pseudo_inst::quiesceTime()\n");
154 DPRINTF(PseudoInst,
"pseudo_inst::rpns()\n");
161 DPRINTF(PseudoInst,
"pseudo_inst::wakeCPU(%i)\n",
cpuid);
165 warn(
"pseudo_inst::wakeCPU(%i), cpuid greater than number of contexts"
178 DPRINTF(PseudoInst,
"pseudo_inst::m5exit(%i)\n", delay);
181 exitSimLoop(
"m5_exit instruction encountered", 0, when, 0,
true);
188 uint64_t
d, uint64_t
e, uint64_t
f)
190 DPRINTF(PseudoInst,
"pseudo_inst::m5sum(%#x, %#x, %#x, %#x, %#x, %#x)\n",
192 return a +
b +
c +
d +
e +
f;
198 DPRINTF(PseudoInst,
"pseudo_inst::m5fail(%i, %i)\n", delay, code);
200 exitSimLoop(
"m5_fail instruction encountered", code, when, 0,
true);
206 DPRINTF(PseudoInst,
"pseudo_inst::loadsymbol()\n");
209 if (filename.empty()) {
214 std::ifstream file(filename.c_str());
217 fatal(
"file error: Can't open symbol table file %s\n", filename);
219 while (!file.eof()) {
220 getline(file, buffer);
226 if (idx == std::string::npos)
229 std::string address =
"0x" + buffer.substr(0, idx);
235 std::string symbol = buffer.substr(idx + 3);
245 { loader::Symbol::Binding::Global, symbol, addr })) {
250 DPRINTF(Loader,
"Loaded symbol: %s @ %#llx\n", symbol,
addr);
258 DPRINTF(PseudoInst,
"pseudo_inst::addsymbol(0x%x, 0x%x)\n",
264 DPRINTF(Loader,
"Loaded symbol: %s @ %#llx\n", symbol,
addr);
275 DPRINTF(PseudoInst,
"pseudo_inst::initParam() key:%s%s\n",
276 (
char *)&key_str1, (
char *)&key_str2);
281 const int len = 2 *
sizeof(uint64_t) + 1;
283 std::memset(key,
'\0',
len);
285 std::array<uint64_t, 2> key_regs = {{ key_str1, key_str2 }};
286 key_regs =
letoh(key_regs);
287 std::memcpy(key, key_regs.data(),
sizeof(key_regs));
290 const std::string key_str(key);
293 else if (key == DIST_RANK)
295 else if (key == DIST_SIZE)
298 panic(
"Unknown key for initparam pseudo instruction:\"%s\"", key_str);
305 DPRINTF(PseudoInst,
"pseudo_inst::resetstats(%i, %i)\n", delay, period);
319 DPRINTF(PseudoInst,
"pseudo_inst::dumpstats(%i, %i)\n", delay, period);
333 DPRINTF(PseudoInst,
"pseudo_inst::dumpresetstats(%i, %i)\n", delay,
348 DPRINTF(PseudoInst,
"pseudo_inst::m5checkpoint(%i, %i)\n", delay, period);
362 DPRINTF(PseudoInst,
"pseudo_inst::readfile(0x%x, 0x%x, 0x%x)\n",
372 int fd = ::open(file.c_str(), O_RDONLY, 0);
374 panic(
"could not open file %s\n", file);
376 if (::lseek(
fd,
offset, SEEK_SET) < 0)
377 panic(
"could not seek: %s", strerror(errno));
379 char *buf =
new char[
len];
382 int bytes = ::read(
fd,
p,
len);
401 DPRINTF(PseudoInst,
"pseudo_inst::writefile(0x%x, 0x%x, 0x%x, 0x%x)\n",
405 std::string filename;
417 std::ios::in | std::ios::out | std::ios::binary,
true);
422 panic(
"could not open file %s\n", filename);
430 char *buf =
new char[
len];
433 if (
os->fail() ||
os->bad())
434 panic(
"Error while doing writefile!\n");
446 DPRINTF(PseudoInst,
"pseudo_inst::debugbreak()\n");
453 DPRINTF(PseudoInst,
"pseudo_inst::switchcpu()\n");
460 DPRINTF(PseudoInst,
"pseudo_inst::togglesync()\n");
467 DPRINTF(PseudoInst,
"pseudo_inst::triggerWorkloadEvent()\n");
479 DPRINTF(PseudoInst,
"pseudo_inst::workbegin(%i, %i)\n", workid, threadid);
483 if (params.exit_on_work_items) {
484 exitSimLoop(
"workbegin",
static_cast<int>(workid));
488 DPRINTF(WorkItems,
"Work Begin workid: %d, threadid %d\n", workid,
497 if (params.work_item_id == -1 || params.work_item_id == workid) {
502 if (params.work_cpus_ckpt_count != 0 &&
503 sys->
markWorkItem(cpuId) >= params.work_cpus_ckpt_count) {
510 if (systemWorkBeginCount == params.work_begin_ckpt_count) {
518 if (systemWorkBeginCount == params.work_begin_exit_count) {
525 if (cpuId == params.work_begin_cpu_id_exit) {
542 DPRINTF(PseudoInst,
"pseudo_inst::workend(%i, %i)\n", workid, threadid);
546 if (params.exit_on_work_items) {
551 DPRINTF(WorkItems,
"Work End workid: %d, threadid %d\n", workid, threadid);
559 if (params.work_item_id == -1 || params.work_item_id == workid) {
564 if (params.work_cpus_ckpt_count != 0 &&
565 sys->
markWorkItem(cpuId) >= params.work_cpus_ckpt_count) {
572 if (params.work_end_ckpt_count != 0 &&
573 systemWorkEndCount == params.work_end_ckpt_count) {
581 if (params.work_end_exit_count != 0 &&
582 systemWorkEndCount == params.work_end_exit_count) {
Tick curTick()
The universal simulation clock.
#define fatal(...)
This implements a cprintf based fatal() function.
static bool readyToExit(Tick delay)
Initiate the exit from the simulation.
GEM5_DEPRECATED_NAMESPACE(Units, units)
Units for Stats.
virtual System * getSystemPtr()=0
virtual Tick readLastSuspend()=0
void workItemEnd(uint32_t tid, uint32_t workid)
void writeBlob(Addr addr, const void *p, int size) const
Same as tryWriteBlob, but insists on success.
void workend(ThreadContext *tc, uint64_t workid, uint64_t threadid)
void quiesceNs(ThreadContext *tc, uint64_t ns)
uint64_t quiesceTime(ThreadContext *tc)
void debugbreak(ThreadContext *tc)
void readString(std::string &str, Addr addr) const
Same as tryReadString, but insists on success.
void switchcpu(ThreadContext *tc)
uint64_t incWorkItemsEnd()
Called by pseudo_inst to track the number of work items completed by this system.
Workload * workload
OS kernel.
void eat_white(std::string &s)
bool to_number(const std::string &value, Pixel &retval)
virtual void activate()=0
Set the status to Active.
OutputStream * create(const std::string &name, bool binary=false, bool no_gz=false)
Creates a file in this directory (optionally compressed).
void quiesce(ThreadContext *tc)
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
virtual Status status() const =0
Cycles is a wrapper class for representing cycle counts, i.e.
uint64_t rpns(ThreadContext *tc)
void triggerWorkloadEvent(ThreadContext *tc)
std::ostream * stream() const
Get the output underlying output stream.
void close(OutputStream *file)
Closes an output file and free the corresponding OutputFile.
uint64_t incWorkItemsBegin()
Called by pseudo_inst to track the number of work items started by this system.
void loadsymbol(ThreadContext *tc)
void quiesceTick(Tick resume)
Quiesce, suspend, and schedule activate at resume.
uint64_t writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset, Addr filename_addr)
void wakeCPU(ThreadContext *tc, uint64_t cpuid)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
void quiesce()
Quiesce thread context.
virtual void event(ThreadContext *tc)
virtual PortProxy & getVirtProxy()=0
const Params & params() const
@ Suspended
Temporarily inactive.
uint64_t Tick
Tick count type.
void m5checkpoint(ThreadContext *tc, Tick delay, Tick period)
virtual Tick readLastActivate()=0
OutputStream * open(const std::string &name, std::ios_base::openmode mode, bool recreateable=true, bool no_gz=false)
Open a file in this directory (optionally compressed).
uint64_t readfile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset)
void readBlob(Addr addr, void *p, int size) const
Higher level interfaces based on the above.
void m5fail(ThreadContext *tc, Tick delay, uint64_t code)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
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 quiesceSkip(ThreadContext *tc)
void resetstats(ThreadContext *tc, Tick delay, Tick period)
void arm(ThreadContext *tc)
void dumpresetstats(ThreadContext *tc, Tick delay, Tick period)
Tick nextCycle() const
Based on the clock of the object, determine the start tick of the first cycle that is at least one cy...
void workbegin(ThreadContext *tc, uint64_t workid, uint64_t threadid)
bool insert(const Symbol &symbol)
Insert a new symbol in the table if it does not already exist.
static uint64_t sizeParam()
Getter for the dist size param.
void addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
void quiesceCycles(ThreadContext *tc, uint64_t cycles)
void m5exit(ThreadContext *tc, Tick delay)
int cpuId() const
Reads this CPU's ID.
static bool readyToCkpt(Tick delay, Tick period)
Initiate taking a checkpoint.
int markWorkItem(int index)
Called by pseudo_inst to mark the cpus actively executing work items.
uint64_t m5sum(ThreadContext *tc, uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f)
virtual BaseCPU * getCpuPtr()=0
static void toggleSync(ThreadContext *tc)
Trigger the primary to start/stop synchronization.
void togglesync(ThreadContext *tc)
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
static uint64_t rankParam()
Getter for the dist rank param.
void workItemBegin(uint32_t tid, uint32_t workid)
uint64_t initParam(ThreadContext *tc, uint64_t key_str1, uint64_t key_str2)
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
void dumpstats(ThreadContext *tc, Tick delay, Tick period)
virtual bool insertSymbol(const loader::Symbol &symbol)=0
void schedStatEvent(bool dump, bool reset, Tick when, Tick repeat)
Schedule statistics dumping.
#define panic(...)
This implements a cprintf based panic() function.
Generated on Tue Sep 21 2021 12:25:48 for gem5 by doxygen 1.8.17