提交 a300166f 编写于 作者: W wangkaifan

emu: trigger pf-cnt dump when exit abnormally

上级 b31c62ab
...@@ -783,6 +783,10 @@ inline void Emulator::save_coverage(time_t t) { ...@@ -783,6 +783,10 @@ inline void Emulator::save_coverage(time_t t) {
} }
#endif #endif
void Emulator::trigger_perfDump() {
dut_ptr->io_perfInfo_dump = 1;
single_cycle();
}
void Emulator::display_trapinfo() { void Emulator::display_trapinfo() {
uint64_t pc = dut_ptr->io_trap_pc; uint64_t pc = dut_ptr->io_trap_pc;
...@@ -797,15 +801,19 @@ void Emulator::display_trapinfo() { ...@@ -797,15 +801,19 @@ void Emulator::display_trapinfo() {
eprintf(ANSI_COLOR_RED "HIT BAD TRAP at pc = 0x%" PRIx64 "\n" ANSI_COLOR_RESET, pc); eprintf(ANSI_COLOR_RED "HIT BAD TRAP at pc = 0x%" PRIx64 "\n" ANSI_COLOR_RESET, pc);
break; break;
case STATE_ABORT: case STATE_ABORT:
trigger_perfDump();
eprintf(ANSI_COLOR_RED "ABORT at pc = 0x%" PRIx64 "\n" ANSI_COLOR_RESET, pc); eprintf(ANSI_COLOR_RED "ABORT at pc = 0x%" PRIx64 "\n" ANSI_COLOR_RESET, pc);
break; break;
case STATE_LIMIT_EXCEEDED: case STATE_LIMIT_EXCEEDED:
trigger_perfDump();
eprintf(ANSI_COLOR_YELLOW "EXCEEDING CYCLE/INSTR LIMIT at pc = 0x%" PRIx64 "\n" ANSI_COLOR_RESET, pc); eprintf(ANSI_COLOR_YELLOW "EXCEEDING CYCLE/INSTR LIMIT at pc = 0x%" PRIx64 "\n" ANSI_COLOR_RESET, pc);
break; break;
case STATE_SIG: case STATE_SIG:
trigger_perfDump();
eprintf(ANSI_COLOR_YELLOW "SOME SIGNAL STOPS THE PROGRAM at pc = 0x%" PRIx64 "\n" ANSI_COLOR_RESET, pc); eprintf(ANSI_COLOR_YELLOW "SOME SIGNAL STOPS THE PROGRAM at pc = 0x%" PRIx64 "\n" ANSI_COLOR_RESET, pc);
break; break;
default: default:
trigger_perfDump();
eprintf(ANSI_COLOR_RED "Unknown trap code: %d\n", trapCode); eprintf(ANSI_COLOR_RED "Unknown trap code: %d\n", trapCode);
} }
......
...@@ -78,6 +78,7 @@ class Emulator { ...@@ -78,6 +78,7 @@ class Emulator {
inline void reset_ncycles(size_t cycles); inline void reset_ncycles(size_t cycles);
inline void single_cycle(); inline void single_cycle();
void trigger_perfDump();
void display_trapinfo(); void display_trapinfo();
inline char* timestamp_filename(time_t t, char *buf); inline char* timestamp_filename(time_t t, char *buf);
inline char* snapshot_filename(time_t t); inline char* snapshot_filename(time_t t);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册