NivaarExam PrepOfficial exam papers ↗

22-Elec-B3 Digital Communications Systems · May 2018

Question 3 of 5: Error-Control Coding — Convolutional Encoding and Viterbi Decoding

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

Paper format. National Examinations — May 2018, 16-Elec-B3 Digital Communications Systems. Three hours, closed book; a PEO-approved non-programmable calculator is permitted. Five questions of 25 marks each are printed; any four constitute a complete paper worth 100 marks, and only the first four appearing in the answer book are marked. All five questions are solved here, because this set is a study resource rather than a marked script. Note 1 of the cover page invites the candidate to submit a clear statement of any assumption made where a question is open to interpretation — that licence is used explicitly in Question 1.

Reference texts.

Question 3: Error-Control Coding — Convolutional Encoding and Viterbi Decoding (25 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given. A rate-1/2 convolutional encoder with generator polynomials $g_1(D) = 1+D^2$ and $g_2(D) = 1+D+D^2$, output pair ordered $(g_1, g_2)$. Memory $m = 2$, so the constraint length is $K = 3$ and the encoder has $2^2 = 4$ states. Part (a) input: 10101, starting in the all-zero state, zero-padded. Part (b) received sequence: 00111110000111 (14 bits = 7 branches), with the encoder known to start and end in the all-zero state.

Find. (a) the 14-bit encoded output for the input 10101; (b) the maximum-likelihood input sequence for the observed 14 bits, together with any corrected errors.

u(k) D D u(k−1) u(k−2) ⊕ g₁ = 1 + D² ⊕ g₂ = 1 + D + D² Rate-1/2, constraint length K = 3 convolutional encoder state = (u(k−1), u(k−2)); output pair ordered g₁ then g₂
Figure 3.1 — The encoder implied by the generator polynomials. $D$ denotes a one-bit delay, so the two shift-register cells hold $u(k-1)$ and $u(k-2)$; the state is the pair $(u(k-1), u(k-2))$. The upper modulo-2 adder implements $g_1 = 1 + D^2$ and the lower one $g_2 = 1 + D + D^2$.

Approach. Write the two output bits as modulo-2 sums of the current input and the two register contents, run the register through the input sequence for part (a), and for part (b) run a full Viterbi search over the four-state trellis with the terminating branches forced to input 0.

  1. Part (a) — Write the output equations from the generator polynomials. Reading the polynomials as taps on the delay line, $$g_1: \quad v^{(1)}_k = u_k \oplus u_{k-2}, \qquad\qquad g_2: \quad v^{(2)}_k = u_k \oplus u_{k-1} \oplus u_{k-2},$$ where $\oplus$ is addition modulo 2 and the state before clocking bit $k$ is $(u_{k-1}, u_{k-2})$.
  2. Clock the register through the zero-padded input. Zero padding means $m = 2$ tail zeros are appended to flush the register, so the encoder is driven with 1010100 and returns to the all-zero state. Working step by step:
    $k$$u_k$State before $(u_{k-1},u_{k-2})$$v^{(1)} = u_k\oplus u_{k-2}$$v^{(2)} = u_k\oplus u_{k-1}\oplus u_{k-2}$OutputState after
    1100111110
    2010010101
    3101000010
    4010010101
    5101000010
    60 (pad)10010101
    70 (pad)01111100
    Concatenating the output column, $$\boxed{\text{encoded output} = 11\ 01\ 00\ 01\ 00\ 01\ 11 = 11010001000111}$$ Seven input bits produce fourteen output bits, confirming the rate of 1/2, and the final state is 00 as the padding requires.
  3. Part (b) — Set up the trellis and the branch metrics. The receiver sees hard-decision bits, so the maximum-likelihood path is the one whose transmitted sequence is closest in Hamming distance to the observation. Split the received sequence into seven branch pairs: $$r = \underbrace{00}_{t=1}\ \underbrace{11}_{t=2}\ \underbrace{11}_{t=3}\ \underbrace{10}_{t=4}\ \underbrace{00}_{t=5}\ \underbrace{01}_{t=6}\ \underbrace{11}_{t=7}$$ The trellis has four states $S_0 = 00$, $S_1 = 01$, $S_2 = 10$, $S_3 = 11$ (again $(u_{k-1},u_{k-2})$). It starts in $S_0$ with metric 0 and all other states unreachable; because the encoder is known to end in the all-zero state, the last two branches ($t = 6, 7$) are restricted to input 0.
  4. Run the add–compare–select recursion. At each stage every surviving state extends along its two outgoing branches, the branch Hamming distance is added to the incoming path metric, and at each new state only the smaller total survives. The table records the surviving path metric at each state after each branch, with the survivor's input history beneath it (“—” means unreachable):
    StageReceived$S_0 = 00$$S_1 = 01$$S_2 = 10$$S_3 = 11$
    $t=0$—0———
    $t=1$000  (0)—2  (1)—
    $t=2$112  (00)3  (10)0  (01)3  (11)
    $t=3$113  (100)1  (010)2  (001)1  (011)
    $t=4$102  (0100)1  (0110)2  (0101)2  (0011)
    $t=5$002  (01000)3  (01010)1  (01101)3  (01011)
    $t=6$013  (010000)1  (011010)——
    $t=7$111  (0110100)———
    At $t = 6$ and $t = 7$ only input-0 branches are permitted, which is why states $S_2$ and $S_3$ fall away and the trellis funnels back to $S_0$.
  5. Trace back the survivor. The single surviving path into $S_0$ at $t = 7$ carries a total Hamming metric of 1, and its state trajectory is $$S_0 \to S_0 \to S_2 \to S_3 \to S_1 \to S_2 \to S_1 \to S_0.$$
    S₀ 00 S₁ 01 S₂ 10 S₃ 11 00 11 10 10 00 01 11 00 t=1 11 t=2 11 t=3 10 t=4 00 t=5 01 t=6 11 t=7 received: Viterbi trellis — survivor path (bold) has Hamming metric 1 solid = input 0, dashed = input 1; branch labels on the survivor are the transmitted pairs
    Figure 3.2 — The Viterbi trellis for the seven received branch pairs. Thin grey lines are the candidate transitions explored; the bold path is the survivor. Its branch labels are the bits the encoder would have transmitted, and they differ from the received sequence in exactly one place.
  6. Read off the decoded input and the corrected sequence. The survivor's input history is 0110100, of which the last two bits are the known terminating zeros, so the transmitted message was $$\boxed{\hat{u} = 01101}$$ Re-encoding that message confirms the decision: the encoder driven with 0110100 emits $$\hat{v} = 00\ 11\ 10\ 10\ 00\ 01\ 11 = 00111010000111,$$ against the received $00111\underline{1}10000111$. The two differ in one bit only, at position 6, which the decoder has therefore corrected from 1 back to 0.
  7. Confirm that the decision is unambiguous. The survivor's metric is 1, while the next-best terminated path (message 00101, 01001 or 11101) is at Hamming distance 4. The margin is three, so no plausible tie exists and the decoding is decisive. This is the expected behaviour: the free distance of this classic $(2,1,3)$ code with generators $(5,7)$ in octal is $d_{free} = 5$, so any single error inside the span is guaranteed correctable, since $t = \lfloor (d_{free}-1)/2 \rfloor = 2$.
ResultValue
(a) Zero-padded input driven into the encoder1010100 (message 10101 plus two tail zeros)
(a) Encoded output11 01 00 01 00 01 11 = 11010001000111
(b) Received sequence00111110000111
(b) Surviving path metric (Hamming)1 (next-best terminated path: 4)
(b) Most likely transmitted code sequence00111010000111
(b) Most likely input (decoded message)01101
(b) Error correctedone bit, at received position 6 (1 → 0)