def __Assign__(self, val, *, src_loc_at=0):
print ("partsig assign", self, val)
+ # this is a truly awful hack, outlined here:
+ # https://bugs.libre-soc.org/show_bug.cgi?id=731#c13
+ # during the period between constructing Simd-aware sub-modules
+ # and the elaborate() being called on them there is a window of
+ # opportunity to indicate which of those submodules is LHS and
+ # which is RHS. manic laughter is permitted. *gibber*.
+ if hasattr(self, "_hack_submodule"):
+ self._hack_submodule.set_lhs_mode(True)
+ if hasattr(val, "_hack_submodule"):
+ val._hack_submodule.set_lhs_mode(False)
return PAssign(self.m, self, val, self.ptype)
# TODO, http://bugs.libre-riscv.org/show_bug.cgi?id=458
self.partpoints = partpoints
self.a = SimdSignal(partpoints, width)
self.b = SimdSignal(partpoints, width*2)
- self.cat_out = Signal(width*3)
+ self.o = SimdSignal(partpoints, width*3)
+ self.cat_out = self.o.sig
def elaborate(self, platform):
m = Module()
comb = m.d.comb
self.a.set_module(m)
self.b.set_module(m)
+ self.o.set_module(m)
- comb += self.cat_out.eq(Cat(self.a, self.b))
+ comb += self.o.eq(Cat(self.a, self.b))
return m
self.partition_points = self.output.partpoints
self.mwidth = len(self.partition_points)+1
+ def set_lhs_mode(self, is_lhs):
+ """set an indication that this is a LHS mode
+ deliberately do not set self.is_lhs in the constructor
+ to a default value in order to detect when it is missing
+ """
+ self.is_lhs = is_lhs
+
def get_chunk(self, y, idx, numparts):
x = self.catlist[idx]
keys = [0] + list(x.partpoints.keys()) + [len(x.sig)]
return x.sig[start:end]
def elaborate(self, platform):
- print ("PartitionedCat start")
+ print ("PartitionedCat start", self.is_lhs)
m = Module()
comb = m.d.comb
setattr(m.submodules, "pcat%d" % modcount, pc)
# add terrible hack back-link to be able to access PartitionedCat
# in PartitionedAssign https://bugs.libre-soc.org/show_bug.cgi?id=731#c13
- pc.output.__hack_submodule = pc # blegh!
+ pc.output._hack_submodule = pc # blegh!
return pc.output