add a fake program counter to ISACaller
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 17 Jun 2020 13:42:47 +0000 (14:42 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 17 Jun 2020 13:42:47 +0000 (14:42 +0100)
src/soc/decoder/isa/caller.py

index 4b850861357075ac807584a720a901610ce3aaff..77cb681599ccf58078906b7f6dfd9f5bad00e57c 100644 (file)
@@ -225,6 +225,13 @@ class ISACaller:
             initial_insns = {}
             assert self.respect_pc == False, "instructions required to honor pc"
 
+        # "fake program counter" mode (for unit testing)
+        if not respect_pc:
+            if isinstance(initial_mem, tuple):
+                self.fake_pc = initial_mem[0]
+            else:
+                self.fake_pc = 0
+
         self.gpr = GPR(decoder2, regfile)
         self.mem = Mem(row_bytes=8, initial_mem=initial_mem)
         self.insns = Mem(row_bytes=4, initial_mem=initial_insns)