From c6fa259688b9a1bc21cc06a520e5cdd4f6331ec3 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 10 Oct 2021 11:33:23 +0100 Subject: [PATCH] add some more comments for the elwidth-adapter https://bugs.libre-soc.org/show_bug.cgi?id=713#c34 --- src/ieee754/part/partsig.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py index bf9fa100..d6e39f48 100644 --- a/src/ieee754/part/partsig.py +++ b/src/ieee754/part/partsig.py @@ -56,7 +56,11 @@ for name in ['add', 'eq', 'gt', 'ge', 'ls', 'xor', 'bool', 'all']: modnames[name] = 0 - +# Prototype https://bugs.libre-soc.org/show_bug.cgi?id=713#c53 +# this provides a "compatibility" layer with existing PartitionedSignal +# behaviour. the idea is that this interface defines which "combinations" +# of partition selections are relevant, and as an added bonus it says +# which partition lanes are completely irrelevant (padding, blank). class PartType: # TODO decide name def __init__(self, psig): self.psig = psig @@ -70,6 +74,28 @@ class PartType: # TODO decide name def blanklanes(self): return 0 +# this one would be an elwidth version +# see https://bugs.libre-soc.org/show_bug.cgi?id=713#c34 +# it requires an "adapter" which is the layout() function +# where the PartitionPoints was *created* by the layout() +# function and this class then "understands" the relationship +# between elwidth and the PartitionPoints that were created +# by layout() +class ElWidthPartType: # TODO decide name + def __init__(self, psig): + self.psig = psig + def get_mask(self): + ppoints, pbits = layout() + return ppoints.values() # i think + def get_switch(self): + return self.psig.elwidth + def get_cases(self): + ppoints, pbits = layout() + return pbits + @property + def blanklanes(self): + return 0 # TODO + class PartitionedSignal(UserValue): # XXX ################################################### XXX -- 2.30.2