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.

read CLA table

Hi,

I'll try to read some values in the CLA from an other (includet) asm table.

If I load the adress of the value I can see the right one in the memory window. But if I would load this vaule into a variable the varibale will always set 0.

Can anyone tell me whats my mistake?

Here's a part of the code:

;// Include variables and constants that will be shared in the
;// C28x C-code and CLA assembly code.  This is accomplished by
;// using .cdecls to include a C-code header file that contains
;// these variables and constants

      .cdecls   C,LIST,"CLAShared.h"
 
;// Include the CLA atan Table library.  This file has the source
;// for the CLA atan Table used in this program.

;        .include   "CLAatanTable_type0.asm"
;        .include   "CLAmathLib_type0.inc"

;// To include an MDEBUGSTOP (CLA breakpoint) as the first instruction
;// of each task, set CLA_DEBUG to 1.  Use any other value to leave out
;// the MDEBUGSTOP instruction.

CLA_DEBUG .set  1

;// CLA code must be within its own assembly section and must be
;// even aligned.  Note: since all CLA instructions are 32-bit
;// this alignment naturally occurs and the .align 2 is most likely
;// redundant

       .sect        "Cla1Prog"
_Cla1Prog_Start
       .align       2

.

.

_Cla1Task4:

.

.

    MMOV16      MAR0,MR2,#_CLAatan2Table+4   ; MAR0 points to A2, this will be used in step 4
    MMOVI16     MAR1,#_CLAatan2HalfPITable+2 ; MAR1 points to pi/2, this will be used in step 5
    MNOP
    MNOP
   
; Perform Step (4):
; arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
    MMOV32      MR1,*MAR0[#-2]++              ; MR1 = A2
    MMPYF32     MR1,MR1,MR0                   ; MR1 = A2*Ratio
||    MMOV32      MR3,*MAR0[#-2]++              ; MR3 = A1
    MADDF32     MR3,MR3,MR1                   ; MR3 = A1 + A2*Ratio
||    MMOV32      MR1,*MAR0                     ; MR1 = A0
    MMPYF32     MR3,MR3,MR0                   ; MR3 = Ratio*(A1 + A2*Ratio)
    MADDF32     MR3,MR1,MR3                   ; MR3 = A0 + Ratio*(A1 + A2*Ratio)
||    MMOV32      MR2,@_v1k1                     ; MR2 = X (set/clear NF,ZF for use below)

.

.

_Cla1T4End:

  • Hi Daniel,

    Which variable does not get set properly in example? Is you variable local to the CLA(.asm) file scope?

    If you are assigning to a global variable, in which memory space have you defined the variable? Remember the CLA has R/W access to Cla1toCpuMsgRam, Cla1DataRam0 and Cla1DataRam1 but only read access to the variables in CputoCla1MsgRam and absolutely no access to other RAMs.

    These rules are true for a 28035 device. If you are using a 28069 it has slightly different access rules.

     

     

     

  • Hi Visha,

    the Variable #_CLAatan2Table points to an other asm File with some atan values in a table(it's from the CLAmathLib_type0.inc).

    In the shared file, it is defined as

        #include "CLAmath_type0.h"
                 
        extern  unsigned long *CLAatan2HalfPITable ;
        extern  unsigned long *CLAatan2Table ;
        extern  unsigned long *CLAatan2TableEnd ;

    Should I define it also in the CPU or in the shared file as Cla1DataRam0?

    The application example of atan2 shows nothing about it and I dont't can use the makro.

    Oh, sorry I forget. I'm using the 28035 device.

     

    Regards

  • All tables in the CLA math library are stored in a section "CLAmathTables" which is stored in one of the CLA data rams. If you are using the linker command file that came with the library, you should be fine.

    Since you have included the header file "CLAmath_type0.h" you dont have to define the table variables anywhere else. In the example for atan2 the tables ("CLAatanTable_type0.asm") are linked into the project. You might want to check if the link is broken?. You could alternatively copy the table (.asm) into the project folder.

    Once built, you can check the .map file in the Debug folder of the project to see if you can find these variables. This will tell you if the tables were pulled in successfully or not