From: Luke Kenneth Casson Leighton Date: Sat, 16 Feb 2019 09:47:55 +0000 (+0000) Subject: separate common functions into FPBase class X-Git-Tag: ls180-24jan2020~1953 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b6803d366abaab2533647de4b0f569bea2c6750f;p=ieee754fpu.git separate common functions into FPBase class --- diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 68b3a093..675ef4b3 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -111,13 +111,13 @@ class Overflow: self.sticky = Signal() # tot[0] -class FPADD: - def __init__(self, width): - self.width = width +class FPBase: + """ IEEE754 Floating Point Base Class - self.in_a = FPOp(width) - self.in_b = FPOp(width) - self.out_z = FPOp(width) + contains common functions for FP manipulation, such as + extracting and packing operands, normalisation, denormalisation, + rounding etc. + """ def get_op(self, m, op, v, next_state): """ this function moves to the next state and copies the operand @@ -222,6 +222,17 @@ class FPADD: m.d.sync += out_z.stb.eq(0) m.next = next_state + +class FPADD(FPBase): + + def __init__(self, width): + FPBase.__init__(self) + self.width = width + + self.in_a = FPOp(width) + self.in_b = FPOp(width) + self.out_z = FPOp(width) + def get_fragment(self, platform=None): """ creates the HDL code-fragment for FPAdd """