add "respect_pc" boolean to ISACaller
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 17 Jun 2020 13:20:06 +0000 (14:20 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 17 Jun 2020 13:20:06 +0000 (14:20 +0100)
src/soc/decoder/isa/caller.py

index 6f444339fafa2dc99f9837270febaaee800072d9..4b850861357075ac807584a720a901610ce3aaff 100644 (file)
@@ -211,19 +211,19 @@ class ISACaller:
     # decoder2 - an instance of power_decoder2
     # regfile - a list of initial values for the registers
     # initial_{etc} - initial values for SPRs, Condition Register, Mem, MSR
     # decoder2 - an instance of power_decoder2
     # regfile - a list of initial values for the registers
     # initial_{etc} - initial values for SPRs, Condition Register, Mem, MSR
+    # respect_pc - tracks the program counter.  requires initial_insns
     def __init__(self, decoder2, regfile, initial_sprs=None, initial_cr=0,
                        initial_mem=None, initial_msr=0,
     def __init__(self, decoder2, regfile, initial_sprs=None, initial_cr=0,
                        initial_mem=None, initial_msr=0,
-                       initial_insns=None):
+                       initial_insns=None, respect_pc=False):
+
+        self.respect_pc = respect_pc
         if initial_sprs is None:
             initial_sprs = {}
         if initial_mem is None:
             initial_mem = {}
         if initial_insns is None:
             initial_insns = {}
         if initial_sprs is None:
             initial_sprs = {}
         if initial_mem is None:
             initial_mem = {}
         if initial_insns is None:
             initial_insns = {}
-            self.respect_pc = False
-        else:
-            # setup batch of instructions: we want to respect (follow) the PC
-            self.respect_pc = True
+            assert self.respect_pc == False, "instructions required to honor pc"
 
         self.gpr = GPR(decoder2, regfile)
         self.mem = Mem(row_bytes=8, initial_mem=initial_mem)
 
         self.gpr = GPR(decoder2, regfile)
         self.mem = Mem(row_bytes=8, initial_mem=initial_mem)