From 602f9017abdad6ed4aff365bf0bd51a70ae8f4eb Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sun, 15 Oct 2023 21:17:09 -0700 Subject: [PATCH] add comments telling people to keep the asm and python versions in sync --- src/openpower/test/bigint/powmod.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/openpower/test/bigint/powmod.py b/src/openpower/test/bigint/powmod.py index 3ba5045e..5fa237a7 100644 --- a/src/openpower/test/bigint/powmod.py +++ b/src/openpower/test/bigint/powmod.py @@ -380,6 +380,10 @@ class DivModKnuthAlgorithmD: return self.num_size + 1 def python(self, n, d, log_regex=False, on_corner_case=lambda desc: None): + # IMPORTANT: do_log calls match up with the expected register values + # in the assembly version at that point in the algorithm, please don't + # "simplify" all the seemingly-redundant local variable assignments, + # they match what actually happens in the assembly version. do_log = _DivModRegsRegexLogger(enabled=log_regex, regs=self.regs).log do_log(locals(), "start", @@ -649,6 +653,8 @@ class DivModKnuthAlgorithmD: return q, r def __asm_iter(self): + # IMPORTANT: the assembly matches up with the python version, if you + # make any changes, change the python version to match. if self.word_size != 64: raise NotImplementedError("only word_size == 64 is implemented") n_0 = self.regs["n_0"] -- 2.30.2