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.

Basic Machine Level Word Alignment Question

Am I correct in understanding that the C64x is incapable of storing a 4-byte word on anything other than a word boundary (2 LSBs zero)? Re: the STW instruction in the "TMS320C64x/C64x+ DSP CPU and Instruction Set" manual.

--Randy

  • Hi Randy,

    I believe you are correct. Can you point to the page/section you need more explanations about?

    Please see page 71 (3.7.5) of the document:

    http://www-s.ti.com/sc/techlit/SPRU732

    "The C64x/C64x+ DSP can access words and doublewords at any byte boundary using nonaligned loads and stores. As a result, word and doubleword data

    does not need alignment to 32-bit or 64-bit boundaries. No other memory access may be used in parallel with a nonaligned memory access."

     

    So it needs to be 16-bit aligned indeed.

  • Hi Mariana,

    Thank you for your prompt and thoughtful answer. However, I think we have miscommunicated. Based on your response, I would have expected you to say "I believe you are incorrect."

    By "word" I meant 32-bit data value, e.g., a uint32_t in C99's stdint.h syntax.

    It does indeed seem to indicate you can perform non-aligned load/stores, and that to the byte level, but that seems to be contradicted by the main store instruction, STW, as described on p. 462 of the same document you referenced. Note the last sentence on that page states:

      "Word addresses must be aligned on word (two LSBs are 0) boundaries."

    So that would seem to indicate you cannot store to non-aligned boundaries.

    For example, can I store the value 0xfedc 4321 to address 0x0000 0003, so that in memory we would have

    Addr.            Data

    00000003  21

    00000004  43

    00000005  dc

    00000006 fe

     

    --Randy

  • Randy Yates said:

    Thank you for your prompt and thoughtful answer. However, I think we have miscommunicated. Based on your response, I would have expected you to say "I believe you are incorrect."

    By "word" I meant 32-bit data value, e.g., a uint32_t in C99's stdint.h syntax.

    I see your point.

     

    Randy Yates said:

    It does indeed seem to indicate you can perform non-aligned load/stores, and that to the byte level, but that seems to be contradicted by the main store instruction, STW, as described on p. 462 of the same document you referenced. Note the last sentence on that page states:

      "Word addresses must be aligned on word (two LSBs are 0) boundaries."

    For non-aligned, than it would use the STNDW instruction on page 456 OR STNW on page 459.

  • Ah! Thanks Mariana!

    --Randy