big (single-purpose) update: move width arg into pspec
[ieee754fpu.git] / src / ieee754 / fpcommon / postcalc.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.fpbase import Overflow, FPNumBaseRecord
7 from ieee754.fpcommon.getop import FPPipeContext
8
9 class FPAddStage1Data:
10
11 def __init__(self, pspec):
12 width = pspec['width']
13 self.z = FPNumBaseRecord(width, False)
14 self.out_do_z = Signal(reset_less=True)
15 self.oz = Signal(width, reset_less=True)
16 self.of = Overflow()
17 self.ctx = FPPipeContext(pspec)
18 self.muxid = self.ctx.muxid
19
20 def __iter__(self):
21 yield from self.z
22 yield self.out_do_z
23 yield self.oz
24 yield from self.of
25 yield from self.ctx
26
27 def eq(self, i):
28 return [self.z.eq(i.z), self.out_do_z.eq(i.out_do_z), self.oz.eq(i.oz),
29 self.of.eq(i.of), self.ctx.eq(i.ctx)]