Viterbi Algorithm Saravanan Vijayakumaran sarva@ee.iitb.ac.in Department of Electrical Engineering Indian Institute of Technology Bombay October 30, 2015 1 / 33
Encoder State Diagram 1 + D 2 1 + D + D 2 � � G ( D ) = 1 + D 0/000 v ( 0 ) + S 0 0/011 1/111 1/100 u v ( 1 ) + S 2 S 1 0/101 0/110 1/010 v ( 2 ) + S 3 1/001 2 / 33
Encoder Trellis Diagram 001 001 001 001 · · · S 3 S 3 S 3 S 3 S 3 010 010 010 010 010 110 110 110 110 · · · S 1 S 1 S 1 S 1 S 1 S 1 101 101 101 101 101 100 100 100 100 · · · S 2 S 2 S 2 S 2 S 2 111 111 111 111 111 111 011 011 011 011 · · · S 0 S 0 S 0 S 0 S 0 S 0 S 0 000 000 000 000 000 000 t = 5 0 1 2 3 4 6 • The initial state of the encoder is the all-zeros state • Every path in the trellis starting from the initial state gives a codeword 3 / 33
Terminated Trellis Diagram 001 001 001 S 3 S 3 S 3 S 3 010 010 010 010 110 110 110 110 S 1 S 1 S 1 S 1 S 1 101 101 101 101 101 100 100 100 S 2 S 2 S 2 S 2 S 2 111 111 111 111 111 011 011 011 011 011 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 000 000 000 000 000 000 000 5 7 t = 0 1 2 3 4 6 • The inputs are chosen to terminate the trellis in the all-zeros state • Every path from the initial state to the final state is a codeword 4 / 33
Terminating the Trellis of Feedforward Encoders v ( 0 ) + v ( 1 ) u + v ( 2 ) + • Two consecutive zero input bits will drive the above encoder to the all-zeros state • In a feedforward encoder with memory order m , m consecutive zero input bits in each of the k inputs will terminate the trellis 5 / 33
Terminating the Trellis of Feedback Encoders v i · · · + + + + f 0 f 1 f 2 f m − 1 f m u i w i w i − 1 w i − 2 w i − m + · · · q 1 q 2 q m − 1 q m · · · + + + • To reach the all-zeros state, the input to the shift register has to be zero for m time units m � w i = 0 = ⇒ u i = q j w i − j j = 1 6 / 33
Maximum Likelihood Decoder for BSC 001 001 001 S 3 S 3 S 3 S 3 010 010 010 010 110 110 110 110 S 1 S 1 S 1 S 1 S 1 101 1 1 1 1 0 0 0 0 1 1 1 1 0 100 100 0 1 S 2 S 2 S 2 S 2 S 2 111 111 111 111 111 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 000 000 000 000 000 000 000 t = 0 1 2 3 4 5 6 7 • Let r = � � 110 110 110 111 010 101 101 be the BSC output • The ML decoder will output a codeword v such that d H ( r , v ) is minimum 7 / 33
Maximum Likelihood Decoder for BSC 3 2 2 S 3 S 3 S 3 S 3 1 1 2 0 0 1 1 2 S 1 S 1 S 1 S 1 S 1 2 2 1 3 0 1 2 2 S 2 S 2 S 2 S 2 S 2 1 1 1 0 2 2 1 1 2 2 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • Branch metric is the Hamming distance between the codeword bits of a state transition and the corresponding received bits • Path metric is the sum of all the branch metrics along a path 8 / 33
Viterbi Algorithm (1) 3 2 2 S 3 S 3 S 3 S 3 2 1 2 0 1 0 1 1 2 S 1 S 1 S 1 S 1 S 1 3 2 2 1 3 0 1 2 2 3 S 2 S 2 S 2 S 2 S 2 1 1 1 0 2 2 1 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • At t = 2, there is only path entering each state • The shortest path has one of these four paths as a prefix 9 / 33
Viterbi Algorithm (2) 3 2 2 S 3 S 3 S 3 S 3 2 1 2 0 1 0 1 1 2 S 1 S 1 S 1 S 1 S 1 3 2 2 1 3 0 1 2 2 3 S 2 S 2 S 2 S 2 S 2 1 1 1 0 2 2 1 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • At t = 3, there are two paths entering each state • The shortest path has one of these eight paths as a prefix 10 / 33
Viterbi Algorithm (3) 3 2 2 S 3 S 3 S 3 S 3 2 1 2 0 1 0 1 1 2 S 1 S 1 S 1 S 1 S 1 3 2 2 1 3 0 1 2 2 3 S 2 S 2 S 2 S 2 S 2 1 1 1 0 2 2 1 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • At t = 3, the two paths entering state S 3 have path metrics 5 and 4 • We eliminate the path with metric 5 11 / 33
Viterbi Algorithm (4) 2 2 S 3 S 3 S 3 S 3 2 4 1 1 2 0 0 1 1 2 S 1 3 S 1 S 1 S 1 S 1 2 2 1 3 0 1 2 2 3 S 2 S 2 S 2 S 2 S 2 1 1 1 0 2 2 1 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • The state S 3 at time t = 3 is now labelled with its partial path metric 12 / 33
Viterbi Algorithm (5) 2 2 S 3 S 3 S 3 S 3 2 4 1 1 2 0 0 1 1 2 S 1 3 S 1 S 1 S 1 S 1 2 2 1 3 0 1 2 2 3 S 2 S 2 S 2 S 2 S 2 1 1 1 0 2 2 1 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • At t = 3, the two paths entering state S 1 have path metrics 4 and 5 • We eliminate the path with metric 5 13 / 33
Viterbi Algorithm (6) 2 2 S 3 S 3 S 3 S 3 2 4 1 1 2 0 0 1 1 2 S 1 3 S 1 S 1 S 1 S 1 2 2 1 3 0 4 1 2 2 3 S 2 S 2 S 2 S 2 S 2 1 1 0 2 2 1 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • The state S 1 at time t = 3 is now labelled with its partial path metric 14 / 33
Viterbi Algorithm (7) 2 2 S 3 S 3 S 3 S 3 2 4 1 1 2 0 0 1 1 2 S 1 3 S 1 S 1 S 1 S 1 2 2 1 3 0 4 1 2 2 3 S 2 S 2 S 2 S 2 S 2 1 1 0 2 2 1 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • At t = 3, the two paths entering state S 2 have path metrics 2 and 5 • We eliminate the path with metric 5 15 / 33
Viterbi Algorithm (8) 2 2 S 3 S 3 S 3 S 3 2 4 1 1 2 0 0 1 1 2 S 1 3 S 1 S 1 S 1 S 1 2 1 3 0 4 1 2 2 3 S 2 S 2 S 2 S 2 S 2 2 1 1 0 2 2 1 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • The state S 2 at time t = 3 is now labelled with its partial path metric 16 / 33
Viterbi Algorithm (9) 2 2 S 3 S 3 S 3 S 3 2 4 1 1 2 0 0 1 1 2 S 1 3 S 1 S 1 S 1 S 1 2 1 3 0 4 1 2 2 3 S 2 S 2 S 2 S 2 S 2 2 1 1 0 2 2 1 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • At t = 3, the two paths entering state S 0 have path metrics 5 and 6 • We eliminate the path with metric 6 17 / 33
Viterbi Algorithm (10) 2 2 S 3 S 3 S 3 S 3 2 4 1 1 2 0 0 1 1 2 S 1 3 S 1 S 1 S 1 S 1 2 1 3 0 4 1 2 2 3 S 2 S 2 S 2 S 2 S 2 2 1 1 0 2 2 1 1 2 2 5 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • The state S 0 at time t = 3 is now labelled with its partial path metric 18 / 33
Viterbi Algorithm (11) 2 2 S 3 S 3 S 3 S 3 4 1 1 2 0 0 1 1 2 S 1 S 1 S 1 S 1 S 1 2 1 3 0 4 1 2 2 S 2 S 2 S 2 S 2 S 2 2 1 1 0 2 2 1 1 2 2 5 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • At t = 3, there is now only one surviving path entering each state • The shortest path has one of these four paths as a prefix 19 / 33
Viterbi Algorithm (12) 2 S 3 S 3 S 3 S 3 4 6 1 1 2 0 0 1 1 2 S 1 S 1 S 1 S 1 S 1 2 1 3 0 4 1 2 2 S 2 S 2 S 2 S 2 S 2 2 1 1 0 2 2 1 1 2 2 5 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • We eliminate one of the paths with metric 6 entering S 3 at t = 4 20 / 33
Viterbi Algorithm (13) 2 S 3 S 3 S 3 S 3 4 6 1 1 2 0 0 1 1 2 S 1 S 1 S 1 S 1 S 1 2 1 3 0 4 4 1 2 2 S 2 S 2 S 2 S 2 S 2 2 1 1 2 2 1 1 2 2 5 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • We eliminate the path with metric 5 entering S 1 at t = 4 21 / 33
Viterbi Algorithm (14) 2 S 3 S 3 S 3 S 3 4 6 1 1 2 0 0 1 1 2 S 1 S 1 S 1 S 1 S 1 2 3 0 4 4 1 2 2 S 2 S 2 S 2 S 2 S 2 2 5 1 1 2 2 1 1 2 2 5 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 3 1 2 2 t = 0 1 2 3 4 5 6 7 • We eliminate one of the paths with metric 5 entering S 2 at t = 4 22 / 33
Viterbi Algorithm (15) 2 S 3 S 3 S 3 S 3 4 6 1 1 2 0 0 1 1 2 S 1 S 1 S 1 S 1 S 1 2 3 0 4 4 1 2 2 S 2 S 2 S 2 S 2 S 2 2 5 1 1 2 2 1 1 2 2 5 3 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 1 2 2 t = 0 1 2 3 4 5 6 7 • We eliminate the path with metric 8 entering S 0 at t = 4 23 / 33
Viterbi Algorithm (16) 2 S 3 S 3 S 3 S 3 6 1 1 2 0 0 1 1 2 S 1 S 1 S 1 S 1 S 1 2 3 0 4 1 2 2 S 2 S 2 S 2 S 2 S 2 5 1 1 2 1 1 2 2 3 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 1 2 2 t = 0 1 2 3 4 5 6 7 • At t = 4, there is now only one surviving path entering each state • The shortest path has one of these four paths as a prefix 24 / 33
Viterbi Algorithm (17) S 3 S 3 S 3 S 3 6 4 1 1 2 0 0 1 1 2 S 1 S 1 S 1 S 1 S 1 0 2 4 5 1 2 S 2 S 2 S 2 S 2 S 2 5 7 1 1 2 1 2 2 3 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 2 1 2 2 t = 0 1 2 3 4 5 6 7 • Using the same procedure, we eliminate one path per state at t = 5 25 / 33
Viterbi Algorithm (18) S 3 S 3 S 3 S 3 4 1 2 0 0 1 2 S 1 S 1 S 1 S 1 S 1 0 2 5 1 2 S 2 S 2 S 2 S 2 S 2 7 1 2 1 2 2 4 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 1 2 2 t = 0 1 2 3 4 5 6 7 • At t = 5, there is now only one surviving path entering each state • The shortest path has one of these four paths as a prefix 26 / 33
Recommend
More recommend