From 54bd409c7fb8b5c7566f591a85d968ee029dde29 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 26 Sep 2022 15:59:33 -0700 Subject: [PATCH] pcdec.: change CR0.eq to be early-stop-needed to fit with data-dependent fail-first --- openpower/isa/prefix_codes.mdwn | 5 ++++- src/openpower/test/prefix_codes/prefix_codes_cases.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openpower/isa/prefix_codes.mdwn b/openpower/isa/prefix_codes.mdwn index 88606e7b..fc6d7be9 100644 --- a/openpower/isa/prefix_codes.mdwn +++ b/openpower/isa/prefix_codes.mdwn @@ -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: diff --git a/src/openpower/test/prefix_codes/prefix_codes_cases.py b/src/openpower/test/prefix_codes/prefix_codes_cases.py index 0be52faa..114963b8 100644 --- a/src/openpower/test/prefix_codes/prefix_codes_cases.py +++ b/src/openpower/test/prefix_codes/prefix_codes_cases.py @@ -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, -- 2.30.2