eTPU is word-oriented. How does this affect eTPU_C?

eTPU_C

It doesn't. Internally, eTPU_C deals with bytes; this makes it easier for C programmers to work with eTPU_C. During code generation, eTPU_C makes a conversion to sub-word calculations, using different strategies to get at different bytes.

The only caveat you need to remember is this: code for operations on byte-sized values can be particularly expensive in terms of instructions. Whether it's warranted is a matter for the designer to decide.

Byte-wide operations

This example demonstrates how eTPU_C handles byte-wide values.

In this example, eTPU_C "parses" the target address, and uses the appropriate byte of P to host the assigned value.

0000                                      int8 a;
0001                                      int8 * z;

                                          /* with pointers */
                                          z = &a;
0200 9FFF7B00   alu p = 0 ;
                    ram 0001 = p23_0.
0204 1C8F0FFE   alu a = #0x23.            *z = 0x23;
0208 9FEFFF00   ram diob = 0001.
020C FFEFF8D9   ram p31_0 = (diob).
0210 080BFBDA   alu nil = diob & 
                    #0x000002,ccs.
0214 F0E0119F   if z==0 jump 0230,
                    noflush.
0218 080BFBBA   alu nil = diob & 
                    #0x000001,ccs.
021C F0C0115F   if z==0 jump 0228,flush.
                    
0220 3FF9AFF4   alu p31_24 = a .
0224 F7C0121F   jump 0240,flush.
0228 3FF9BFF4   alu p23_16 = a .
022C F7C0121F   jump 0240,flush.
                    
0234 3FF9CFF4   alu p15_8 = a .
0238 F7C0121F   jump 0240,flush.
023C 3FF9DFF4   alu p7_0 = a .
0240 FFFFF8D9   ram (diob) = p31_0.


Thinking of SPRAM as a byte-oriented memory, eTPU is big-endian: the MSB will appear in the (effectively) lowest address space.