FPDivStagesFinal)
from ieee754.pipeline import PipelineSpec
from ieee754.div_rem_sqrt_rsqrt.core import DivPipeCoreConfig
+from nmutil.dynamicpipe import MaskCancellableRedir
class FPDIVBasePipe(ControlBase):
def __init__(self, pspec):
self.pspec = pspec
- ControlBase.__init__(self)
+ ControlBase.__init__(self, maskwid=pspec.maskwid)
pipechain = []
# to which the answer: "as few as possible"
fmt = FPFormat.standard(width)
log2_radix = 3 # tested options so far: 1, 2 and 3.
n_comb_stages = 2 # 2 compute stages per pipeline stage
+ maskwid = 1 # SIMD width effectively
# extra bits needed: guard + round (sticky comes from remainer.bool())
fraction_width = fmt.fraction_width
# the last stage
cfg = DivPipeCoreConfig(fmt.width, fraction_width, log2_radix)
+ self.pspec.pipekls = MaskCancellableRedir
+ self.pspec.maskwid = maskwid
self.pspec.fpformat = fmt
self.pspec.n_comb_stages = n_comb_stages
self.pspec.core_config = cfg
# new_pspec.opkls = DivPipeCoreOperation
# self.alu = FPDIVBasePipe(new_pspec)
self.alu = FPDIVBasePipe(self.pspec)
- ReservationStations.__init__(self, num_rows)
+ ReservationStations.__init__(self, num_rows, maskwid=maskwid)
class FPADDInMuxPipe(PriorityCombMuxInPipe):
- def __init__(self, num_rows, iospecfn):
+ def __init__(self, num_rows, iospecfn, maskwid=0):
self.num_rows = num_rows
stage = PassThroughStage(iospecfn)
- PriorityCombMuxInPipe.__init__(self, stage, p_len=self.num_rows)
+ PriorityCombMuxInPipe.__init__(self, stage, p_len=self.num_rows,
+ maskwid=maskwid)
class FPADDMuxOutPipe(CombMuxOutPipe):
- def __init__(self, num_rows, iospecfn):
+ def __init__(self, num_rows, iospecfn, maskwid=0):
self.num_rows = num_rows
stage = PassThroughStage(iospecfn)
- CombMuxOutPipe.__init__(self, stage, n_len=self.num_rows)
+ CombMuxOutPipe.__init__(self, stage, n_len=self.num_rows,
+ maskwid=maskwid)
class ReservationStations(Elaboratable):
Fan-in and Fan-out are combinatorial.
"""
- def __init__(self, num_rows):
- self.num_rows = num_rows
- self.inpipe = FPADDInMuxPipe(num_rows, self.i_specfn) # fan-in
- self.outpipe = FPADDMuxOutPipe(num_rows, self.o_specfn) # fan-out
+ def __init__(self, num_rows, maskwid=0):
+ self.num_rows = nr = num_rows
+ self.inpipe = FPADDInMuxPipe(nr, self.i_specfn, maskwid) # fan-in
+ self.outpipe = FPADDMuxOutPipe(nr, self.o_specfn, maskwid) # fan-out
self.p = self.inpipe.p # kinda annoying,
self.n = self.outpipe.n # use pipe in/out as this class in/out
from abc import ABCMeta
from nmutil.singlepipe import SimpleHandshake
+from nmutil.singlepipe import MaskCancellable
+
import threading
# with many thanks to jsbueno on stackexchange for this one
stage = args[0].stage
SimpleHandshake.__init__(self, stage)
+
+class MaskCancellableRedir(SimpleHandshake):
+ def __init__(self, mod, *args):
+ stage = self
+ maskwid = args[0].maskwid
+ if args[0].stage:
+ stage = args[0].stage
+ print ("redir mask", mod, args, maskwid)
+ MaskCancellable.__init__(self, stage, maskwid)
+