da449d27460ca05a0686fb5f7bd344ad0459f130
1 """IEEE754 Floating Point Library
3 Copyright (C) 2019 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
7 from nmigen
import Signal
8 from ieee754
.fpcommon
.fpbase
import FPNumBaseRecord
9 from ieee754
.fpcommon
.getop
import FPPipeContext
14 def __init__(self
, pspec
, m_extra
):
16 # NOTE: difference between z and oz is that oz is created by
17 # special-cases module(s) and will propagate, along with its
18 # "bypass" signal out_do_z, through the pipeline, *disabling*
19 # all processing of all subsequent stages.
20 self
.a
= FPNumBaseRecord(width
, m_extra
, name
="a") # operand a
21 self
.b
= FPNumBaseRecord(width
, m_extra
, name
="b") # operand b
22 self
.z
= FPNumBaseRecord(width
, False, name
="z") # denormed result
23 self
.oz
= Signal(width
, reset_less
=True) # "finished" (bypass) result
24 self
.out_do_z
= Signal(reset_less
=True) # "bypass" enabled
25 self
.ctx
= FPPipeContext(pspec
)
26 self
.muxid
= self
.ctx
.muxid
37 ret
= [self
.z
.eq(i
.z
), self
.out_do_z
.eq(i
.out_do_z
), self
.oz
.eq(i
.oz
),
38 self
.a
.eq(i
.a
), self
.b
.eq(i
.b
), self
.ctx
.eq(i
.ctx
)]