
3-18
Viterbi Decoder Implementation
For More Information On This Product,
Go to: www.freescale.com
Expanding the Viterbi Algorithm
Main: Gluing the Pieces Together
Next, we begin the executable code. The first two lines initialize address registers m2
and n2 so that r2 addressing wraps around and increments by 3sboth for branch
metric storage. The next 5 lines initialize address registers r4 and r5 to wrap around for
path metric/path storage to begin them pointing to the correct places in the storage
table. Offset register n5 is set to access path metrics spaced halfway apart in the storage
table.
The initialization finishes by pointing n0 to the path storage table start, making sure r3
is in linear mode for traceback, and pointing r1 to the input data. Note that the r1
addressing mode is not set. We assume that an outside calling routine does this, and
permit circular input buffers if desired.
Example 3-6
Main Viterbi Decoding Routine: Patch Metric Update
These next two sections do much of the decoding work. The first loop processes
ENCBITS of input data. We process 1 pair of decoder inputs for each iteration of the
macros FindMetrics and ACS. This preprocessing loads ENCBITS-1 of data into the
paths. Thereafter, we process the decoder input pairs in groups of eight, producing 8
path bits for each state. For every 8 decoder input pairs processed, we invoke the
STOREPATHS macro to store the paths.
;
;***********************PREPARATION LOOP*************************
;
This loop iterates by the number of bits used in the
;
encoder to pre load the bit decisions. Thereafter,
;
the paths are updated and stored off in bytes. We need
;
the preload bits so that the stored path metrics point
;
correctly to their previous paths for traceback
;****************************************************************
;
do
#ENCBITS-1,PRELP
;
FindMetrics
ACS
PRELP
;*****************MAIN LOOP--PROCESS BYTES OF DATA*****************
do
#NUMINPUTS/8-1,DATALP
do
#8,SYMLP
;
FindMetrics
ACS
SYMLP
STOREPATHS#NUMSTATES
DATALP
;once for each encoder bit
;process bytes of output
;8 bits per byte
F
Freescale Semiconductor, Inc.
n
.