def __init__(self, width, pspec):
FPState.__init__(self, "normalise_1")
+ print ("normtopack", pspec)
self.pspec = pspec
self.width = width
SimpleHandshake.__init__(self, self) # pipeline is its own stage
from ieee754.fpcommon.getop import FPPipeContext
-class FPPackData(Object):
+class FPPackData:
def __init__(self, width, pspec):
- Object.__init__(self)
self.z = Signal(width, reset_less=True) # result
self.ctx = FPPipeContext(width, pspec)
+
+ # this is complicated: it's a workaround, due to the
+ # array-indexing not working properly in nmigen.
+ # self.ports() is used to access the ArrayProxy objects by name,
+ # however it doesn't work recursively. the workaround:
+ # drop the sub-objects into *this* scope and they can be
+ # accessed / set. it's horrible.
self.muxid = self.ctx.muxid
+ self.op = self.ctx.op
+
+ def eq(self, i):
+ return [self.z.eq(i.z), self.ctx.eq(i.ctx)]
+
+ def __iter__(self):
+ yield self.z
+ yield from self.ctx
+
+ def ports(self):
+ return list(self)
+
class FPPackMod(Elaboratable):
yield from self.iterator2(ao.fields[field_name], val)
def arrayproxy_iter2(self, ao, ai):
+ print ("arrayproxy_iter2", ai.ports(), ai, ao)
for p in ai.ports():
print ("arrayproxy - p", p, p.name, ao)
op = getattr(ao, p.name)