From 4842290ca7444952b0a70984e8b5afa2d4a51fa0 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 5 Oct 2021 18:09:24 +0100 Subject: [PATCH] add PartitionedRepl first version, no unit test just demo --- src/ieee754/part_repl/repl.py | 188 ++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 src/ieee754/part_repl/repl.py diff --git a/src/ieee754/part_repl/repl.py b/src/ieee754/part_repl/repl.py new file mode 100644 index 00000000..364b7721 --- /dev/null +++ b/src/ieee754/part_repl/repl.py @@ -0,0 +1,188 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# See Notices.txt for copyright information + +""" +Copyright (C) 2021 Luke Kenneth Casson Leighton + +dynamically-partitionable "repl" class, directly equivalent +to nmigen Repl + +See: + +* http://libre-riscv.org/3d_gpu/architecture/dynamic_simd/repl +* http://bugs.libre-riscv.org/show_bug.cgi?id=709 + +""" + +from nmigen import Signal, Module, Elaboratable, Cat, Repl +from nmigen.back.pysim import Simulator, Settle +from nmigen.cli import rtlil + +from ieee754.part_mul_add.partpoints import PartitionPoints +from ieee754.part.partsig import PartitionedSignal + + +def get_runlengths(pbit, size): + res = [] + count = 1 + # identify where the 1s are, which indicates "start of a new partition" + # we want a list of the lengths of all partitions + for i in range(size): + if pbit & (1<