switch to exact version of cython
[ieee754fpu.git] / src / ieee754 / fpcommon / packdata.py
1 # IEEE Floating Point Adder (Single Precision)
2 # Copyright (C) Jonathan P Dawson 2013
3 # 2013-12-12
4
5 from nmigen import Signal
6 from ieee754.fpcommon.getop import FPPipeContext
7
8
9 class FPPackData:
10
11 def __init__(self, pspec):
12 width = pspec.width
13 self.z = Signal(width, reset_less=True) # result
14 self.ctx = FPPipeContext(pspec)
15
16 # this is complicated: it's a workaround, due to the
17 # array-indexing not working properly in nmigen.
18 # self.ports() is used to access the ArrayProxy objects by name,
19 # however it doesn't work recursively. the workaround:
20 # drop the sub-objects into *this* scope and they can be
21 # accessed / set. it's horrible.
22 self.muxid = self.ctx.muxid
23 self.op = self.ctx.op
24
25 def eq(self, i):
26 return [self.z.eq(i.z), self.ctx.eq(i.ctx)]
27
28 def __iter__(self):
29 yield self.z
30 yield from self.ctx
31
32 def ports(self):
33 return list(self)