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.

Question about BITT instruction with 15-TREG in C54 instrction

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 15TREG. 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 #NBWORDS1,AR1 ; number of output words to compute

MVMM AR1,AR4 ; Copy AR1 in AR4 (to use in output reversal)

STM #OUTPUT+NBWORDS1,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,NBWORDS1

BACK RPTB TBEND1 ; do j=0,15

                                       ; Calculate bit position in transition word

SFTL A,(K2),B ; B = A>>(K2)

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 = (K5)lsbs of State/8

STLM AR0 ; AR0 = index for transition word

MAR *+AR2(2^(K5)) ; reset pointer to start of table

MAR *AR2+0 ; add offset to point to correct transition word

BITT *AR20 ; 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)

  • Sorry, I should give some examples on my question.

    If State=0, Bits# = 0

    If State=15, Bits# = 15

    If State=8, Bits# = 1

    If State=7, Bits# = 14

    I do not see it converts to 15-TREG. What is the problem?

    BTW, I add the following text from spra071a.pdf to better understanding.

    This number is then loaded into the T register for the next step. Although this value can be greater than 16, the BITT instruction uses only the four LSBs of TREG. There is no need to mask off the upper bits.