run tests in parallel
[ieee754fpu.git] / src / ieee754 / fpcommon / basedata.py
1 # IEEE Floating Point Adder (Single Precision)
2 # Copyright (C) 2019 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
3
4 from nmigen import Signal
5 from ieee754.fpcommon.getop import FPPipeContext
6
7
8 class FPBaseData:
9
10 def __init__(self, pspec):
11 width = pspec.width
12 n_ops = pspec.n_ops
13 self.ctx = FPPipeContext(pspec)
14 ops = []
15 for i in range(n_ops):
16 name = chr(ord("a")+i)
17 operand = Signal(width, name=name)
18 setattr(self, name, operand)
19 ops.append(operand)
20 self.muxid = self.ctx.muxid # make muxid available here: complicated
21 self.ops = ops
22
23 def eq(self, i):
24 ret = []
25 for op1, op2 in zip(self.ops, i.ops):
26 ret.append(op1.eq(op2))
27 ret.append(self.ctx.eq(i.ctx))
28 return ret
29
30 def __iter__(self):
31 if self.ops:
32 yield from self.ops
33 yield from self.ctx
34
35 def ports(self):
36 return list(self)
37
38