From 5becf757bae8671aab4712f1ab85f8a92be20037 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 17 Jun 2020 14:42:47 +0100 Subject: [PATCH] add a fake program counter to ISACaller --- src/soc/decoder/isa/caller.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index 4b850861..77cb6815 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -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) -- 2.30.2