Skip to content
Snippets Groups Projects
Commit 855868ba authored by Martin Högstedt's avatar Martin Högstedt
Browse files

asm instr and clock cycle stepping is now fixed

parent db4cd213
No related branches found
No related tags found
1 merge request!13We know have asm instructions, can step forward and backward between clock cycle and asm instructions
Pipeline #131563 failed
......@@ -253,10 +253,7 @@ class Processor:
try:
module_states = self.module_history[cycle_index]
print(cycle_index)
except IndexError:
print(cycle_index)
print(321)
raise IndexError
......
......@@ -928,7 +928,6 @@ class GUI(QMainWindow):
"""
Undos as many processor cycles as the number entered in the box.
"""
print(self.cpu.assembly_cycles)
try:
steps = self.asm_jump_value_box.value()
self.cpu.undo_asm_instruction(steps)
......
......@@ -335,9 +335,16 @@ class MIA_CPU(Processor):
said number of asm intructions started and loading that clock cycle.
"""
current_clock_cycle = self.clock
index = len(self.assembly_cycles)
saved_cycle = self.assembly_cycles[index-1]
# Make sure we are undoing the instruction(s) we are currently on
while saved_cycle >= current_clock_cycle:
index -= 1
saved_cycle = self.assembly_cycles[index-1]
index -= num_instructions
index -= 1
# We cant undo more instructions than we have performed.
if index < 0:
......@@ -346,6 +353,11 @@ class MIA_CPU(Processor):
clockcycle = self.assembly_cycles[index]
self.load_cycle(clockcycle)
# Need +1 here since we save the start state to enable to
# load the start state. This is done since we only append clock
# cycles to the list self.assembly_cycles when we reach a new state
# that has uPC set to 0, which wont happend when we load a new file.
self.assembly_cycles = self.assembly_cycles[:index+1]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment