Skip to content
Snippets Groups Projects
Commit c6d3f374 authored by Johannes Kung's avatar Johannes Kung
Browse files

Fixed bug where the tick buttons are not enabled after stepping some ticks

parent 454ce0a7
No related branches found
No related tags found
1 merge request!6Resolve "Count clock cycles"
Pipeline #131474 passed
...@@ -470,20 +470,20 @@ class GUI(QMainWindow): ...@@ -470,20 +470,20 @@ class GUI(QMainWindow):
if self.cpu.breakpoint_reached: if self.cpu.breakpoint_reached:
self.messageBox("Reached breakpoint: " + self.cpu.last_breakpoint.__str__()) self.messageBox("Reached breakpoint: " + self.cpu.last_breakpoint.__str__())
self.updateCpuListeners() self.updateCpuListeners()
self.cpu_running = False
self.setDisabledWhenRunning(False)
# When the cpu is done we want to inform the user and update visuals # When the CPU is done we want to inform the user and update visuals
if self.cpu.should_halt(): if self.cpu.should_halt():
# Only show halted message for larger steps that take time # Only show halted message for larger steps that take time
# This is done so a user dosent have to close # This is done so a user dosent have to close
# the message box after every small step # the message box after every small step
if steps > self.HALT_MESSAGE_THRESHOLD: if steps > self.HALT_MESSAGE_THRESHOLD:
self.messageBox("The processor halted.") self.messageBox("The processor halted.")
self.updateCpuListeners() self.updateCpuListeners()
# A signal of 0 steps signifies end of execution, i.e. the CPU has
# halted or run the specified amount of ticks
# => Enable the relevant parts of the GUI again
if steps == 0:
self.cpu_running = False self.cpu_running = False
self.setDisabledWhenRunning(False) self.setDisabledWhenRunning(False)
......
...@@ -24,7 +24,7 @@ class RunThread(QRunnable): ...@@ -24,7 +24,7 @@ class RunThread(QRunnable):
def run(self): def run(self):
if self.run_continuously: if self.run_continuously:
while not self.cpu.should_halt(): while not self.cpu.should_halt() and not self.cpu.is_stopped:
self.cpu.do_tick() self.cpu.do_tick()
self.signal.emit(1) self.signal.emit(1)
time.sleep(CPU_TICK_DELAY) time.sleep(CPU_TICK_DELAY)
...@@ -34,3 +34,6 @@ class RunThread(QRunnable): ...@@ -34,3 +34,6 @@ class RunThread(QRunnable):
self.cpu.do_tick() self.cpu.do_tick()
self.signal.emit(1) self.signal.emit(1)
time.sleep(CPU_TICK_DELAY) time.sleep(CPU_TICK_DELAY)
# Signal end of execution as having run 0 ticks
self.signal.emit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment