1 # IEEE Floating Point Adder (Single Precision)
2 # Copyright (C) 2019 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
4 from nmigen
import Signal
5 from ieee754
.fpcommon
.getop
import FPPipeContext
10 def __init__(self
, pspec
, n_ops
=2):
12 self
.ctx
= FPPipeContext(pspec
)
14 for i
in range(n_ops
):
15 name
= chr(ord("a")+i
)
16 operand
= Signal(width
, name
=name
)
17 setattr(self
, name
, operand
)
19 self
.muxid
= self
.ctx
.muxid
# make muxid available here: complicated
24 for op1
, op2
in zip(self
.ops
, i
.ops
):
25 ret
.append(op1
.eq(op2
))
26 ret
.append(self
.ctx
.eq(i
.ctx
))