added sc_stop at the end of the simulation to call destructors

This commit is contained in:
Màrius Montón 2019-09-08 11:41:30 +02:00
parent 0415ba3c66
commit 1babf6cb88
2 changed files with 10 additions and 4 deletions

View File

@ -876,8 +876,8 @@ bool Execute::ECALL(Instruction &inst) {
cout << "Simulation time " << sc_time_stamp() << endl; cout << "Simulation time " << sc_time_stamp() << endl;
perf->dump(); perf->dump();
SC_REPORT_ERROR("Execute", "ECALL"); //SC_REPORT_ERROR("Execute", "ECALL");
sc_stop();
return true; return true;
} }

View File

@ -68,7 +68,6 @@ SC_MODULE(Simulator)
} }
~Simulator() { ~Simulator() {
cout << "Simulator destructor" << endl;
delete cpu; delete cpu;
delete MainMemory; delete MainMemory;
delete Bus; delete Bus;
@ -120,7 +119,7 @@ void process_arguments(int argc, char* argv[]) {
filename = std::string(optarg); filename = std::string(optarg);
break; break;
case '?' : case '?' :
std::cout << "Call ./RISCV_TLM -D <debuglevel> (0..4) filename.hex" << std::endl; std::cout << "Call ./RISCV_TLM -D <debuglevel> (0..3) filename.hex" << std::endl;
break; break;
} }
} }
@ -144,5 +143,12 @@ int sc_main(int argc, char* argv[])
top = new Simulator("top"); top = new Simulator("top");
sc_start(); sc_start();
cout << "Press Enter to finish" << endl;
cin.ignore();
// call all destructors, clean exit.
delete top;
return 0; return 0;
} }