application exit error handing

This commit is contained in:
Blaise Tine
2021-06-29 02:04:07 -04:00
parent 3a0a9edaca
commit d684a2e632
43 changed files with 89446 additions and 212932 deletions

View File

@@ -243,19 +243,26 @@ bool Simulator::is_busy() const {
return vortex_->busy;
}
void Simulator::run() {
int Simulator::run() {
int exitcode = 0;
#ifndef NDEBUG
std::cout << std::dec << timestamp << ": [sim] run()" << std::endl;
#endif
// execute program
while (vortex_->busy
&& !get_ebreak()) {
while (vortex_->busy) {
if (get_ebreak()) {
exitcode = get_last_wb_value(3);
break;
}
this->step();
}
// wait 5 cycles to flush the pipeline
this->wait(5);
return exitcode;
}
bool Simulator::get_ebreak() const {