from ieee754.part_shift.part_shift_scalar import PartitionedScalarShift
from ieee754.part_mul_add.partpoints import make_partition2, PartitionPoints
from ieee754.part_mux.part_mux import PMux
-from ieee754.part_cat.cat import PartitionedCat
+from ieee754.part_cat.pcat import PCat
from operator import or_, xor, and_, not_
from nmigen import (Signal, Const)
modnames = {}
# for sub-modules to be created on-demand. Mux is done slightly
# differently (has its own global)
-for name in ['add', 'eq', 'gt', 'ge', 'ls', 'xor', 'cat']:
+for name in ['add', 'eq', 'gt', 'ge', 'ls', 'xor']:
modnames[name] = 0
assert isinstance(sig, PartitionedSignal), \
"All PartitionedSignal.__Cat__ arguments must be " \
"a PartitionedSignal. %s is not." % repr(sig)
- pc = PartitionedCat(args, self.partpoints)
- setattr(self.m.submodules, self.get_modname('cat'), pc)
+ return PCat(self.m, args, self.partpoints)
# unary ops that do not require partitioning
from ieee754.part.test.test_partsig import create_simulator
+modcount = 0 # global for now
+def PCat(m, arglist, mask):
+ global modcount
+ modcount += 1
+ pc = PartitionedCat(arglist, mask)
+ setattr(m.submodules, "pcat%d" % modcount, pc)
+ return pc.output
+
def get_runlengths(pbit, size):
res = []
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+# See Notices.txt for copyright information
+# Copyright (C) 2021 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
+
+
+modcount = 0 # global for now
+def PCat(m, arglist, mask):
+ from ieee754.part_cat.cat import PartitionedCat # avoid recursive import
+ global modcount
+ modcount += 1
+ pc = PartitionedCat(arglist, mask)
+ setattr(m.submodules, "pcat%d" % modcount, pc)
+ return pc.output