From 0c808e017b4349c01354853de3d559c9cf9c8b57 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 16 Jun 2020 12:15:42 +0100 Subject: [PATCH] update popcount docstring --- src/soc/fu/logical/popcount.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/soc/fu/logical/popcount.py b/src/soc/fu/logical/popcount.py index e2a28207..23c0ab63 100644 --- a/src/soc/fu/logical/popcount.py +++ b/src/soc/fu/logical/popcount.py @@ -1,6 +1,15 @@ -# Popcount: a successive (cascading) sum-reduction algorithm starting from -# single-bit adds and reducing down to one final answer: the total number of -# bits set to "1" in the input. +"""Popcount: a successive (cascading) sum-reduction algorithm for counting bits + +starting from single-bit adds and reducing down to one final answer: +the total number of bits set to "1" in the input. + +unfortunately there is a bit of a "trick" going on which you have to +watch out for: whilst the first list added to pc is a single entry (the +input, a), subsequent rows in the cascade are arrays of partial results, +yet it turns out that referring to them using the exact same start/end +slicing is perfect. this comes down to nmigen's transparent use of +python features to make Signals iterable. +""" from nmigen import (Elaboratable, Module, Signal, Cat, Const) -- 2.30.2