pcdec.: change CR0.eq to be early-stop-needed to fit with data-dependent fail-first
authorJacob Lifshay <programmerjake@gmail.com>
Mon, 26 Sep 2022 22:59:33 +0000 (15:59 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Mon, 26 Sep 2022 22:59:33 +0000 (15:59 -0700)
openpower/isa/prefix_codes.mdwn
src/openpower/test/prefix_codes/prefix_codes_cases.py

index 88606e7b4f1af0914369e3fbbe903a7980a1bc63..fc6d7be9547813679499f957710590efa2f3a565 100644 (file)
@@ -19,10 +19,12 @@ Pseudo-code:
     out_byte <- 0
     decoded[0:7] <- 1
     so_bit <- 0b0
+    early_stop <- 0b0
     do while out_byte < 8
         in_bit <- in_bits[63]
         if in_bits = 1 then
             if ra_used | (_RA = 0) then
+                early_stop <- 0b1
                 leave
             ra_used <- 0b1
             in_bit <- (RA)[63]
@@ -42,10 +44,11 @@ Pseudo-code:
                     leave
         else
             so_bit <- 0b1
+            early_stop <- 0b1
             leave
     RT <- output
     RS <- final_in_bits
-    CR0 <- final_ra_used || 0b0 || (output = 0) || so_bit
+    CR0 <- final_ra_used || (output = 0) || early_stop || so_bit
 
 Special Registers Altered:
 
index 0be52faa02fa7db85ed82b8a68b14382a603a37c..114963b80a5971d66c9cfa9721b532c2312a7590 100644 (file)
@@ -62,7 +62,8 @@ class PrefixCodesCases(TestAccumulatorBase):
         max_count = 1 if once else 8
         decoded, expected_SO = reference_pcdec(
             supported_codes, input_bits, max_count=max_count)
-        expected_EQ = len(decoded) == 0
+        expected_GT = len(decoded) == 0
+        expected_EQ = len(decoded) < max_count
         expected_RT = int.from_bytes(
             [int("1" + code, 2) for code in decoded], 'little')
         decoded_bits_len = len("".join(decoded))
@@ -91,7 +92,8 @@ class PrefixCodesCases(TestAccumulatorBase):
         e = ExpectedState(pc=4, int_regs=gprs)
         e.intregs[4] = expected_RT
         e.intregs[5] = expected_RS
-        e.crregs[0] = expected_ra_used * 8 + expected_EQ * 2 + expected_SO
+        e.crregs[0] = (expected_ra_used * 8 + expected_GT * 4
+                       + expected_EQ * 2 + expected_SO)
         with self.subTest(supported_codes=supported_codes,
                           input_bits=original_input_bits):
             self.add_case(Program(lst, False), gprs, expected=e,