# A Tutorial on Convolutional Coding with Viterbi Decoding

**A Tutorial on Convolutional Coding with Viterbi Decoding
**

by Chip Fleming of Spectrum Applications Updated 2006-11-02 19:35Z Copyright © 1999-2006, Spectrum Applications. All rights reserved.

"Viterbi Algorithm (VA) decoders are currently used in about one billion cellphones, which is probably the largest number in any application. However, the largest current consumer of VA processor cycles is probably digital video broadcasting. A recent estimate at Qualcomm is that approximately 1015 bits per second are now being decoded by the VA in digital TV sets around the world, every second of every day." from "The Viterbi Algorithm: A Personal History" by G. David Forney, Jr., presented at the Viterbi Conference, University of Southern California, Los Angeles, March 8, 2005. Introduction The purpose of this tutorial is to introduce the reader to a forward error correction technique known as convolutional coding with Viterbi decoding. More particularly, this tutorial will focus primarily on the Viterbi decoding algorithm itself. The intended audience is anyone interested in designing or understanding wireless digital communications systems. Following this introduction, I will provide a detailed description of the algorithms for generating random binary data, convolutionally encoding the data, passing the encoded data through a noisy channel, quantizing the received channel symbols, and performing Viterbi decoding on the quantized channel symbols to recover the original binary data. Simulation source code examples of these algorithms follow the algorithm descriptions. (See the note at the bottom of this page regarding the soft-decision Viterbi decoder source code.) I have also included some example results from the simulation code. Since the examples are written in the C programming language, your ability to read C code would be very helpful to achieving a clear understanding. However, I have tried to provide enough explanation in the description of the algorithms and comments in the example source code so that you can understand the algorithms even if you don't know C very well. The purpose of forward error correction (FEC) is to improve the capacity of a channel by adding some carefully designed redundant information to the data being transmitted through the channel. The process of adding this redundant information is known as channel coding. Convolutional coding and block coding are the two major forms of channel coding. Convolutional codes operate on serial data, one or a few bits at a time. Block codes operate on relatively large (typically, up to a couple of hundred bytes) message blocks. There are a variety of useful convolutional and block codes, and a variety of algorithms for decoding the received coded information sequences to recover the original data. The reader is advised to study the sources listed in the bibliography for a broader and deeper understanding of the digital communications and channel-coding field. Convolutional encoding with Viterbi decoding is a FEC technique that is particularly suited to a channel in which the transmitted signal is corrupted mainly by additive white gaussian noise (AWGN). You can think of AWGN as noise whose voltage distribution over time has characteristics that can be described using a Gaussian, or normal, statistical distribution, i.e. a bell curve. This voltage distribution has zero mean and a standard deviation that is a function of the signal-to-noise ratio (SNR) of the received signal. Let's assume for the moment that the received signal level is fixed. Then if the SNR is high, the standard deviation of the noise is small, and vice-versa. In digital communications, SNR is usually measured in terms of Eb /N0 , which stands for energy per bit divided by the one-sided noise density. Let's take a moment to look at a couple of examples. Suppose that we have a system where a '1' channel bit is

http://home.netcom.com/~chip.f/viterbi/tutorial.html[29-Nov-10 6:11:03 PM]

It is also called binary "antipodal" (which means the signaling states are exact opposites of each other) signaling. The next figure shows the results of a similar channel simulation when 1 x 106 channel bits are transmitted through an AWGN channel where the Eb /N0 level has decreased to 6 dB (i.e. and then when the Eb /N0 is lower. This is called bipolar nonreturn-to-zero (bipolar NRZ) signaling. and a transmitted '1' was never received as a '0'. In this example simulation with the Eb /N0 set at 20 dB. and a '0' channel bit is transmitted at a level of +1V.e. Very few (if any) channel bit reception errors would occur. and a '0' if its voltage is greater than or equal to 0V. when the Eb /N0 is high. so good. Let's see how our example system performs. and as a '0' if its voltage is greater than or equal to 0V.html[29-Nov-10 6:11:03 PM]
. and a '0' channel bit is transmitted as a voltage of +1V. The x axis of this figure corresponds to the received signal voltages. In this simulation. a transmitted '0' was never received as a '1'. The receiver comprises a comparator that decides the received channel bit is a '1' if its voltage is less than 0V. Such a receiver would have little difficulty correctly receiving a signal as depicted in the figure above.com/~chip. the signal voltage is two times the rms noise voltage):
http://home. first. One would want to sample the output of the comparator in the middle of each data bit interval.f/viterbi/tutorial. So far. a '1' channel bit is transmitted at a level of -1V. the signal voltage is ten times the rms noise voltage). and the y axis represents the number of times each voltage level was received:
Our simple receiver detects a received channel bit as a '1' if its voltage is less than 0V.A Tutorial on Convolutional Coding with Viterbi Decoding
transmitted as a voltage of -1V.netcom. The following figure shows the results of a channel simulation where one million (1 x 106 ) channel bits are transmitted through an AWGN channel with an Eb /N0 level of 20 dB (i.

In this tutorial. Volume IT-13.207 times.netcom. a transmitted '0' was received as a '1' 1." published in IEEE Transactions on Information Theory. invented by Gottfried Ungerboeck in 1982. denotes the "length" of the convolutional encoder. a founder of Qualcomm Corporation. The code rate. Obviously. you can achieve a BER of better than 1 x 10-7 at the same Eb /N0 . The m parameter can be thought of as the memory length of the encoder. exploring the performance limits of the technique. these events correspond to channel bit reception errors in our simple receiver. Sequential decoding has the advantage that it can perform very well with long-constraint-length convolutional codes. but it has a variable decoding time. Closely related to K is the parameter m. such as digital television. I will show you that by using convolutional coding with Viterbi decoding. and varying decoder design parameters to optimize the implementation of the technique in hardware and software. especially if you're trying to transmit highly compressed data. Consult the Convolutional Coding/Viterbi Decoding Papers section of the bibliography for more reading on this subject. in April. which indicates how many encoder cycles an input bit is retained and used for encoding after it first appears at the input to the convolutional encoder. Since then.html[29-Nov-10 6:11:03 PM]
. The Viterbi decoding algorithm is also used in decoding trellis-coded modulation.235%. pages 260-269.e. K.147 times. Viterbi decoding was developed by Andrew J.com/~chip. His seminal paper on the technique is "Error Bounds for Convolutional Codes and an Asymptotically Optimum Decoding Algorithm. Viterbi decoding is one of two types of decoding algorithms used with convolutional encoding-the other type is sequential decoding. is expressed as a ratio of the number of bits into the convolutional encoder (k) to the number of channel symbols output by the convolutional encoder (n) in a given encoder cycle. 6 dB. This is the technique used in telephone-line modems to squeeze high ratios of bits-per-second to Hertz out of 3 kHz-bandwidth analog telephone lines. In this example simulation with the Eb /N0 set at 6 dB. corresponding to a bit error rate (BER) of about 0. 1967. The constraint length parameter. i. how many k-bit stages are available to feed the combinatorial logic that produces the output symbols. The points on the red curve that are above 0V represent events where a channel bit that was transmitted as a one (-1V) was received as a zero. and how the left-hand side of the blue curve also crosses 0V. and a transmitted '1' was received as a '0' 1. A discussion of sequential decoding algorithms is beyond the
http://home. That's not so good. other researchers have expanded on his work by finding good convolutional codes. Convolutional codes are usually described using two parameters: the code rate and the constraint length. The points on the blue curve that are below 0V represent events where a channel bit that was transmitted as a zero (+1V) was received as a one.A Tutorial on Convolutional Coding with Viterbi Decoding
Now observe how the right-hand side of the red curve in the figure above crosses 0V.f/viterbi/tutorial. k/n. and in the example source code. Viterbi. I focus on rate 1/2 convolutional codes.

particularly terrestrial radio channels also have other impairments. and a K = 7 Viterbi decoder that operates at up to 45 Mbps. On the receiving end.f/viterbi/tutorial. However. if you think of the tradeoff as a 5 dB power savings for a 3 dB bandwidth expansion. Advanced Wireless Technologies offers a K = 9 Viterbi decoder that operates at rates up to 2 Mbps. Click on one of the links below to go to the beginning of that section: Introduction Description of the Algorithms Simulation Source Code Examples Example Simulation Results Bibliography About Spectrum Applications. But its computational requirements grow exponentially as a function of the constraint length. selective fading. Check the appropriate sources listed in the bibliography for more information on turbo coding and turbo code devices. Transmitters and receivers can add spurious signals and phase noise to the desired signal as well. followed by Reed-Solomon decoding. Viterbi decoding has the advantage that it has a fixed decoding time. convolutional coding with Viterbi decoding has begun to be supplemented in the geostationary satellite communication arena with Reed-Solomon coding. Initial hardware encoder and decoder implementations of turbo coding have already appeared on the market. Typically. With this code. then with the convolutional code. such as VSAT (very small aperture terminal) networks. the bandwidth expansion factor of a convolutional code is simply n/k. For years. convolutional coding with Viterbi decoding has been the predominant FEC technique used in space communications. Recently (1993) a new parallel-concatenated convolutional coding technique known as turbo coding has emerged. you can transmit binary or quaternary phase-shift-keyed (BPSK or QPSK) signals with at least 5 dB less power than you'd need without it. so consider the rates mentioned above as a snapshot of the state-of-the-art taken in early 1999. In the past several years. But there's a tradeoff-the same data rate with rate 1/2 convolutional coding takes twice the bandwidth of the same signal without it. and atmospheric (lightning) noise.. Although convolutional coding with Viterbi decoding might be useful in dealing with those other problems. That's a reduction in Watts of more than a factor of three! This is very useful in reducing transmitter and/or antenna cost or permitting increased data rates given the same transmitter power and antenna sizes. I believe the most common variant used in VSAT networks is rate 1/2 convolutional coding using a code with a constraint length K = 7.netcom. but I don't know its commercial availability. given that the modulation technique is the same. Moore's Law applies to Viterbi decoders as well as to microprocessors.
http://home.html[29-Nov-10 6:11:03 PM]
.com/~chip. Remember: if the modulation technique stays the same. NTT has announced a Viterbi decoder that operates at 60 Mbps. Viterbi decoding is performed first. This technique achieves substantial improvements in performance over concatenated Viterbi and Reed-Solomon coding. A variant in which the codes are product codes has also been developed. and in several of the newer VSAT products as well. Stanford Telecom produces a K = 9 Viterbi decoder that operates at rates up to 96 kbps. interference. particularly in geostationary satellite communication networks. such as multipath. but many. you can see that you come out ahead.. along with hardware implementations. the reader can find sources discussing this topic in the Books about Forward Error Correction section of the bibliography. that's what the vendors are advertising. It is well suited to hardware decoder implementation. At least. The two coding techniques are usually implemented as serially concatenated block and convolutional coding. Many radio channels are AWGN channels. you transmit two channel symbols per data bit. it may not be the best technique. This is the technique that is used in most if not all of the directbroadcast satellite (DBS) systems. the information to be transmitted is first encoded with the Reed-Solomon code. so it is usually limited in practice to constraint lengths of K = 9 or less. That's because with rate 1/2 convolutional encoding.A Tutorial on Convolutional Coding with Viterbi Decoding
scope of this tutorial.

.... founded in 1995.A Tutorial on Convolutional Coding with Viterbi Decoding
About Spectrum Applications. For more information.org (Please remove "nospam-" from my email address to send me email. my ex-wife says I have to stop visiting this page so often :-)
http://home. MD 20855-1142 email: cfleming@nospam-ieee.html[29-Nov-10 6:11:03 PM]
.f/viterbi/tutorial. and closed in 2003.. contact: Chip Fleming 7408 Vinyard Court Derwood. Spectrum Applications was a technical consultancy specializing in wireless digital communications and related fields.) Click on one of the links below to go to the beginning of that section: Introduction Description of the Algorithms Simulation Source Code Examples Example Simulation Results Bibliography About Spectrum Applications.netcom. Approximately visitors.com/~chip..