from nmigen.cli import main, verilog
from math import log
-from ieee754.fpcommon.fpbase import FPNumIn, FPNumOut, FPNumBase
-from ieee754.fpcommon.fpbase import FPState
+from ieee754.fpcommon.fpbase import FPNumIn, FPNumOut, FPNumBaseRecord
+from ieee754.fpcommon.fpbase import FPState, FPNumBase
class FPSCData:
return res
-class FPNumBase: #(Elaboratable):
+class FPNumBaseRecord:
""" Floating-point Base Number Class
"""
def __init__(self, width, m_extra=True):
self.N127 = Const(-(e_max-1), (e_width, True))
self.N126 = Const(-(e_max-2), (e_width, True))
+ def __iter__(self):
+ yield self.s
+ yield self.e
+ yield self.m
+
+ def eq(self, inp):
+ return [self.s.eq(inp.s), self.e.eq(inp.e), self.m.eq(inp.m)]
+
+
+class FPNumBase(FPNumBaseRecord): # Elaboratable
+ """ Floating-point Base Number Class
+ """
+ def __init__(self, width, m_extra=True):
+ FPNumBaseRecord.__init__(self, width, m_extra)
+ e_width = self.e_width
+
self.is_nan = Signal(reset_less=True)
self.is_zero = Signal(reset_less=True)
self.is_inf = Signal(reset_less=True)
def _is_denormalised(self):
return (self.exp_n126) & (self.m_msbzero)
- def __iter__(self):
- yield self.s
- yield self.e
- yield self.m
-
- def eq(self, inp):
- return [self.s.eq(inp.s), self.e.eq(inp.e), self.m.eq(inp.m)]
-
class FPNumOut(FPNumBase):
""" Floating-point Number Class