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.

Utilizing 40-bit Accumulator Values in 5509A Assembly Code

I am programming a 5509A using CCS4 w/ CodeGenTools v4.3.5 and DSP/BIOS v5.41.

I have an assembly function that is using the accumulator to accumulate SQA results with the accumulator in 40 bit mode.

MOV *(#_I_read_ptr + 1), AR1    ; AR1 points to 1st data point.
MOV *AR1+ << #16, AC1             ; Load first data point to AC1(32-16).

RPT *(#_UI_Repeats)                 ; Repeat (_UI_Repeats + 1) times.
SQA AC1, AC0                              ; Load value pointed to by AR1 into AC1, square
|| MOV *AR1+ << #16, AC1         ; the value, accumulate in AC0.

When I am finished I need to move the accumulated results into memory.  I am having trouble finding the correct way to get all 40 bits out of the accumulator.  I have tried moving them into a 40-bit signed integer, but it doesn't load properly.   Is it necessary to shift different parts out of the accumulator them reconstitute them in a 40-bit signed int?

Any suggestions?

  • I came across this old post of mine and I figured it might be helpful to post the solution that I came up with.  This is the code posted below, formatted to fit this box.

    This code will run through a chunk of numbers and square and accumulate them.  Then put the result into a 64-bit struct.

     

    RPTB XOCHIMILCO - 1

         SQA AC1, AC0                                                  ; Square AC1(31:16) and accumulate in AC0.

         MOV *AR1+ << #16, AC1                                ; Load next data point to AC1(31:16), repeat.

    XOCHIMILCO:

     

    ; Now we load the 40-bit result into our 64-bit struct.

    MOV AC0, dbl(*(_Uint64bitAccum + 2))           ; Load bits 31:0 into lower double word.

     

    SFTSC AC0, #-32                                                ; Sign shift right AC0 content by 32 bits. Now

                                                                                    ; bits 39:32 are the lowest 8 bits of AC0.

     

    MOV AC0, dbl(*(_Uint64bitAccum))                 ; Load AC0 to upper double word.