1 """IEEE754 Floating Point Conversion
3 Copyright (C) 2019 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
4 Copyright (C) 2020 Michael Nolan <mtnolan2640@gmail.com>
8 from nmutil
.singlepipe
import ControlBase
9 from nmutil
.concurrentunit
import ReservationStations
, num_bits
11 from ieee754
.pipeline
import PipelineSpec
, DynamicPipe
13 from ieee754
.fpcmp
.fpcmp
import FPCMPPipeMod
16 class FPCMPStage(DynamicPipe
):
17 """ FPConversion and De-norm
20 def __init__(self
, in_pspec
):
21 stage
= FPCMPPipeMod(in_pspec
)
22 in_pspec
.stage
= stage
23 super().__init
__(in_pspec
)
26 class FPCMPBasePipe(ControlBase
):
27 def __init__(self
, pspec
):
28 ControlBase
.__init
__(self
)
29 self
.pipe1
= FPCMPStage(pspec
)
30 self
._eqs
= self
.connect([self
.pipe1
, ])
32 def elaborate(self
, platform
):
33 m
= ControlBase
.elaborate(self
, platform
)
34 m
.submodules
.fpcmp
= self
.pipe1
39 class FPCMPMuxInOut(ReservationStations
):
40 """ Reservation-Station version of FPCVT pipeline.
42 * fan-in on inputs (an array of FPBaseData: a,b,mid)
43 * converter pipeline (alu)
44 * fan-out on outputs (an array of FPPackData: z,mid)
46 Fan-in and Fan-out are combinatorial.
49 def __init__(self
, in_width
, num_rows
, op_wid
=2):
51 self
.id_wid
= num_bits(num_rows
)
53 self
.in_pspec
= PipelineSpec(in_width
, self
.id_wid
, self
.op_wid
)
55 self
.alu
= FPCMPBasePipe(self
.in_pspec
)
56 ReservationStations
.__init
__(self
, num_rows
)