This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler user guide SPRU187U Figure 7 - 9, little endian memory definition?

The Generic bit field implementation shown in Compiler user guide SPRU187U Figure 7 - 9, 'little endian memory' bit definitions shows the 2 lsb's of 9 struct member E bits mapped to the msb's of byte 2.  It also shows byte 3 is the least significant byte.

Is this a typo?  That doesn't look like a little endian implementation to me.

  • James,

    You probably meant to post this in the TI Compiler forum and not the Consumer & Computing forum, or at least that is the right place where it should be. I will have a Moderator move the thread there.

    The Figure is copied below to make the discussion a little easier. It does look right to me, though.

    If you start with the Little-endian register view, this shows how the struct is interpreted in little-endian mode and the value placed into a register. The lsb of the first listed variable-field A is in the lsb of the register, on the far right. The remaining fields are added from the lsb right-to-left, A, B, C, D, and E, leaving 1 unused bit in the msb position. Hopefully, you agree with how the Little-endian register part of the figure is filled.

    To move from the register to little-endian memory, the LSByte goes to byte 0, which is shown here on the left to indicate it is the first available byte-addressable location. The next location at address offset 1 is Byte1 which has B8:1 in it. The next byte follows the short red line and the MSByte follows the long red line to Byte3.

    The drawing of the bytes would look better if they were drawn with Byte0 on the right, but for pure byte-wise little-endian it needs to be drawn this way. If you viewed the memory word in Code Composer Studio in a byte display mode, Byte0 would be the first shown on the left, followed in order by the remaining bytes, 1, 2, 3. But if you display it in 32-bit mode, the word would be display on the left and the bytes would be displayed as in the Little-endian register in the figure above.

    I hope this explanation has helped a bit. If not, please let us know and one of the compiler experts will join the discussion with a better educated explanation.

    Regards,
    RandyP