From a121e3ea4e840fa8111885dd3d76d514a8194cc8 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 6 Feb 2020 14:31:42 +0000 Subject: [PATCH] add __ge__ partsig operator --- src/ieee754/part/partsig.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py index 4740e68e..097e4307 100644 --- a/src/ieee754/part/partsig.py +++ b/src/ieee754/part/partsig.py @@ -38,7 +38,7 @@ class PartitionedSignal: width = self.sig.shape()[0] # get signal width self.partpoints = make_partition(mask, width) # create partition points self.modnames = {} - for name in ['add', 'eq', 'gt']: + for name in ['add', 'eq', 'gt', 'ge']: self.modnames[name] = 0 def set_module(self, m): @@ -107,3 +107,17 @@ class PartitionedSignal: else: comb += pa.b.eq(other) return pa.output + + def __ge__(self, other): + print ("ge", self, other) + shape = self.sig.shape() + pa = PartitionedEqGtGe(shape[0], self.partpoints) + setattr(self.m.submodules, self.get_modname('ge'), pa) + comb = self.m.d.comb + comb += pa.opcode.eq(PartitionedEqGtGe.GE) # set opcode to GE + comb += pa.a.eq(self.sig) + if isinstance(other, PartitionedSignal): + comb += pa.b.eq(other.sig) + else: + comb += pa.b.eq(other) + return pa.output -- 2.30.2