Hi,
I am reading spra071a.pdf, I don't understand the explanation about 15-TREG on page 16/29. The passage and code snippet are listed below. I do not see here is a bit reverse operation:
Bit#=2*State[State>(K-2)] & 1
Could you help me on the understanding?
Thanks,
............
Finding the correct bit number within the selected transition word requires consideration of the C54x bit extraction method. The BITT instruction (test bit specified by T register) specifies the bit number in an inverse manner; that is, the bit address corresponds to 15–TREG. The calculated bit address must correspond to this notation. The bit address is found by shifting State one bit up and appending the MSB as the LSB. This can be expressed as:
Bit#=2*State[State>(K-2)] & 1
This number is then loaded into the T register for the next step.
.......
RSBX OVM ; turn off overflow mode
STM #TRANS_END,AR2 ; address of end of transition table
STM #NBWORDS–1,AR1 ; number of output words to compute
MVMM AR1,AR4 ; Copy AR1 in AR4 (to use in output reversal)
STM #OUTPUT+NBWORDS–1,AR3 ; address pointer for output bits (end of buffer)
LD #0,A ; A contains initial State value (State=0 in this example)
STM #15,BRC ; Load block repeat counter for inner loop ; do i=0,NBWORDS–1
BACK RPTB TBEND–1 ; do j=0,15
; Calculate bit position in transition word
SFTL A,–(K–2),B ; B = A>>(K–2)
AND ONE,B ; B = B&1 = msb of State
ADD A,1,B ; B = B+A<<1 = 2*State + msb of State
STLM B,T ; T = B (bit position)
; Calculate correct transition word
SFTL A,–3,B ; B = A/8 = State/8
AND MASK,B ; B = B&MASK = (K–5)lsb’s of State/8
STLM AR0 ; AR0 = index for transition word
MAR *+AR2(–2^(K–5)) ; reset pointer to start of table
MAR *AR2+0 ; add offset to point to correct transition word
BITT *AR2–0 ; Test bit in transition word, reset to table start
ROLTC A ; Rotate decision in A
; enddo (j loop)
TBEND STL A,*AR3– ; Store packed output
BANZD BACK,*AR1– ; repeat j loop if frame not finished
STM #15,BRC ; Init block repeat counter for next word
; enddo (i loop)