From: Luke Kenneth Casson Leighton Date: Sat, 9 Oct 2021 16:22:36 +0000 (+0100) Subject: convert PartitionedRepl over to new "PartType" format X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5a1c91609c64eace13bbb46902dba277e318aa9e;p=ieee754fpu.git convert PartitionedRepl over to new "PartType" format --- diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py index 880ea18b..d02dac4a 100644 --- a/src/ieee754/part/partsig.py +++ b/src/ieee754/part/partsig.py @@ -30,7 +30,7 @@ from ieee754.part_cat.pcat import PCat from ieee754.part_repl.prepl import PRepl from operator import or_, xor, and_, not_ -from nmigen import (Signal, Const) +from nmigen import (Signal, Const, Cat) from nmigen.hdl.ast import UserValue, Shape @@ -56,6 +56,21 @@ for name in ['add', 'eq', 'gt', 'ge', 'ls', 'xor', 'bool', 'all']: modnames[name] = 0 + +class PartType: # TODO decide name + def __init__(self, psig): + self.psig = psig + def get_mask(self): + return list(self.psig.partpoints.values()) + def get_switch(self): + return Cat(self.get_mask()) + def get_cases(self): + return range(1<