end loop condition in svp64 bc pseudo-code
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 14 Aug 2021 17:09:35 +0000 (18:09 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 14 Aug 2021 17:09:35 +0000 (18:09 +0100)
openpower/isa/svbranch.mdwn
src/openpower/decoder/isa/caller.py
src/openpower/decoder/pseudo/pywriter.py

index 7caa7d3f7e918592b7df159fef2db6e1642fd361..0c15a04d6725d57beabc734a32e922bc9d3a1ff8 100644 (file)
@@ -66,6 +66,7 @@ Pseudo-code:
       if AA then NIA <-iea EXTS(BD || 0b00)
       else       NIA <-iea CIA + EXTS(BD || 0b00)
       lr_ok <- 0b1
+      end_loop <- 0b1
     if LK & lr_ok then LR <-iea CIA + 4
 
 Special Registers Altered:
index 0026f332cf79e3f1b6ee1c04e1683d1fcc5389da..6ff2435ac851270c50b2d43c173912f0415b2445 100644 (file)
@@ -807,8 +807,7 @@ class ISACaller:
             self.namespace['sz'] = SelectableInt(sz, 1)
             self.namespace['SNZ'] = SelectableInt(bc_snz, 1)
             # use these to detect if the branch took place
-            self.namespace['ctr_ok'] = SelectableInt(0, 1)
-            self.namespace['cond_ok'] = SelectableInt(0, 1)
+            self.namespace['end_loop'] = SelectableInt(0, 1)
 
     def handle_carry_(self, inputs, outputs, already_done):
         inv_a = yield self.dec2.e.do.invert_in
@@ -1797,10 +1796,9 @@ class ISACaller:
             self.namespace['SVSTATE'] = self.svstate
             # check if this was an sv.bc* and if so did it succeed
             if self.is_svp64_mode and insn_name.startswith("sv.bc"):
-                ctr_ok = self.namespace['ctr_ok']
-                cond_ok = self.namespace['cond_ok']
-                log("branch ctr/cond", ctr_ok, cond_ok)
-                if ctr_ok.value and cond_ok.value :
+                end_loop = self.namespace['end_loop']
+                log("branch ctr/cond", end_loop)
+                if end_loop.value:
                     self.svp64_reset_loop()
                     self.update_pc_next()
                     return True
@@ -1868,10 +1866,6 @@ def inject():
                   args[0].namespace['NIA'],
                   args[0].namespace['SVSTATE'])
             args[0].namespace = func_globals
-            if 'cond_ok' in args[0].namespace:
-                log("args[0] cond_ok ctr_ok",
-                      args[0].namespace['cond_ok'],
-                      args[0].namespace['ctr_ok'])
             #exec (func.__code__, func_globals)
 
             # finally:
index 8cde6d1964e3c7e0098154d9f0172919fdaf0dfb..efca91c9094a0c473affb50f666901fc968d45a7 100644 (file)
@@ -96,7 +96,7 @@ class PyISAWriter(ISA):
                 # blech! this works in combination with ISACaller
                 # @inject decorator, which works by injecting
                 # global variables into the function namespace.
-                for blech in ['NIA', 'cond_ok', 'ctr_ok']:
+                for blech in ['NIA', 'end_loop']:
                     if blech in pycode:  # HACK - TODO fix
                         f.write("        global %s\n" % blech)
                 pycode = pycode.split("\n")