From 7dd0e09ea0ddf16d31e77c38d182af3dd27eae6a Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 27 Sep 2021 19:29:26 +0100 Subject: [PATCH] derive PartitionedSignal from UserValue (temporarily) and add lower() --- src/ieee754/part/partsig.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 -- 2.30.2