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)]
self.roundz = Signal(reset_less=True)
+ def __iter__(self):
+ yield self.guard
+ yield self.round_bit
+ yield self.sticky
+ yield self.m0
+
def eq(self, inp):
return [self.guard.eq(inp.guard),
self.round_bit.eq(inp.round_bit),
self.out_do_z = Signal(reset_less=True)
self.mid = Signal(id_wid, reset_less=True)
+ def __iter__(self):
+ yield from self.a
+ yield from self.b
+ yield from self.z
+ yield self.oz
+ yield self.out_do_z
+ yield self.mid
+
def eq(self, i):
return [self.z.eq(i.z), self.out_do_z.eq(i.out_do_z), self.oz.eq(i.oz),
self.a.eq(i.a), self.b.eq(i.b), self.mid.eq(i.mid)]
self.z = Signal(width, reset_less=True)
self.mid = Signal(id_wid, reset_less=True)
+ def __iter__(self):
+ yield self.z
+ yield self.mid
+
def eq(self, i):
return [self.z.eq(i.z), self.mid.eq(i.mid)]
def ports(self):
- return [self.z, self.mid]
+ return list(self)
class FPPackMod:
self.of = Overflow()
self.mid = Signal(id_wid, reset_less=True)
+ def __iter__(self):
+ yield from self.z
+ yield self.out_do_z
+ yield self.oz
+ yield from self.of
+ yield self.mid
+
def eq(self, i):
return [self.z.eq(i.z), self.out_do_z.eq(i.out_do_z), self.oz.eq(i.oz),
self.of.eq(i.of), self.mid.eq(i.mid)]
return res
+def shape(i):
+ print ("shape", i)
+ r = 0
+ for part in list(i):
+ print ("shape?", part)
+ s, _ = part.shape()
+ r += s
+ return r, False
+
+
def cat(i):
""" flattens a compound structure recursively using Cat
"""
""" handles case where stage has dynamic ready/valid functions
"""
m = Module()
+ m.submodules.p = self.p
+ m.submodules.n = self.n
if self.stage is not None and hasattr(self.stage, "setup"):
self.stage.setup(m, self.p.i_data)
self.m = m = ControlBase._elaborate(self, platform)
# make a FIFO with a signal of equal width to the o_data.
- (fwidth, _) = self.n.o_data.shape()
+ (fwidth, _) = shape(self.n.o_data)
if self.buffered:
fifo = SyncFIFOBuffered(fwidth, self.fdepth)
else:
fwft=True, pipe=False)
-"""
# this is *probably* SimpleHandshake (note: memory cell size=0)
class SimpleHandshake(FIFOControl):
def __init__(self, stage, in_multi=None, stage_ctl=False):
FIFOControl.__init__(self, 0, stage, in_multi, stage_ctl,
fwft=True, pipe=False)
-"""
self.idx = Signal(8, reset_less=True)
self.data = Signal(16, reset_less=True)
- def _rhs_signals(self):
- return self.ports()
+ def __iter__(self):
+ yield self.mid
+ yield self.idx
+ yield self.data
def shape(self):
bits, sign = 0, False
return [self.mid.eq(i.mid), self.idx.eq(i.idx), self.data.eq(i.data)]
def ports(self):
- return [self.mid, self.idx, self.data]
+ return list(self)
class PassThroughStage:
from nmigen.cli import verilog, rtlil
from multipipe import CombMuxOutPipe
-from singlepipe import SimpleHandshake
+from singlepipe import SimpleHandshake, PassThroughHandshake
class PassInData:
self.mid = Signal(2, reset_less=True)
self.data = Signal(16, reset_less=True)
+ def __iter__(self):
+ yield self.mid
+ yield self.data
+
def eq(self, i):
return [self.mid.eq(i.mid), self.data.eq(i.data)]
-class PassThroughPipe(SimpleHandshake):
+class PassThroughPipe(PassThroughHandshake):
def __init__(self):
- SimpleHandshake.__init__(self, PassThroughDataStage())
+ PassThroughHandshake.__init__(self, PassThroughDataStage())
def elaborate(self, platform):
m = Module()
- m.submodules += self.pipe
- m.submodules += self.muxpipe
+ m.submodules.pipe = self.pipe
+ m.submodules.muxpipe = self.muxpipe
m.d.comb += self.pipe.n.connect_to_next(self.muxpipe.p)
return m