SPRUIY2 November 2024 F29H850TU , F29H859TU-Q1
The C29x CPU does not support a native bit reversed addressing mode like on the C28x CPU. However, the functional parallelism present in the C29x CPU architecture makes sure that there is no performance impact for the lack of native bit reversed addressing mode.
Bit reversed addressing is performed by an instruction that modifies the addressing registers in a bit reversed fashion and is typically used for re-ordering data for Fast-Fourier Transform (FFT) type algorithms.
Address | Value | Bit Reversed Address | Bit Reversed Value |
---|---|---|---|
0000 | 0 | 0000 | 0 |
0001 | 1 | 1000 | 8 |
0010 | 2 | 0100 | 4 |
0011 | 3 | 1100 | 12 |
0100 | 4 | 0010 | 2 |
0101 | 5 | 1010 | 10 |
0110 | 6 | 0110 | 6 |
0111 | 7 | 1110 | 14 |
1000 | 8 | 0001 | 1 |
1001 | 9 | 1001 | 9 |
1010 | 10 | 0101 | 5 |
... | ... | ... | ... |
The supported instruction for bit reversed addressing is:
ADD.BITREV Az,Ay,Ax
Perform the ADD operation, but add the bits from left to right (unlike a standard ADD that is from right to left). An example is:
; Ax = 0011 1001
; Ay = 0000 1000
; Az = 0011 0101 (after a bit reversed add):
ADD Az,Ay,Ax ; Normal Add: Az = 0100 0001
ADD.BITREV Az,Ay,Ax ; Bit Reversed Add: Az = 0011 0101
The following example shows how this operation is used to reverse an array of Data in bit reversed order:
BitReversedIndex = 0;
BitReversedIncrement = N/2;
for(i=0; i < N; i++)
{
BitReversedDataArray[BitReversedIndex] = NormalDataArray[i];
BitReversedIndex = BitReversedAdd(BitReversedIndex+BitReversedIncrement);
}
Typically, when bit reversing data, the data array is a multiple of 2 in size (N = 16, 32, 64, 128, and so on).
The BitReversedIncrement then needs to be set to half the array size (N/2) to increment by 1 in bit reversed order.
The assembly code for the previous operation is:
MV A0,#0 ; A0 = BitReversedIndex = 0
MV A8,#N/2 ; A8 = Increment Step = N/2
MV A4,#NormalDataArray ; A4 = Stating Address Of
; NormalDataArray
MV A5,#BitReversedDataArray ; A5 = Stating Address Of
; BitReversedDataArray
; Repeat N times:
LD.32 D0,*A4++ ; Read From NormalDataArray
ST.32 *(A5+A0),D0 ; Write To BitReversedDataArray
||ADD.BITREV A0,A0,A8 ; Increment BitReversedIndex
LD.32 D0,*A4++ ; Read From NormalDataArray
ST.32 *(A5+A0),D0 ; Write To BitReversedDataArray
||ADD.BITREV A0,A0,A8 ; Increment BitReversedIndex
....
LD.32 D0,*A4++ ; Read From NormalDataArray
ST.32 *(A5+A0),D0 ; Write To BitReversedDataArray
||ADD.BITREV A0,A0,A8 ; Increment BitReversedIndex