Part Number: TMS320F28379D
Tool/software: TI C/C++ Compiler
I have a routine running at 400 kHz that toggles several IOs.
I have learned that interrupt entry and exit consume 10+ cycles and so I need to optimize the actual code within the interrupt.
The following code requires a number of cycles. What could be done to reduce the number of cycles? Each instruction/cycle is 5 ns but at 400 kHz it is 0.2% of the overall CPU time.
#define Z_WRITE GpioDataRegs.GPADAT.bit.GPIO11
430 Z_WRITE = enc_emu.z_vec[enc_emu.which_vector][enc_emu.counter_10kHz][1]
C$L23:
0085a9: 761F0445 MOVW DP, #0x445
0085ab: 2D03 MOV T, @0x3
0085ac: 8F4110A3 MOVL XAR5, #0x0110a3
0085ae: 3550 MPYB ACC, T, #80
0085af: 560100A5 ADDL @XAR5, ACC
0085b1: 3B01 SETC SXM
0085b2: 761F0442 MOVW DP, #0x442
0085b4: 56030120 MOV ACC, @0x20 << 1
0085b6: 07A5 ADDL ACC, @XAR5
0085b7: 8AA9 MOVL XAR4, @ACC
0085b8: 761F01FC MOVW DP, #0x1fc
0085ba: CD00F7FF AND AH, @0x0, #0xf7ff
0085bc: 92CC MOV AL, *+XAR4[1]
0085bd: 9001 ANDB AL, #0x1
0085be: FF8A LSL AL, 11
0085bf: CAA8 OR AL, @AH
0085c0: 9600 MOV @0x0, AL