# Copyright (C) Jonathan P Dawson 2013
# 2013-12-12
-from nmigen import Module, Signal, Cat
+from nmigen import Module, Signal, Cat, Elaboratable
from nmigen.cli import main, verilog
from fpbase import FPNumBase
self.tot.eq(i.tot), self.mid.eq(i.mid)]
-class FPAddStage0Mod:
+class FPAddStage0Mod(Elaboratable):
def __init__(self, width, id_wid):
self.width = width
# Copyright (C) Jonathan P Dawson 2013
# 2013-12-12
-from nmigen import Module, Signal
+from nmigen import Module, Signal, Elaboratable
from nmigen.cli import main, verilog
from math import log
from fpadd.add0 import FPAddStage0Data
-class FPAddStage1Mod(FPState):
+class FPAddStage1Mod(FPState, Elaboratable):
""" Second stage of add: preparation for normalisation.
detects when tot sum is too big (tot[27] is kinda a carry bit)
"""
# Copyright (C) Jonathan P Dawson 2013
# 2013-12-12
-from nmigen import Signal, Cat, Const, Mux, Module
+from nmigen import Signal, Cat, Const, Mux, Module, Elaboratable
from math import log
from operator import or_
from functools import reduce
return res
-class FPNumBase:
+class FPNumBase: #(Elaboratable):
""" Floating-point Base Number Class
"""
def __init__(self, width, m_extra=True):
return self.create2(s, self.N127, self.mzero)
-class MultiShiftRMerge:
+class MultiShiftRMerge(Elaboratable):
""" shifts down (right) and merges lower bits into m[0].
m[0] is the "sticky" bit, basically
"""
return m
-class FPNumShift(FPNumBase):
+class FPNumShift(FPNumBase, Elaboratable):
""" Floating-point Number Class for shifting
"""
def __init__(self, mainm, op, inv, width, m_extra=True):
self.m.eq(sm.lshift(self.m, maxslen))
]
-class Trigger:
+class Trigger(Elaboratable):
def __init__(self):
self.stb = Signal(reset=0)
]
-class Overflow:
+class Overflow(Elaboratable):
def __init__(self):
self.guard = Signal(reset_less=True) # tot[2]
self.round_bit = Signal(reset_less=True) # tot[1]
# Copyright (C) Jonathan P Dawson 2013
# 2013-12-12
-from nmigen import Module
+from nmigen import Module, Elaboratable
from nmigen.cli import main, verilog
from fpbase import FPState
from fpcommon.roundz import FPRoundData
-class FPCorrectionsMod:
+class FPCorrectionsMod(Elaboratable):
def __init__(self, width, id_wid):
self.width = width
# Copyright (C) Jonathan P Dawson 2013
# 2013-12-12
-from nmigen import Module, Signal, Cat, Mux, Array, Const
+from nmigen import Module, Signal, Cat, Mux, Array, Const, Elaboratable
from nmigen.lib.coding import PriorityEncoder
from nmigen.cli import main, verilog
from math import log
from fpbase import FPState
-class FPGetOpMod:
+class FPGetOpMod(Elaboratable):
def __init__(self, width):
self.in_op = FPOpIn(width)
self.out_op = Signal(width)
rmod = FPRoundMod(self.width, self.id_wid)
cmod = FPCorrectionsMod(self.width, self.id_wid)
pmod = FPPackMod(self.width, self.id_wid)
- chain = StageChain([nmod, rmod, cmod, pmod])
+ stages = [nmod, rmod, cmod, pmod]
+ chain = StageChain(stages)
chain.setup(m, i)
self.out_z = pmod.ospec()
# Copyright (C) Jonathan P Dawson 2013
# 2013-12-12
-from nmigen import Module, Signal
+from nmigen import Module, Signal, Elaboratable
from nmigen.cli import main, verilog
from fpbase import FPNumOut
self.mid = Signal(id_wid, reset_less=True)
-class FPPackMod:
+class FPPackMod(Elaboratable):
def __init__(self, width, id_wid):
self.width = width
# Copyright (C) Jonathan P Dawson 2013
# 2013-12-12
-from nmigen import Module, Signal, Cat, Mux
+from nmigen import Module, Signal, Cat, Mux, Elaboratable
from nmigen.lib.coding import PriorityEncoder
from nmigen.cli import main, verilog
from math import log
self.roundz.eq(i.roundz), self.mid.eq(i.mid)]
-class FPNorm1ModSingle:
+class FPNorm1ModSingle(Elaboratable):
def __init__(self, width, id_wid):
self.width = width
# Copyright (C) Jonathan P Dawson 2013
# 2013-12-12
-from nmigen import Module, Signal
+from nmigen import Module, Signal, Elaboratable
from nmigen.cli import main, verilog
from fpbase import FPNumBase
self.mid.eq(i.mid)]
-class FPRoundMod:
+class FPRoundMod(Elaboratable):
def __init__(self, width, id_wid):
self.width = width