From: Luke Kenneth Casson Leighton Date: Mon, 27 Sep 2021 18:29:26 +0000 (+0100) Subject: derive PartitionedSignal from UserValue (temporarily) and add lower() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7dd0e09ea0ddf16d31e77c38d182af3dd27eae6a;p=ieee754fpu.git derive PartitionedSignal from UserValue (temporarily) and add lower() --- diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py index f09b972a..8a7cd57c 100644 --- a/src/ieee754/part/partsig.py +++ b/src/ieee754/part/partsig.py @@ -25,6 +25,7 @@ from ieee754.part_mul_add.partpoints import make_partition, PartitionPoints from operator import or_, xor, and_, not_ from nmigen import (Signal, Const) +from nmigen.hdl.ast import UserValue def getsig(op1): @@ -42,8 +43,9 @@ def applyop(op1, op2, op): return result -class PartitionedSignal: - def __init__(self, mask, *args, **kwargs): +class PartitionedSignal(UserValue): + def __init__(self, mask, *args, src_loc_at=0, **kwargs): + super().__init__(src_loc_at=src_loc_at) self.sig = Signal(*args, **kwargs) width = len(self.sig) # get signal width # create partition points @@ -55,6 +57,9 @@ class PartitionedSignal: for name in ['add', 'eq', 'gt', 'ge', 'ls', 'xor']: self.modnames[name] = 0 + def lower(self): + return self.sig + def set_module(self, m): self.m = m