Expanding the Viterbi Algorithm
Memory Organization
Viterbi Decoder Implementation
For More Information On This Product,
Go to: www.freescale.com
3-19
By preloading ENCBITS-1 and storing the leftmost eight every time we store paths, we
ensure that the paths always have (ENCBITS-1)+8 bits at the time we store paths.The
extra ENCBITS-1 bits are, as noted above, the current state, and are kept till the next
path store time to allow us to traceback. The main loop processes all but the last
8-ENCBITS+1 sets of decoder input data.
Example 3-7
Main Viterbi Decoding Routine: Termination and Traceback
Example 3-7
shows the final processing for the data block. At this time, we have
processed all but the last byte, i.e., 8 bits less the ENCBITS-1 processing we did in
preprocessing. This means we have 3 bits of data left to process. After processing the
last decoder input, the TRACEBACK macro is invoked to obtain the decoder output.
The decoded data is memory at y:DECOUT, in 16-bit word form.
3.8
MEMORY ORGANIZATION
Example 3-8
shows all memory organization except the input data defines used to test
the code. The first reserved spaces are dedicated to the storage for the path metrics (in X
memory) and their respective paths (in Y memory). Note that these must be collocated.
For this code, we initialized the metrics for that state 00 has a large path metric, and the
rest are 0. We do not initialize the path metrics in executable code! This allows the
decoder to operate on data over multiple invocations if desired. If the decoder is
operating on independent data blocks, each started assuming the encoder starts in the 0
state, then this memory will have to be initialized accordingly. Another alternative in
this case would be to modify the butterfly loop in the preprocessor to use the fact that
the encoder starts in the 0 state. This option is explored in
Section 4
.
;
;********POSTPROCESSING,LAST INFO BYTE ********************************
;
; ENCBITS PREPROCESSED, SO WE HAVE 8-ENCBITS BITS LEFT.
; FOR THIS EXAMPLE, WE HAVE 3INPUTS LEFT TO PROCESS
;**********************************************************************
;
; THE LAST THREE BITS------
;
do
#8-ENCBITS+1,FLSH1;process last 3 bits to get last byte
;
FindMetrics
ACS
FLSH1
;*******Traceback the path data to obtain the decoder output**********
TRACEBACK
FIN
nop
F
Freescale Semiconductor, Inc.
n
.