You are on page 1of 53

Convolutional

codes
Convolutio L35- 1

• Overview
nal Codes
– Parameters
– Encoding
– Impulse Response/Generator Sequences
– State Diagram
– Trellis Diagram
– Decoding
• Viterbi Algorithm
Convolutional L35- 2

Codes
• Convert any length message to a single ‘codeword’
• Encoder has memory and has n outputs that at any time depend on k
inputs and m previous input blocks
• Typically described by 3 parameters:
– n= no. of bits produced at encoder output at each time unit
– k= no. of bits input to encoder at each time unit
– And one of:
• m = memory of encoder
= no. of prev. input blocks used to generate each output
(or)
• K = constraint length
= max. no. of bits in a single output stream that can be affected by any
input bit
= 1+ maxi mi
Enco L35- 3

ding
• Linear conv. encoders can be implemented with feed-forward shift
registers:
• Example:
Rate ½, m=3 convolutional
code (2,1,3) code

• Encoders can be viewed as FIR digital filters or finite state machines


L35- 4
Encoding Example
Input: 10110

1
1
0
0

0* 1 1 0 1 0 0 0
0
0
1
1
L35- 5
Input: 10110

0
01
0
0

0* 1 1 0 1 0 0
0
1
11
0
L35- 6
Input: 10110

1
001
01
0

0* 1 1 0 1 0
0
0
111
1
L35- 7
Input: 10110

1
0001
0
01

0* 1 1 0 1
1
1
1111
1
L35- 8
Input: 10110

0
10001
01
0
0* 1 1 0
0
1
11111
0
L35- 9
Input: 10110

0
010001
01
01

0* 1 1
1
0
111111
0
L35- 10
Input: 10110

0
1010001
0
01

0 0* 1
1
0
1111111
0
L35- 11
Input: 10110
Output: 11, 01, 01, 01, 11, 01, 11, 00

0
01010001
0
0

0 0 0*
0
0
01111111
0
Impulse L35- 12

Response/Generator Seq.
• Conv. Encoders may be defined by their impulse response (also known
as generator sequences)
• The impulse response for the ith input of a conv. code can be
determined by applying a 1 and m 0’s to the ith input and m+1 0’s to
the other inputs
• For the example (2,1,3) code, the impulse responses are:
g(0) = (1 0 1 1)
g(1) = (1 1 0 1)
Impulse L35- 13

Response/Generator Seq.
• These sequences also specify the connections from the shift registers to
the outputs:
g(0) = (1 0 1 1)
g(1) = (1 1 0 1)
• A 1 means connection, 0 means no connection

1 0 1 1

0
1 1 1
Master Layout 1
Part 1 – Encoder Place a dropdown box for encoder
Part 2 – Decoder and decoder
0/00
+
00
1/11 0/11
0/01

10 01

1/10 1/00
0/10
11
+
Encoder
1/01
. . . . . . State diagram
. . . .
. . . . .
. Trellis Diagram
. . .
Step 1:
Input data: 010011101
+ 0

0
0 0

+ 0

Instruction for the animator Text to be displayed in the working area (DT)
• The encoder figure in the master layout is • The initial state of encoder is 00 which represents the contents of the shift
shown first. register in the encoder.
• Along with that show the state diagram • Input 0is given to the encoder and the corresponding outputs of modulo 2
without arrows(show only the ovals) adders are 00.
• After first sentence in DT, red 0 must
appear .
• Then the circles should blink and blue 0s
must appear.
Step 2:
Input data: 010011101
0/00
+ 0
00

0 0
10 01

+ 0 11

Instruction for the animator Text to be displayed in the working area (DT)
• Then right shift the bits so that red 0 • This is the state diagram.
appears in first box.
• 0/00 represents input/output
• Then the second figure should appear.
• The text in DT should be displayed with the
second figure.
Step 3:
Input data: 10011101
+ 1

1
0 0

+ 1

Instruction for the animator Text to be displayed in the working area (DT)
• After first sentence in DT, red 1 must • Input 1is given to the encoder and the corresponding outputs of modulo 2
appear . adders are 11.
• Then the circles should blink and blue 1s
must appear.
Step 4:
Input data: 10011101
+ 1 0/00
00
1/11

1 0
10 01

+ 1 11

Instruction for the animator Text to be displayed in the working area (DT)
• Then right shift the bits so that red 1 • This is the state diagram.
appears in first box.
• Then the second figure should appear.
• The text in DT should be displayed with the
second figure.
Step 5:
Input data: 0011101
+ 0

0
1 0

+ 1

Instruction for the animator Text to be displayed in the working area (DT)
• After first sentence in DT, red 0 must • Input 0is given to the encoder and the corresponding outputs of modulo 2
appear . adders are 01.
• Then the circles should blink and blue 01
must appear.
Step 6:
Input data: 0011101
+ 0 0/00
00
1/11
0/01
0 1
10 01

+ 1 11

Instruction for the animator Text to be displayed in the working area (DT)
• Then right shift the bits so that red 0 • This is the state diagram.
appears in first box.
• Then the second figure should appear.
• The text in DT should be displayed with the
second figure.
Step 7:
Input data: 011101
+ 1

0
0 1

+ 1

Instruction for the animator Text to be displayed in the working area (DT)
• After first sentence in DT, red 0 must • Input 0is given to the encoder and the corresponding outputs of modulo 2
appear . adders are 11.
• Then the circles should blink and blue 1s
must appear.
Step 8:
Input data: 011101
+ 1 0/00
00
1/11 0/11
0/01
0 0
10 01

+ 1 11

Instruction for the animator Text to be displayed in the working area (DT)
• Then right shift the bits so that red 0 • This is the state diagram.
appears in first box.
• Then the second figure should appear.
• The text in DT should be displayed with the
second figure.
Step 9:
Input data: 11101
+ 1

1
0 0

+ 1

Instruction for the animator Text to be displayed in the working area (DT)
• After first sentence in DT, red 1 must • Input 1is given to the encoder and the corresponding outputs of modulo 2
appear . adders are 11.
• Then the circles should blink and blue 1s
must appear.
Step 10:
Input data: 11101
+ 1 0/00
00
1/11 0/11
0/01
1 0
10 01

+ 1 11

Instruction for the animator Text to be displayed in the working area (DT)
• Then right shift the bits so that red 0 • This is the state diagram.
appears in first box.
• Then the second figure should appear.
• The text in DT should be displayed with the
second figure.
Step 11:
Input data: 1101
+ 1

1
1 0

+ 0

Instruction for the animator Text to be displayed in the working area (DT)
• After first sentence in DT, red 1 must • Input 1is given to the encoder and the corresponding outputs of modulo 2
appear . adders are 10.
• Then the circles should blink and blue 10
must appear.
Step 12:
Input data: 1101
+ 1 0/00
00
1/11 0/11
0/01
1 1
10 01

1/10
+ 0 11

Instruction for the animator Text to be displayed in the working area (DT)
• Then right shift the bits so that red 1 • This is the state diagram.
appears in first box.
• Then the second figure should appear.
• The text in DT should be displayed with the
second figure.
Step 13:
Input data: 101
+ 0

1
1 1

+ 1

Instruction for the animator Text to be displayed in the working area (DT)
• After first sentence in DT, red 1 must • Input 1is given to the encoder and the corresponding outputs of modulo 2
appear . adders are 01.
• Then the circles should blink and blue 01
must appear.
Step 14:
Input data: 101
+ 0 0/00
00
1/11 0/11
0/01
1 1
10 01

1/10
+ 1 11

1/01

Instruction for the animator Text to be displayed in the working area (DT)
• Then right shift the bits so that red 1 • This is the state diagram.
appears in first box.
• Then the second figure should appear.
• The text in DT should be displayed with the
second figure.
Step 15:
Input data: 01
+ 1

0
1 1

+ 0

Instruction for the animator Text to be displayed in the working area (DT)
• After first sentence in DT, red 0 must • Input 0is given to the encoder and the corresponding outputs of modulo 2
appear . adders are 10.
• Then the circles should blink and blue 10
must appear.
Step 16:
Input data: 01
+ 1 0/00
00
1/11 0/11
0/01
0 1
10 01

1/10 0/10
+ 0 11

1/01

Instruction for the animator Text to be displayed in the working area (DT)
• Then right shift the bits so that red 0 • This is the state diagram.
appears in first box.
• Then the second figure should appear.
• The text in DT should be displayed with the
second figure.
Step 17:
Input data: 1
+ 0

1
0 1

+ 0

Instruction for the animator Text to be displayed in the working area (DT)
• After first sentence in DT, red 1 must • Input 1is given to the encoder and the corresponding outputs of modulo 2
appear . adders are 00.
• Then the circles should blink and blue 0s
must appear.
Step 18:
Input data: 1
+ 0 0/00
00
1/11 0/11
0/01
1 0
10 01

1/10 1/00
0/10
+ 0 11

1/01

Instruction for the animator Text to be displayed in the working area (DT)
• Then right shift the bits so that red 1 • This is the state diagram.
appears in first box.
• Then the second figure should appear.
• The text in DT should be displayed with the
second figure.
Step 19: Trellis Diagram

00 . 0/00 0/00
. . . .
. . . . .
1/11 1/11 1/11

10 0/11 0/11
0/01
1/00 1/00

01 . 1/10
.
0/10
. 1/10
. 0/10
.
.
11t=0 t=1 . 1/01
t=2 t=3 . t=4 t=5 . 1/01
t=6 t=7 . t=8

Instruction for the animator Text to be displayed in the working area (DT)
• The figure in step 19 must be shown (red • This is the trellis diagram with all the possible transitions
lines should also be shown as black lines).
• Then the red lines must be shown.
Step 20:
Input data: 010011101

00 . 0/00
. . . .
. . . . .
1/11 1/11

10 0/11
0/01
1/00

01 . . . 1/10
. 0/10
.
.
11t=0
t=5
. t=1
t=6
. t=2
t=7
.t=3
1/01

t=8
.
t=4
t=9

Instruction for the animator Text to be displayed in the working area (DT)
• The figure in step 20 is shown. • The trellis diagram for the given input 0 1 0 0 1 1 1 0 1
• The text in DT is displayed. • The output sequence is 00 11 01 11 11 10 01 10 00
Trellis Decoder
• Use Viterbi Algorithm to undo Convolution
Coding (not signal symbol unmapping)
• Two flavors of determining unmapping
o Hard: make a decision as to which symbol the
received signal most closely matches.
o Soft: Assign weights to all symbols based on their
respective likelihood given received signal
• Viterbi implementation we present assumes
a hard decision model.

36
Viterbi Decoding
(Overview)
• The Viterbi algorithm:
o Given a sequence of received symbols, (that were produced by a
convolution encoder, sent over a channel)
o Determine what the input to the convolution encoder was

• It does this by determining the most likely path


through the trellis

37
Viterbi Decoding (Main
Idea)
• Dynamic Programming
o Keep a table c[s,t] that records the number of errors* that would
have been accumulated if the encoder was in state s at time t.
o Also keep a table p[s,t] which records the state that the encoder
would have been in at time t-1 if it were in state s at time t.

* Typically calculated using either Hamming or Euclidian distance


38
Filling out the tables
• At time t, we receive the symbol Rt.
• For each state s,
o Let q0 and q1 be the two possible previous states of s at time t-1.
o Let e0 be the error between Rt and q0 s
o Let e1 be the error between Rt and q1 s
o c[s,t] min(c[q0,t-1]+e0, c[q1,t-1]+e1)
o Update p[s,t] appropriately with q0 or q1

39
Traceback
• When the algorithm has examined T input symbols,
it looks for the minimum entry among all states in
c[s,T ].

• Then the algorithm traces back through the trellis


using the entries of p[s,t ].

40
Example
• Input to Encoder:
o0110101110

• Output of Encoder:
o00 10 11 01 11 00 11 11 10 00

41
Decoder, time = 1

42
Decoder, time = 2

43
Decoder, time = 3

44
Decoder, time = 4

45
Decoder, time = 5

46
Decoder, time = 6

47
Decoder, time = 7

48
Decoder, time = 8

49
Decoder, time = 9

50
Decoder, time = 10

51
Decoder, Traceback

52
Original Path

53