from ieee754.part_mul_add.partpoints import PartitionPoints
-
class Twomux(Elaboratable):
+
def __init__(self):
self.ina = Signal()
self.inb = Signal()
self.sel = Signal()
self.outa = Signal()
self.outb = Signal()
+
def elaborate(self, platform):
m = Module()
comb = m.d.comb
#equals.py's giant switch statement. The idea is to use a tree of two
#input/two output multiplexors and or gates to select whether each
#signal is or isn't combined with its neighbors.
+
class EQCombiner(Elaboratable):
+
def __init__(self, width):
self.width = width
self.neqs = Signal(width, reset_less=True)
comb = m.d.comb
previnput = self.neqs[-1]
+
for i in range(self.width-1, 0, -1): # counts down from width-1 to 1
m.submodules["mux%d" % i] = mux = Twomux()
from ieee754.part_mul_add.partpoints import PartitionPoints
class Combiner(Elaboratable):
+
def __init__(self):
self.ina = Signal()
self.inb = Signal()
self.sel = Signal()
self.outa = Signal()
self.outb = Signal()
+
def elaborate(self, platform):
m = Module()
comb = m.d.comb
# partition's greater than flag is set, or the current partition's
# equal flag is set AND the previous partition's greater than output
# is true
+
class GTCombiner(Elaboratable):
+
def __init__(self, width):
self.width = width
self.mux_input = Signal(reset_less=True) # right hand side mux input
comb = m.d.comb
previnput = self.gts[-1] | (self.eqs[-1] & self.mux_input)
+
for i in range(self.width-1, 0, -1): # counts down from width-1 to 1
m.submodules["mux%d" % i] = mux = Combiner()