From: Luke Kenneth Casson Leighton Date: Tue, 5 Oct 2021 17:09:24 +0000 (+0100) Subject: add PartitionedRepl first version, no unit test just demo X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4842290ca7444952b0a70984e8b5afa2d4a51fa0;p=ieee754fpu.git add PartitionedRepl first version, no unit test just demo --- 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<