From 12fddcfaa63fab4795c811285b52fb3afb2b808a Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 28 Jul 2019 11:21:12 +0100 Subject: [PATCH] add f32/f64 fclass --- src/ieee754/fclass/pipeline.py | 4 ++-- src/ieee754/fclass/test/test_fclass_pipe.py | 24 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/ieee754/fclass/pipeline.py b/src/ieee754/fclass/pipeline.py index 6a3ddb38..6550e684 100644 --- a/src/ieee754/fclass/pipeline.py +++ b/src/ieee754/fclass/pipeline.py @@ -52,7 +52,7 @@ class FPClassMod(Elaboratable): def setup(self, m, i): """ links module to inputs and outputs """ - m.submodules.upconvert = self + m.submodules.fclass = self m.d.comb += self.i.eq(i) def process(self, i): @@ -116,7 +116,7 @@ class FPClassBasePipe(ControlBase): def elaborate(self, platform): m = ControlBase.elaborate(self, platform) - m.submodules.down = self.pipe1 + m.submodules.fclass = self.pipe1 m.d.comb += self._eqs return m diff --git a/src/ieee754/fclass/test/test_fclass_pipe.py b/src/ieee754/fclass/test/test_fclass_pipe.py index 8c4726b8..9ebfcb87 100644 --- a/src/ieee754/fclass/test/test_fclass_pipe.py +++ b/src/ieee754/fclass/test/test_fclass_pipe.py @@ -44,12 +44,34 @@ def fclass_16(x): return fclass(16, x) +def fclass_32(x): + return fclass(32, x) + + +def fclass_64(x): + return fclass(64, x) + + def test_class_pipe_f16(): dut = FPClassMuxInOut(16, 16, 4, op_wid=1) - runfp(dut, 16, "test_fcvt_class_pipe_f16", Float16, fclass_16, + runfp(dut, 16, "test_fclass_pipe_f16", Float16, fclass_16, + True, n_vals=100) + + +def test_class_pipe_f32(): + dut = FPClassMuxInOut(32, 32, 4, op_wid=1) + runfp(dut, 32, "test_fclass_pipe_f32", Float32, fclass_32, + True, n_vals=100) + + +def test_class_pipe_f64(): + dut = FPClassMuxInOut(64, 64, 4, op_wid=1) + runfp(dut, 64, "test_fclass_pipe_f64", Float64, fclass_64, True, n_vals=100) if __name__ == '__main__': for i in range(200): test_class_pipe_f16() + test_class_pipe_f32() + test_class_pipe_f64() -- 2.30.2