From 381fd1efc7de1c456d172b96e5c85517a9cc4ad1 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Tue, 26 Apr 2022 21:57:40 -0700 Subject: [PATCH] split out non-derived params into separate class without all the accuracy checking stuff. --- src/soc/fu/div/experiment/goldschmidt_div_sqrt.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/soc/fu/div/experiment/goldschmidt_div_sqrt.py b/src/soc/fu/div/experiment/goldschmidt_div_sqrt.py index f57e0448..bdce6fd9 100644 --- a/src/soc/fu/div/experiment/goldschmidt_div_sqrt.py +++ b/src/soc/fu/div/experiment/goldschmidt_div_sqrt.py @@ -284,9 +284,9 @@ def _assert_accuracy(condition, msg="not accurate enough"): @dataclass(frozen=True, unsafe_hash=True) -class GoldschmidtDivParams: - """parameters for a Goldschmidt division algorithm. - Use `GoldschmidtDivParams.get` to find a efficient set of parameters. +class GoldschmidtDivParamsBase: + """parameters for a Goldschmidt division algorithm, excluding derived + parameters. """ io_width: int @@ -306,6 +306,13 @@ class GoldschmidtDivParams: iter_count: int """the total number of iterations of the division algorithm's loop""" + +@dataclass(frozen=True, unsafe_hash=True) +class GoldschmidtDivParams(GoldschmidtDivParamsBase): + """parameters for a Goldschmidt division algorithm. + Use `GoldschmidtDivParams.get` to find a efficient set of parameters. + """ + # tuple to be immutable, default so repr() works for debugging even when # __post_init__ hasn't finished running yet table: "tuple[FixedPoint, ...]" = field(init=False, default=NotImplemented) -- 2.30.2