1 # IEEE Floating Point Adder (Single Precision)
2 # Copyright (C) Jonathan P Dawson 2013
5 from nmigen
import Signal
6 from ieee754
.fpcommon
.getop
import FPPipeContext
11 def __init__(self
, pspec
):
13 self
.z
= Signal(width
, reset_less
=True) # result
14 self
.ctx
= FPPipeContext(pspec
)
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
26 return [self
.z
.eq(i
.z
), self
.ctx
.eq(i
.ctx
)]