From afd5a4222a1574f5b7edd0189d892b069ed240ec Mon Sep 17 00:00:00 2001 From: Morten Borup Petersen Date: Sun, 31 Mar 2019 11:08:07 +0100 Subject: [PATCH] Stop pipeline "run" execution when pipeline signals finished #31 Run execution would not check for ecall::exit within the pipeline, and thus would only stop when there were no more instructions to fetch and execute. While execution is correct, this results in a bug where a discrepancy between the cycles and instructions executed between stepping through the program and running through the program, were different. --- src/rundialog.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rundialog.cpp b/src/rundialog.cpp index 8d2fa69df..0c94d57b1 100644 --- a/src/rundialog.cpp +++ b/src/rundialog.cpp @@ -57,7 +57,12 @@ void RunDialog::finished() { if (ecall_val.first != Pipeline::ECALL::none) { // An ECALL has been invoked during continuous running. Handle ecall and continue to run m_processorTab->handleEcall(ecall_val); - m_runWatcher.setFuture(startSimulation()); + // Check whether to stop the pipeline given an ecall::exit instruction + if (!(Pipeline::getPipeline()->isFinished() || ecall_val.first == Pipeline::ECALL::exit)) { + m_runWatcher.setFuture(startSimulation()); + } else { + accept(); + } } } }