Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kestrel Collaboration
Kestrel LibreSoC
soc
Commits
ed18e275
Commit
ed18e275
authored
2 years ago
by
Jacob Lifshay
Browse files
Options
Download
Email Patches
Plain Diff
move GoldschmidtDivState
parent
b5d416df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
src/soc/fu/div/experiment/goldschmidt_div_sqrt.py
src/soc/fu/div/experiment/goldschmidt_div_sqrt.py
+29
-29
No files found.
src/soc/fu/div/experiment/goldschmidt_div_sqrt.py
View file @
ed18e275
...
...
@@ -315,35 +315,6 @@ class FixedPoint:
return
retval
@
dataclass
class
GoldschmidtDivState
:
orig_n
:
int
"""original numerator"""
orig_d
:
int
"""original denominator"""
n
:
FixedPoint
"""numerator -- N_prime[i] in the paper's algorithm 2"""
d
:
FixedPoint
"""denominator -- D_prime[i] in the paper's algorithm 2"""
f
:
"FixedPoint | None"
=
None
"""current factor -- F_prime[i] in the paper's algorithm 2"""
quotient
:
"int | None"
=
None
"""final quotient"""
remainder
:
"int | None"
=
None
"""final remainder"""
n_shift
:
"int | None"
=
None
"""amount the numerator needs to be left-shifted at the end of the
algorithm.
"""
class
ParamsNotAccurateEnough
(
Exception
):
"""raised when the parameters aren't accurate enough to have goldschmidt
division work."""
...
...
@@ -1005,6 +976,35 @@ class GoldschmidtDivOp(enum.Enum):
assert
False
,
f
"unimplemented GoldschmidtDivOp:
{
self
}
"
@
dataclass
class
GoldschmidtDivState
:
orig_n
:
int
"""original numerator"""
orig_d
:
int
"""original denominator"""
n
:
FixedPoint
"""numerator -- N_prime[i] in the paper's algorithm 2"""
d
:
FixedPoint
"""denominator -- D_prime[i] in the paper's algorithm 2"""
f
:
"FixedPoint | None"
=
None
"""current factor -- F_prime[i] in the paper's algorithm 2"""
quotient
:
"int | None"
=
None
"""final quotient"""
remainder
:
"int | None"
=
None
"""final remainder"""
n_shift
:
"int | None"
=
None
"""amount the numerator needs to be left-shifted at the end of the
algorithm.
"""
def
goldschmidt_div
(
n
,
d
,
params
):
""" Goldschmidt division algorithm.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment