from ieee754.fpcommon.fpbase import FPState
from ieee754.fpcommon.postcalc import FPAddStage1Data
-from .div0 import FPDivStage0Data
+from .div0 import FPDivStage0Data # XXX TODO: replace
-class FPDivStage1Mod(FPState, Elaboratable):
+class FPDivStage2Mod(FPState, Elaboratable):
""" Second stage of div: preparation for normalisation.
"""
- def __init__(self, width, id_wid):
+ def __init__(self, width, pspec):
self.width = width
- self.id_wid = id_wid
+ self.pspec = pspec
self.i = self.ispec()
self.o = self.ospec()
def ispec(self):
- return FPDivStage0Data(self.width, self.id_wid)
+ # TODO: DivPipeCoreInterstageData
+ return FPDivStage0Data(self.width, self.pspec) # Q/Rem in...
def ospec(self):
- return FPAddStage1Data(self.width, self.id_wid)
+ # XXX REQUIRED. MUST NOT BE CHANGED. this is the format
+ # required for ongoing processing (normalisation, correction etc.)
+ return FPAddStage1Data(self.width, self.pspec) # out to post-process
def process(self, i):
return self.o
# last-stage guard/round/sticky and copies mantissa into z.
# post-processing stages take care of things from that point.
+ # NOTE: this phase does NOT do ACTUAL DIV processing, it ONLY
+ # does "conversion" *out* of the Q/REM last stage
+
with m.If(~self.i.out_do_z):
mw = self.o.z.m_width
m.d.comb += [
m.d.comb += self.o.out_do_z.eq(self.i.out_do_z)
m.d.comb += self.o.oz.eq(self.i.oz)
- m.d.comb += self.o.mid.eq(self.i.mid)
+ m.d.comb += self.o.ctx.eq(self.i.ctx)
return m
-class FPDivStage1(FPState):
+class FPDivStage2(FPState):
- def __init__(self, width, id_wid):
+ def __init__(self, width, pspec):
FPState.__init__(self, "divider_1")
- self.mod = FPDivStage1Mod(width)
+ self.mod = FPDivStage2Mod(width)
self.out_z = FPNumBaseRecord(width, False)
self.out_of = Overflow()
self.norm_stb = Signal()