What Problem Are We Solving?
When you send data over a wireless channel, bits can get corrupted. To fix errors, you add redundancy, extra bits that help the receiver figure out what you actually sent.
Hamming codes do this by working on fixed blocks. Take 11 bits, add 4 check bits, send the 15-bit block. Each block is independent.
Convolutional codes take a different approach. Instead of fixed blocks, they work on a continuous stream of bits. And here’s the key difference:
Each output bit depends not just on the current input, but also on the previous inputs.
The encoder remembers what you sent before.
What is an Encoder?
The encoder is the device that takes your input bits and produces output bits with redundancy added.
Think of it as a machine with a few memory slots. When you feed in a bit:
- The new bit enters the first slot
- The old bits shift over to make room
- The encoder looks at what’s in the slots and produces output
The animation shows bits shifting through memory slots. As each new bit enters, the previous bits move over. The encoder uses all the bits currently in memory to create output.
Why Memory Matters
Because the output depends on multiple bits (current + previous), there’s more redundancy built in.
If one bit gets corrupted during transmission, the receiver can use the surrounding context to figure out what it should have been. More memory = more context = better error correction.
The Generator Polynomial
Now we need to tell the encoder exactly how to combine the bits in memory. That’s what the generator polynomial does.
A generator polynomial is just a pattern that tells the encoder which memory slots to use when creating output.
Example:
Read it right to left. Each position corresponds to a memory slot:
- (rightmost) → use the current bit (slot 0)
- → skip slot 1
- → use slot 2
- (leftmost) → use slot 3
So means: “combine the bits in slots 0, 2, and 3 to produce one output bit.”
Two Polynomials = Two Outputs
If the encoder has two generator polynomials ( and ), it produces two output bits for every input bit.
- tells it how to make the first output
- tells it how to make the second output
This is where the redundancy comes from. You put in bit, you get bits out. The extra bit carries information about the history, which helps correct errors.
How Encoding Works
Let’s see the actual encoding process step by step.
The polynomial tells you which slots to look at!
Each digit in the polynomial corresponds to a slot. A means “use this slot”, a means “skip it”.
— read right to left:
| Digit | Position | Slot | Use it? |
|---|---|---|---|
| rightmost | Slot 0 | Yes | |
| Slot 1 | No | ||
| Slot 2 | Yes | ||
| leftmost | Slot 3 | Yes |
So means: look at slots 0, 2, and 3. XOR those values together.
— same idea:
- Slots 0, 1, 2 → Yes (the three s)
- Slot 3 → No (the )
Now watch the animation. It will highlight which slots each polynomial looks at, then XOR those values to produce output.
Step 1: Input bit arrives
| Slot 0 | Slot 1 | Slot 2 | Slot 3 |
|---|---|---|---|
| 1 | 0 | 0 | 0 |
Using : The 1s are at positions 0, 2, 3 (reading right to left). So we look at slots 0, 2, and 3. They contain: , , . XOR them:
Using : The 1s are at positions 0, 1, 2. So we look at slots 0, 1, and 2. They contain: , , . XOR them:
Output:
Step 2: Input bit arrives (everything shifts right)
| Slot 0 | Slot 1 | Slot 2 | Slot 3 |
|---|---|---|---|
| 0 | 1 | 0 | 0 |
Using : Look at slots 0, 2, and 3. They contain: , , . XOR them:
Using : Look at slots 0, 1, and 2. They contain: , , . XOR them:
Output:
Result: Input became output
Two input bits became four output bits. That’s the redundancy. And notice how the second output () depends on both the current bit () AND the previous bit () that shifted into slot 1.
The Key Numbers
Now we can understand what the formulas actually mean:
Code Rate
How many output bits do you get for each input bit?
If you have 2 polynomials → 2 outputs per input →
If you have 3 polynomials → 3 outputs per input →
Lower rate = more redundancy = better error correction (but more bandwidth used).
Constraint Length (K)
How many digits are in the polynomial?
| Polynomial | Digits | K |
|---|---|---|
| 4 | ||
| 6 |
This tells you the encoder’s memory size. slots hold previous bits.
- → 3 memory slots
- → 5 memory slots
Longer polynomial = more memory = output depends on more history = better error correction.
Number of States
The memory slots hold bits ( or ). The state is whatever combination of bits is currently in memory.
States =
| Memory slots | Possible combinations | |
|---|---|---|
| 3 slots | states | |
| 5 slots | states |
Which Code is Better?
If two codes have the same rate but different constraint lengths:
Longer constraint length = lower bit error rate.
More memory means the encoder can create more sophisticated redundancy. The decoder has more context to work with when fixing errors.
beats . Always.
Worked Example
Given:
- Scheme I: ,
- Scheme II: ,
Find the code rate, constraint length, and number of states. Which has lower BER?
| Scheme I | Scheme II | |
|---|---|---|
| Polynomials | 2 (, ) | 2 (, ) |
| Code Rate | ||
| K | 4 digits | 6 digits |
| States | ||
| Lower BER? | No | Yes (longer K) |
Summary
| Concept | What it means |
|---|---|
| Encoder | Device that adds redundancy using memory |
| Generator polynomial | Pattern telling which memory slots to combine |
| Code Rate | Outputs per input ( for polynomials) |
| Constraint Length | Number of digits in polynomial |
| States | possible memory configurations |
| Lower BER | Longer wins |