from ieee754.fpcommon.fpbase import FPState
from ieee754.fpcommon.denorm import FPSCData
from ieee754.fpcommon.postcalc import FPAddStage1Data
+from ieee754.div_rem_sqrt_rsqrt.div_pipe import DivPipeInterstageData
# TODO: write these
from .div0 import FPDivStage0Mod
-from .div1 import FPDivStage1Mod # can be dropped entirely
- # (replaced with DivPipeCalculateStage)
- # note, yes, DivPipeCalculateStage *NOT*
- # DivPipeCoreCalculateStage
from .div2 import FPDivStage2Mod
from .div0 import FPDivStage0Data
class FPDivStagesSetup(FPState, SimpleHandshake):
- def __init__(self, pspec, n_stages):
+ def __init__(self, pspec, n_stages, stage_offs):
FPState.__init__(self, "divsetup")
self.pspec = pspec
self.n_stages = n_stages # number of combinatorial stages
+ self.stage_offs = stage_offs # each CalcStage needs *absolute* idx
SimpleHandshake.__init__(self, self) # pipeline is its own stage
self.m1o = self.ospec()
return FPSCData(self.pspec, False) # from denorm
def ospec(self):
- # XXX TODO: replace with "intermediary" (DivPipeInterstageData)
- return FPDivStage0Data(self.pspec) # DIV ospec (loop)
+ return DivPipeInterstageData(self.pspec) # DIV ospec (loop)
def setup(self, m, i):
""" links module to inputs and outputs.
note: this is a pure *combinatorial* module (StageChain).
therefore each sub-module must also be combinatorial
- (and not do too much: in particular, n_stages must be
- reduced slightly when either self.end=True or self.begin=True)
"""
divstages = []
# does 1 "convert" (actual processing) from DivPipeInputData
# into "intermediate" output (DivPipeInterstageData)
- # vvvvvvv
- # FIXME divstages.append(DivPipeSetupStage(something))
- # ^^^^^^^
+ divstages.append(DivPipeSetupStage(self.pspec))
# here is where the intermediary stages are added.
- # n_stages is adjusted (in pipeline.py), reduced to take
- # into account the extra processing that self.begin and self.end
- # will add.
+ # n_stages is adjusted (by pipeline.py), reduced to take
+ # into account extra processing that FPDivStage0Mod and DivPipeSetup
+ # might add.
for count in range(self.n_stages): # number of combinatorial stages
- # XXX: this can actually be entirely dropped...
- divstages.append(FPDivStage1Mod(self.pspec))
-
- # ... and replaced with this.
- # vvvvvvv
- #divstages.append(DivPipeCalculateStage(core_config, count))
- # ^^^^^^^
+ idx = count + self.stage_offs
+ divstages.append(DivPipeCalculateStage(self.pspec, idx))
chain = StageChain(divstages)
chain.setup(m, i)
m.next = "normalise_1"
-class FPDivStagesIntermediary(FPState, SimpleHandshake):
+class FPDivStagesIntermediate(FPState, SimpleHandshake):
- def __init__(self, pspec, n_stages):
+ def __init__(self, pspec, n_stages, stage_offs):
FPState.__init__(self, "divintermediate")
self.pspec = pspec
self.n_stages = n_stages # number of combinatorial stages
+ self.stage_offs = stage_offs # each CalcStage needs *absolute* idx
SimpleHandshake.__init__(self, self) # pipeline is its own stage
self.m1o = self.ospec()
def ispec(self):
# TODO - this is for FPDivStage1Mod
- # XXX TODO: replace with "intermediary" (DivPipeInterstageData)
- return FPDivStage0Data(self.pspec) # DIV ispec (loop)
+ return DivPipeInterstageData(self.pspec) # DIV ispec (loop)
def ospec(self):
# TODO - this is for FPDivStage1Mod
- # XXX TODO: replace with "intermediary" (DivPipeInterstageData)
- return FPDivStage0Data(self.pspec) # DIV ospec (loop)
+ return DivPipeInterstageData(self.pspec) # DIV ospec (loop)
def setup(self, m, i):
""" links module to inputs and outputs.
note: this is a pure *combinatorial* module (StageChain).
therefore each sub-module must also be combinatorial
- (and not do too much)
"""
divstages = []
# into account the extra processing that self.begin and self.end
# will add.
for count in range(self.n_stages): # number of combinatorial stages
- # XXX: this can actually be entirely dropped...
- divstages.append(FPDivStage1Mod(self.pspec))
-
- # ... and replaced with this.
- # vvvvvvv
- #divstages.append(DivPipeCalculateStage(core_config, count))
- # ^^^^^^^
+ idx = count + self.stage_offs
+ divstages.append(DivPipeCalculateStage(self.pspec, idx))
chain = StageChain(divstages)
chain.setup(m, i)
class FPDivStagesFinal(FPState, SimpleHandshake):
- def __init__(self, pspec, n_stages):
+ def __init__(self, pspec, n_stages, stage_offs):
FPState.__init__(self, "divfinal")
self.pspec = pspec
self.n_stages = n_stages # number of combinatorial stages
+ self.stage_offs = stage_offs # each CalcStage needs *absolute* idx
SimpleHandshake.__init__(self, self) # pipeline is its own stage
self.m1o = self.ospec()
def ispec(self):
- # XXX TODO: replace with "intermediary" (DivPipeInterstageData?)
- return FPDivStage0Data(self.pspec) # DIV ispec (loop)
+ return DivPipeInterstageData(self.pspec) # DIV ispec (loop)
def ospec(self):
# REQUIRED. do NOT change.
note: this is a pure *combinatorial* module (StageChain).
therefore each sub-module must also be combinatorial
- (and not do too much)
"""
# takes the DIV pipeline/chain data and munges it
# into account the extra processing that self.begin and self.end
# will add.
for count in range(self.n_stages): # number of combinatorial stages
- # XXX: this can actually be entirely dropped...
- divstages.append(FPDivStage1Mod(self.pspec))
-
- # ... and replaced with this.
- # vvvvvvv
- #divstages.append(DivPipeCalculateStage(core_config, count))
- # ^^^^^^^
+ idx = count + self.stage_offs
+ divstages.append(DivPipeCalculateStage(pspec, idx))
# does the final conversion from intermediary to output data
- # vvvvvvv
- # FIXME divstages.append(DivPipeFinalStage(something))
- # ^^^^^^^
+ divstages.append(DivPipeFinalStage(pspec))
# does conversion from DivPipeOutputData into
# FPAddStage1Data format (bad name, TODO, doesn't matter),