From: Luke Kenneth Casson Leighton Date: Wed, 29 Sep 2021 18:28:11 +0000 (+0100) Subject: add support in PartitionedAssign for scalar signals X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=359537564b3fcc1e9f0f900decde588cd28079d7;p=ieee754fpu.git add support in PartitionedAssign for scalar signals --- diff --git a/src/ieee754/part_ass/assign.py b/src/ieee754/part_ass/assign.py index 34472b40..1bc87c74 100644 --- a/src/ieee754/part_ass/assign.py +++ b/src/ieee754/part_ass/assign.py @@ -67,16 +67,21 @@ class PartitionedAssign(Elaboratable): def get_chunk(self, y, numparts): x = self.assign - keys = [0] + list(x.partpoints.keys()) + [len(x.sig)] + if not isinstance(x, PartitionedSignal): + # assume Scalar. totally different rules + end = numparts * (len(x) // self.mwidth) + return x[:end] + # PartitionedSignal: start at partition point + keys = [0] + list(x.partpoints.keys()) + [len(x)] # get current index and increment it (for next Assign chunk) upto = y[0] y[0] += numparts - print ("getting", upto, numparts, keys, len(x.sig)) + print ("getting", upto, numparts, keys, len(x)) # get the partition point as far as we are up to start = keys[upto] end = keys[upto+numparts] - print ("start end", start, end, len(x.sig)) - return x.sig[start:end] + print ("start end", start, end, len(x)) + return x[start:end] def elaborate(self, platform): m = Module() @@ -114,7 +119,9 @@ class PartitionedAssign(Elaboratable): return m def ports(self): - return [self.assign.sig, self.output.sig] + if isinstance(self.assign, PartitionedSignal): + return [self.assign.sig, self.output.sig] + return [self.assign, self.output.sig] if __name__ == "__main__": @@ -123,6 +130,7 @@ if __name__ == "__main__": mask = Signal(3) a = PartitionedSignal(mask, 32) m.submodules.ass = ass = PartitionedAssign(signed(48), a, mask) + omask = (1<