Other Parts Discussed in Thread: SFRA, C2000WARE-DIGITALPOWER-SDK, C2000WARE
Tool/software: TI C/C++ Compiler
C2000 Team,
I'm trying to get my F280049 to run a the 2P2Z macro (CNTL_2P2Z_F_C.h) From the solar lib documentation it says it should execute in about 42 cycles. The disassembly looks much longer than that and the process takes roughly 900 ns (twice as long as I would expect). See below for more detail.
I'm running the function out of RAMLS4 and both the control and the vars are called out as volatile.
I've tried multiple different optimizations from the project properties and nothing seems to have helped.
I've compile the same code with various processors 28377/ 28075 and the disassembly looks the same.
For reference, I am using compiler 18.1.4.LTS... Is there another compiler I should be using, is there a better way to use this function that runs faster (set optimizations), does it need to run out a certain memory location to run faster, or anything else I'm missing.
Thanks,
Kyle
******************
I'm testing it by making a pin go high, calling the macro, then forcing the pin low...
The disassembly for the macro looks like the following (which doesn't at look like 42:
volatile CNTL_2P2Z_F_C_Coeffs Control_Coef;
volatile CNTL_2P2Z_F_C_Vars Control_Var;
CNTL_2P2Z_F_C(Control_Coef, Control_Var); 00a8c2: E2AF0002 MOV32 R0H, @0x2, UNCF 00a8c4: E2AF0100 MOV32 R1H, @0x0, UNCF 00a8c6: E7200008 SUBF32 R0H, R1H, R0H 00a8c8: 7700 NOP 00a8c9: E2030004 MOV32 @0x4, R0H 00a8cb: 761F0054 MOVW DP, #0x54 00a8cd: E2AF0026 MOV32 R0H, @0x26, UNCF 00a8cf: 761F0055 MOVW DP, #0x55 00a8d1: E2AF010E MOV32 R1H, @0xe, UNCF 00a8d3: 761F0054 MOVW DP, #0x54 00a8d5: E3004128 MPYF32 R0H, R1H, R0H || MOV32 R1H, @0x28 00a8d7: 761F0055 MOVW DP, #0x55 00a8d9: E2AF020C MOV32 R2H, @0xc, UNCF 00a8db: E7000051 MPYF32 R1H, R2H, R1H 00a8dd: 761F0054 MOVW DP, #0x54 00a8df: E3120120 ADDF32 R0H, R0H, R1H || MOV32 R1H, @0x20 00a8e1: 761F0055 MOVW DP, #0x55 00a8e3: E2AF0208 MOV32 R2H, @0x8, UNCF 00a8e5: E7000051 MPYF32 R1H, R2H, R1H 00a8e7: 761F0054 MOVW DP, #0x54 00a8e9: E3120122 ADDF32 R0H, R0H, R1H || MOV32 R1H, @0x22 00a8eb: 761F0055 MOVW DP, #0x55 00a8ed: E2AF0206 MOV32 R2H, @0x6, UNCF 00a8ef: E7000051 MPYF32 R1H, R2H, R1H 00a8f1: 761F0054 MOVW DP, #0x54 00a8f3: E3120124 ADDF32 R0H, R0H, R1H || MOV32 R1H, @0x24 00a8f5: 761F0055 MOVW DP, #0x55 00a8f7: E2AF0204 MOV32 R2H, @0x4, UNCF 00a8f9: E7000051 MPYF32 R1H, R2H, R1H 00a8fb: 7700 NOP 00a8fc: E7100040 ADDF32 R0H, R0H, R1H 00a8fe: 7700 NOP 00a8ff: E2030010 MOV32 @0x10, R0H 00a901: 0606 MOVL ACC, @0x6 00a902: 1E08 MOVL @0x8, ACC 00a903: 0604 MOVL ACC, @0x4 00a904: 1E06 MOVL @0x6, ACC 00a905: 0610 MOVL ACC, @0x10 00a906: 1E0A MOVL @0xa, ACC 00a907: 761F0054 MOVW DP, #0x54 00a909: E2AF002A MOV32 R0H, @0x2a, UNCF 00a90b: 761F0055 MOVW DP, #0x55 00a90d: E2AF010A MOV32 R1H, @0xa, UNCF 00a90f: E6940001 CMPF32 R1H, R0H 00a911: AD14 MOVST0 NF,ZF 00a912: 6405 SB C$L235, LT 00a913: 761F0054 MOVW DP, #0x54 00a915: 062A MOVL ACC, @0x2a 00a916: 6F02 SB C$L236, UNC C$L235: 00a917: 060A MOVL ACC, @0xa C$L236: 00a918: 761F0055 MOVW DP, #0x55 00a91a: 1E0A MOVL @0xa, ACC 00a91b: 761F0054 MOVW DP, #0x54 00a91d: E2AF002C MOV32 R0H, @0x2c, UNCF 00a91f: 761F0055 MOVW DP, #0x55 00a921: E2AF010A MOV32 R1H, @0xa, UNCF 00a923: E6940001 CMPF32 R1H, R0H 00a925: AD14 MOVST0 NF,ZF 00a926: 6205 SB C$L237, GT 00a927: 761F0054 MOVW DP, #0x54 00a929: 062C MOVL ACC, @0x2c 00a92a: 6F02 SB C$L238, UNC C$L237: 00a92b: 060A MOVL ACC, @0xa C$L238: 00a92c: 761F0055 MOVW DP, #0x55 00a92e: 1E0A MOVL @0xa, ACC 00a92f: 060C MOVL ACC, @0xc 00a930: 1E0E MOVL @0xe, ACC 00a931: 060A MOVL ACC, @0xa 00a932: 1E0C MOVL @0xc, ACC 00a933: 761F0054 MOVW DP, #0x54 00a935: E2AF002E MOV32 R0H, @0x2e, UNCF 00a937: 761F0055 MOVW DP, #0x55 00a939: E2AF010A MOV32 R1H, @0xa, UNCF 00a93b: E6940001 CMPF32 R1H, R0H 00a93d: AD14 MOVST0 NF,ZF 00a93e: 6205 SB C$L239, GT 00a93f: 761F0054 MOVW DP, #0x54 00a941: 062E MOVL ACC, @0x2e 00a942: 6F02 SB C$L240, UNC C$L239: 00a943: 060A MOVL ACC, @0xa C$L240: 00a944: 761F0055 MOVW DP, #0x55 00a946: 1E0A MOVL @0xa, ACC 00a947: 761F0300 MOVW DP, #0x300