From af7a2b39d5463ae787c9c7d5f80140b7921c9f6d Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 16 Jun 2019 13:01:24 +0100 Subject: [PATCH] get fp mul pipe working using new FPNumBaseRecord --- src/ieee754/fpmul/mul0.py | 10 +++++----- src/ieee754/fpmul/mul1.py | 4 ++-- src/ieee754/fpmul/specialcases.py | 12 ++++++------ src/nmutil/concurrentunit.py | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ieee754/fpmul/mul0.py b/src/ieee754/fpmul/mul0.py index b488c95c..6c264fbc 100644 --- a/src/ieee754/fpmul/mul0.py +++ b/src/ieee754/fpmul/mul0.py @@ -5,7 +5,7 @@ from nmigen import Module, Signal, Cat, Elaboratable from nmigen.cli import main, verilog -from ieee754.fpcommon.fpbase import FPNumBase +from ieee754.fpcommon.fpbase import FPNumBaseRecord from ieee754.fpcommon.fpbase import FPState from ieee754.fpcommon.denorm import FPSCData @@ -13,7 +13,7 @@ from ieee754.fpcommon.denorm import FPSCData class FPMulStage0Data: def __init__(self, width, id_wid): - self.z = FPNumBase(width, False) + self.z = FPNumBaseRecord(width, False) self.out_do_z = Signal(reset_less=True) self.oz = Signal(width, reset_less=True) mw = (self.z.m_width)*2 - 1 + 3 # sticky/round/guard bits + (2*mant) - 1 @@ -50,9 +50,9 @@ class FPMulStage0Mod(Elaboratable): def elaborate(self, platform): m = Module() - m.submodules.mul0_in_a = self.i.a - m.submodules.mul0_in_b = self.i.b - m.submodules.mul0_out_z = self.o.z + #m.submodules.mul0_in_a = self.i.a + #m.submodules.mul0_in_b = self.i.b + #m.submodules.mul0_out_z = self.o.z # store intermediate tests (and zero-extended mantissas) am0 = Signal(len(self.i.a.m)+1, reset_less=True) diff --git a/src/ieee754/fpmul/mul1.py b/src/ieee754/fpmul/mul1.py index 9e826267..d932871b 100644 --- a/src/ieee754/fpmul/mul1.py +++ b/src/ieee754/fpmul/mul1.py @@ -31,7 +31,7 @@ class FPMulStage1Mod(FPState, Elaboratable): """ links module to inputs and outputs """ m.submodules.mul1 = self - m.submodules.mul1_out_overflow = self.o.of + #m.submodules.mul1_out_overflow = self.o.of m.d.comb += self.i.eq(i) @@ -60,7 +60,7 @@ class FPMulStage1(FPState): def __init__(self, width, id_wid): FPState.__init__(self, "multiply_1") self.mod = FPMulStage1Mod(width) - self.out_z = FPNumBase(width, False) + self.out_z = FPNumBaseRecord(width, False) self.out_of = Overflow() self.norm_stb = Signal() diff --git a/src/ieee754/fpmul/specialcases.py b/src/ieee754/fpmul/specialcases.py index 83f82558..b7a59b37 100644 --- a/src/ieee754/fpmul/specialcases.py +++ b/src/ieee754/fpmul/specialcases.py @@ -4,7 +4,7 @@ from nmigen import Module, Signal, Cat, Const, Elaboratable from nmigen.cli import main, verilog from math import log -from ieee754.fpcommon.fpbase import FPNumDecode +from ieee754.fpcommon.fpbase import FPNumDecode, FPNumBaseRecord from nmutil.singlepipe import SimpleHandshake, StageChain from ieee754.fpcommon.fpbase import FPState, FPID @@ -42,13 +42,13 @@ class FPMulSpecialCasesMod(Elaboratable): def elaborate(self, platform): m = Module() - m.submodules.sc_out_z = self.o.z + #m.submodules.sc_out_z = self.o.z # decode: XXX really should move to separate stage - a1 = FPNumDecode(None, self.width, False) - b1 = FPNumDecode(None, self.width, False) - m.submodules.sc_decode_a = a1 - m.submodules.sc_decode_b = b1 + a1 = FPNumBaseRecord(self.width, False) + b1 = FPNumBaseRecord(self.width, False) + m.submodules.sc_decode_a = a1 = FPNumDecode(None, a1) + m.submodules.sc_decode_b = b1 = FPNumDecode(None, b1) m.d.comb += [a1.v.eq(self.i.a), b1.v.eq(self.i.b), self.o.a.eq(a1), diff --git a/src/nmutil/concurrentunit.py b/src/nmutil/concurrentunit.py index 5f02d7cd..3d426ff9 100644 --- a/src/nmutil/concurrentunit.py +++ b/src/nmutil/concurrentunit.py @@ -9,7 +9,7 @@ """ from math import log -from nmigen import Module +from nmigen import Module, Elaboratable from nmigen.cli import main, verilog from nmutil.singlepipe import PassThroughStage @@ -35,7 +35,7 @@ class FPADDMuxOutPipe(CombMuxOutPipe): CombMuxOutPipe.__init__(self, stage, n_len=self.num_rows) -class ReservationStations: +class ReservationStations(Elaboratable): """ Reservation-Station pipeline Input: num_rows - number of input and output Reservation Stations -- 2.30.2