From 8915593ef29b253dc0b6af3d89e53a8b29474d19 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 24 Jul 2020 16:10:54 +0100 Subject: [PATCH] add better comments on field_slice --- src/soc/consts.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/soc/consts.py b/src/soc/consts.py index 40512121..48d5ddf5 100644 --- a/src/soc/consts.py +++ b/src/soc/consts.py @@ -9,10 +9,16 @@ def botchify(bekls, lekls): # Can't think of a better place to put these functions. # Return an arbitrary subfield of a larger field. def field_slice(msb0_start, msb0_end, field_width=64): - """Answers with a subfield slice of the signal r ("register"), - where the start and end bits use IBM conventions. msb0_start < msb0_end. - The range specified is inclusive on both ends. - field_width specifies the total number of bits (not bits-1) + """field_slice + + Answers with a subfield slice of the signal r ("register"), + where the start and end bits use IBM "MSB 0" conventions. + + see: https://en.wikipedia.org/wiki/Bit_numbering#MSB_0_bit_numbering + + * assertion: msb0_start < msb0_end. + * The range specified is inclusive on both ends. + * field_width specifies the total number of bits (note: not bits-1) """ if msb0_start >= msb0_end: raise ValueError( -- 2.30.2