
3-14
Viterbi Decoder Implementation
For More Information On This Product,
Go to: www.freescale.com
Expanding the Viterbi Algorithm
Traceback: Obtaining the Decoder Output
To store the paths, begin by recalling the path storage address pointer. In the example
code, this is stored in n0. We place copies into r3 (to use as the address pointer for data
writes) and r0 (to update the pointer to the next
page
at the end of the routine). We then
mask off the 5 LSBs, and proceed to store the paths. We have designed this macro to
process a variable number of states, controlled by the macro argument LPCNT. This
variability will be used in
Section 4
.
Example 3-3
Partial Path Storage Code Listing
;***********************STORE PARTIAL PATH METRICS MACRO***************
;
FUNCTION: The storage is somewhat twisted. The stored paths are current
;
up to the most recent input bit, which is NOT convenient for
;
traceback. I process the data as follows: I pre
;
loaded the path with 6 bits. Thereafter, I process 8 path bits
;
so the path has 14 bits. The most significant 8, I save.
;
the remaining bits are the current encoder values for that path.
;
The 5 lsb's are the current state.
;
INPUTS:
;
n0 should point to memory where the path bits are to be stored
;
r5 should point to the latest path metric for state 0
;
OUTPUTS:
;
Updated paths storage X memory, n0 points to next path storage
;
REGISTERS USED:
;
a,b,x1,r0,n0,r3,r5
;*********************************************************************
;
;
Store off path data in bytes to avoid overflow in path reg's
;
STOREPATHS macro LPCNT
;
move
n0,r3
move
n0,r0
move
#>$1f,x1
do
LPCNT,_PSTORE1
move
y:(r5),b
asr
#5,b,a
;
and
x1,b
move
a1,x:(r3)+
move
b1,y:(r5)+
_PSTORE1
lua
(R4+NUMSTATES),R5
lua
(r0+NUMSTATES),n0
endm
;n0 stores path data pointer
;mask for 5 lsb's(NUMENCBITS of 1's)
;store paths for each state
;grab path
;align bits 5-12 with a1
(the 8 bits beyond enc)
;mask off 5 lsb's to return to path
;store 8 ms path bits
;return 5 ls path bits
;r5 points to latest states
;update path data pointer
F
Freescale Semiconductor, Inc.
n
.