提交 3d032f9d 编写于 作者: Y Yinan Xu

emu: fix --max-cycles and --max-instr

上级 a07b5122
......@@ -277,7 +277,6 @@ uint64_t Emulator::execute(uint64_t max_cycle, uint64_t max_instr) {
uint32_t lasttime_poll = 0;
uint32_t lasttime_snapshot = 0;
uint64_t lastcommit[NumCore];
uint64_t instr_left_last_cycle[NumCore];
const int stuck_limit = 2000;
const int firstCommit_limit = 10000;
uint64_t core_max_instr[NumCore];
......@@ -293,7 +292,6 @@ uint64_t Emulator::execute(uint64_t max_cycle, uint64_t max_instr) {
diff[i].wdata = wdata[i];
diff[i].wdst = wdst[i];
lastcommit[i] = max_cycle;
instr_left_last_cycle[i] = max_cycle;
core_max_instr[i] = max_instr;
}
......@@ -305,9 +303,7 @@ uint64_t Emulator::execute(uint64_t max_cycle, uint64_t max_instr) {
#endif
while (!Verilated::gotFinish() && trapCode == STATE_RUNNING) {
if (!(max_cycle > 0 &&
core_max_instr[0] > 0 &&
instr_left_last_cycle[0] >= core_max_instr[0])) {
if (!(max_cycle > 0 && core_max_instr[0] > 0)) {
trapCode = STATE_LIMIT_EXCEEDED; /* handle overflow */
break;
}
......@@ -381,8 +377,8 @@ uint64_t Emulator::execute(uint64_t max_cycle, uint64_t max_instr) {
lastcommit[i] = max_cycle;
// update instr_cnt
instr_left_last_cycle[i] = core_max_instr[i];
core_max_instr[i] -= diff[i].commit;
uint64_t commit_count = (core_max_instr[i] >= diff[i].commit) ? diff[i].commit : core_max_instr[i];
core_max_instr[i] -= commit_count;
}
#ifdef DIFFTEST_STORE_COMMIT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册