S835 of 56
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S8 · Lesson 35 · Convolutional codes and Viterbi decoding

Encoding with shift registers, generators, constraint length and the trellis, free distance and coding gain, the Viterbi algorithm, soft decisions and puncturing

Block codes chop data into independent pieces; convolutional codes run continuously, each output bit a parity of the last few input bits, produced by a shift register a few stages long. They pair naturally with soft decisions, and Andrew Viterbi's 1967 algorithm decodes them optimally with work that grows only linearly in the message length. The constraint-length-7 code that Voyager used still appears in Wi-Fi, satellite links and deep-space missions, gaining about 5 dB at a 10⁻⁵ error rate, roughly a factor of three in transmitter power.

  • Bit error probability against Eb/N0 for uncoded BPSK and for rate-1/2 convolutional codes with soft-decision Viterbi decoding, from the leading term of the union bound Pb≈BdQ(2RdfreeEb/N0).
  • The K = 3 code (generators 7, 5 octal, dfree = 5) reaches 10⁻⁵ near 5.6 dB; the K = 7 code (171, 133 octal, dfree = 10) near 4.0 dB by this estimate, and about 4.2 to 4.4 dB in measurements.
  • Against uncoded BPSK's 9.6 dB, that's a coding gain of about 5 dB.

Predict

How many states does the Viterbi decoder for a constraint-length-7 convolutional code track?

Name it

The encoder

A rate-1/n convolutional code shifts each input bit into a register of length K (the constraint length) and outputs n bits, each the modulo-2 sum of register taps given by a generator polynomial, written in octal. The (7, 5) code: g1 = 111, g2 = 101. The encoder is a finite-state machine with 2K−1 states; unrolling it in time gives the trellis.

Free distance and coding gain

The free distance dfree is the least Hamming weight of any coded sequence that leaves the all-zero path and returns. Best rate-1/2 codes: K = 3, 5; K = 5, 7; K = 7, 10; K = 9, 12. With soft decisions,

Pb≈BdfreeQ(2RdfreeEbN0),Gasym=10log⁡(Rdfree) dB

where Bd counts the information-bit errors on those paths (1 for the (7,5) code, 36 for the K = 7 code). Hard decisions lose about 2 dB.

The Viterbi algorithm

At each time step, for every state, add each incoming branch's metric (squared Euclidean distance for soft decisions, Hamming distance for hard) to the survivor metric of the state it came from, and keep only the best. After a traceback depth of about 5K, all survivors agree on old decisions, which are output. Complexity: 2K branch metrics per bit.

Puncturing

Deleting some coded bits in a fixed pattern raises the rate with one decoder: keeping 4 of every 6 coded bits from a rate-1/2 code gives rate 3/4, as in Wi-Fi's 54 Mb/s mode.

Worked example

Encode 1, 0, 1, 1 with the (7, 5) code starting from the zero state.

Show the solution
  1. First input, 1. The register (newest first) becomes 100, so the outputs are 1⊕0⊕0=11⊕0=1 giving 11.
  2. Second input, 0. The register is 010, giving 1 and 0: 10.
  3. Third input, 1. The register is 101, giving 0 and 0: 00.
  4. Fourth input, 1. The register is 110, giving 0 and 1: 01.
  5. Flush. Two flushing zeros would follow to return to state 0.

Answer the coded stream is 11 10 00 01.

Worked example

What asymptotic gains do the K = 3 and K = 7 codes promise, and what do they deliver at 10⁻⁵?

Show the solution
  1. K = 3, asymptotically. 10log⁡(0.5×5)=4.0dB
  2. K = 3 at 10⁻⁵. The estimate needs 5.6 dB against 9.6, a gain of 9.6−5.6=4.0dB
  3. K = 7, asymptotically. 10log⁡(5)=7.0dB
  4. K = 7 at 10⁻⁵. The many error paths (Bd = 36) make the real gain at 10⁻⁵ about 5 to 5.6 dB.
  5. When the asymptote arrives. The asymptotic figure is reached only at very low error rates.

Answer K = 3 promises 4.0 dB and delivers 4.0 dB at 10⁻⁵; K = 7 promises 7.0 dB and delivers about 5 to 5.6 dB.

Worked example

The K = 7 rate-½ code (dfree = 10) is punctured to rate ⅔ (dfree = 6) and rate ¾ (dfree = 5). What asymptotic coding gains do the three versions promise?

Show the solution
  1. The asymptotic gain. G=10log10⁡(Rdfree)
  2. Rate ½. 10log10⁡5=7.0dB
  3. Rate ⅔. 10log10⁡4=6.0dB
  4. Rate ¾. 10log10⁡3.75=5.7dB
  5. The trade. Puncturing gives up about a decibel of gain for half again the throughput, with the same Viterbi decoder.

Answer 7.0 dB at rate ½, 6.0 dB at rate ⅔ and 5.7 dB at rate ¾.

Check

A convolutional code has constraint length 5. How many states does its trellis have?

Check

A rate-0.5 convolutional code has dfree = 7. What asymptotic soft-decision coding gain does it promise?

Check

A rate-1/2 code with dfree = 5 and Bd = 4 is decoded with soft decisions at Eb/N0 = 5 dB. Roughly what bit error probability results?

Check

How many branch metrics does a Viterbi decoder for constraint length 7 compute per decoded bit (rate 1/n)?

Check

A rate-1/2 code is punctured so that, for every 3 data bits, only 4 coded bits are sent. What's the new code rate?

Check

About how deep should a Viterbi decoder's traceback be for constraint length 7?

Check

A rate-0.5 convolutional code with constraint length 5 has dfree = 10.

(a)

How many trellis states does it have?

(b)

What asymptotic soft-decision gain does it promise?

Check

A code of rate R and free distance d has Bd = B and runs at Eb/N0 = E (linear) with soft decisions.

Step 1

What is its asymptotic gain in dB?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why does the Viterbi algorithm only need to keep one path into each state?

Practice

Keep practicing

10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.