From: Luke Kenneth Casson Leighton Date: Fri, 24 Jul 2020 15:10:54 +0000 (+0100) Subject: add better comments on field_slice X-Git-Tag: semi_working_ecp5~563 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8915593ef29b253dc0b6af3d89e53a8b29474d19;p=soc.git add better comments on field_slice --- 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(