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.

TMS320C6670: C66x ALU test, Link register

Part Number: TMS320C6670

Hello,

I have a question regarding C66x controller.

I am writing safety tests for the ALU units, so basically am writing an assembler code to test the 8 units L1,L2, M1, M2 D1, D2 and S1 and S2.
I did that for ARM micro-controller where you have a link register that used to stores the return address, such as when making a function call.
  • So my first question: Do we have something similar in c66x? If not is that done automatically?
  • Second question: How to call an external function using one of the assembler instruction (something similar the B instruction that i used for local branch)?

Please find below a snip of my code where I test the ADD instruction, let me know where are the wrong part in that code:


.asg B15, SP
.global PAL_AluTest_v_ArithInstructions_ASM



PAL_AluTest_v_ArithInstructions_ASM:
  STW .D2T1 A1,*SP++(-4) ; save A1
  STW .D2T1 A2,*SP++(-4) ; save A2
  STW .D2T1 A3,*SP++(-4) ; save A3
  STW .D2T1 A4,*SP++(-4) ; save A4
  STW .D2T1 A5,*SP++(-4) ; save A5

  MVD .M1 A0, A5 ; MVD (.unit) src2, dst
  MVK .S1 40, A1 ; Set A1 register to a specific value in that case 40
  MVK .S1 60, A2 ; Set A2 register to a specific value in that case 60
  MVK .S1 100, A3 ; Set A3 register to a the expected value in that case A3= A1+A2
  ADD .L1 A1, A2, A4 ; Apply ADD operation to L1 unit (ADD (.unit) src1, src2, dst)
  CMPEQ .L1 A4, A3, A0 ; CMPEQ (.unit) src1, src2, dst
  [ A0] B .S1 Arithmatic_Ovr ; B (.unit) label
  [!A0] B .S1 ARITHMATIC_ERR ; B (.unit) label

ARITHMATIC_ERR:
  CALLP .S2 External_Function_Name, B3 ;in case of issue an external function will report the error

Arithmatic_Ovr:
  MVD .M1 A5, A0 ; MVD (.unit) src2, dst
  LDW .D2T1 *++SP(4), A5 ; LDW (.unit) *+baseR[offsetR], dst
  LDW .D2T1 *++SP(4), A4 ; LDW (.unit) *+baseR[offsetR], dst
  LDW .D2T1 *++SP(4), A3 ; LDW (.unit) *+baseR[offsetR], dst
  LDW .D2T1 *++SP(4), A2 ; LDW (.unit) *+baseR[offsetR], dst
  LDW .D2T1 *++SP(4), A1 ; LDW (.unit) *+baseR[offsetR], dst
Best Regards,
Sofiene Bk