add halted condition in ISACaller, when attn instruction encountered
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 7 Jul 2020 14:42:52 +0000 (15:42 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 7 Jul 2020 14:42:52 +0000 (15:42 +0100)
src/soc/decoder/isa/caller.py

index fa0fb341ba9625732e449ca2d2dae5fe12ab963f..7d73551ae9ff894a2bd2f15040a738307e6b07e5 100644 (file)
@@ -247,6 +247,7 @@ class ISACaller:
                        disassembly=None,
                        initial_pc=0):
 
+        self.halted = False
         self.respect_pc = respect_pc
         if initial_sprs is None:
             initial_sprs = {}
@@ -523,6 +524,10 @@ class ISACaller:
         return asmop
 
     def call(self, name):
+        if self.halted:
+            print ("halted - not executing", name)
+            return
+
         # TODO, asmregs is from the spec, e.g. add RT,RA,RB
         # see http://bugs.libre-riscv.org/show_bug.cgi?id=282
         asmop = yield from self.get_assembly_name()
@@ -538,6 +543,10 @@ class ISACaller:
             self.pc.update(self.namespace)
             return
 
+        if name == 'attn':
+            self.halted = True
+            return
+
         info = self.instrs[name]
         yield from self.prep_namespace(info.form, info.op_fields)