Open programmerjake opened 5 months ago
Thanks for the report.
To be sure, we label the LSB as bit 0
and the MSB as width - 1
. The bits
primop is inclusive on both sides.
That's interesting to hear that PowerISA does it as it does. We can add verbiage to make the convention we use explicit.
Just as a note to myself (or anyone who snipes the issue from me), this note is probably best given as a language-wide convention, rather than a footnote on bits
(although we should crossreference it wherever we make use of it).
the PowerISA specification in particular
And to be clear, this is a separate issue from endian, which refers to the storage (in memory) ordering of Bytes of a word. In-register operations do not depend on the endian.
Which is to say, please don't use "endian' to describe the bit ordering in firrtl. Also, 1.3.2 of the Power spec for those curious to check and it's weird when numerically equivalent words of different sizes have their common bits in different numerical positions.
I was under the impression that the One True meaning of "endian" was from which end you ate your boiled eggs.
the FIRRTL specification doesn't specify how to determine if
bits(UInt<8>(0hF0), 3, 0)
returns0hF
or0h0
-- specifying this is needed because some significant specifications (the PowerISA specification in particular) counts bits starting from 0 at the MSB end and counting up to the LSB end, and most others count bits starting from 0 at the LSB end, though I expect some start counting at 1.