From 994d0c3f3d549b1aaa71f64277ed589098c15405 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 21 Oct 2021 13:40:29 +0100 Subject: [PATCH] add quick print statements to show that elaborate() gets called as a second phase after the creation of the AST tree this gives a window of opportunity to tree-walk and set whether SimdSignals are LHS or RHS as determined by encountering SimdSignal.__Assign__ --- src/ieee754/part/partsig.py | 3 +- src/ieee754/part/test/minitest_partsig.py | 58 +++++++++++++++++++++++ src/ieee754/part_ass/assign.py | 2 + src/ieee754/part_cat/cat.py | 2 + 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 src/ieee754/part/test/minitest_partsig.py diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py index 9a761aad..9306f64d 100644 --- a/src/ieee754/part/partsig.py +++ b/src/ieee754/part/partsig.py @@ -158,6 +158,7 @@ class SimdSignal(UserValue): return PRepl(self.m, self, count, self.ptype) def __Cat__(self, *args, src_loc_at=0): + print ("partsig cat", self, args) # TODO: need SwizzledSimdValue-aware Cat args = [self] + list(args) for sig in args: @@ -174,7 +175,7 @@ class SimdSignal(UserValue): return PMux(self.m, self.partpoints, self, val1, val2, self.ptype) def __Assign__(self, val, *, src_loc_at=0): - # print ("partsig ass", self, val) + print ("partsig assign", self, val) return PAssign(self.m, self, val, self.ptype) # TODO, http://bugs.libre-riscv.org/show_bug.cgi?id=458 diff --git a/src/ieee754/part/test/minitest_partsig.py b/src/ieee754/part/test/minitest_partsig.py new file mode 100644 index 00000000..e18e39f6 --- /dev/null +++ b/src/ieee754/part/test/minitest_partsig.py @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# See Notices.txt for copyright information + +""" +Copyright (C) 2021 Luke Kenneth Casson Leighton + +mini demo test of Cat and Assign +""" + +from nmigen import Signal, Module, Elaboratable, Cat, Const, signed +from nmigen.back.pysim import Simulator, Settle +from nmutil.extend import ext + +from ieee754.part_mul_add.partpoints import PartitionPoints +from ieee754.part.partsig import SimdSignal + + +if __name__ == "__main__": + from ieee754.part.test.test_partsig import create_simulator + m = Module() + mask = Signal(3) + a = SimdSignal(mask, 16) + b = SimdSignal(mask, 16) + o = SimdSignal(mask, 32) + a.set_module(m) + b.set_module(m) + o.set_module(m) + + omask = (1<