Synchronous Lecture Notes Week 3
Synchronous Lecture Notes Week 3
Error Coding
• The process of adding additional bits to the data
(codeword), before transmitting/storing so that if the
received/retrieved codeword has been corrupted (errors),
the corruption can be identified and corrected.
Multi-bit Codes
2 bit Coding Data Codeword transmitted
0 00
1 11
• Errors can be detected - received code 01 or 10 indicates an
error has occurred.
• Odd number of 1’s
• but there is no way to correct the error.
• If 01 received the original signal could have been
00 or 11.
• Double the memory requirements compared to the basic
data.
• Transmission rate is 1/2 = 50% - (1 data bit in 2 transmitted
bits)
3
Dr. P.J. Mather
NHE2483 Digital Systems Integration
Multi-bit Codes
3-Bit Coding Data Codeword transmitted
0 000
1 111
• Errors can be detected and also corrected.
• Received 100 is closer to 000 (1 bit error) than to 111
• Three times as much memory is required, thus makes the
coding costly.
• The data transmission rate is only a 1/3 (1 data bit in 3
transmitted bits)
• A coding system where the list of codewords and all possible 1
bit error codes use all the possible codes 23 available, is termed
PERFECT. Data Valid 1 bit error code 1 bit error code 1 bit error code
Codewords 1st bit in error 2nd bit in error 3rd bit in error
0 000 100 010 001
1 111 011 101 110
4
Dr. P.J. Mather
NHE2483 Digital Systems Integration
6
Dr. P.J. Mather
NHE2483 Digital Systems Integration
c1 c 2 c 3 c4 c5 = p 1 c6 = p2 c7 = p3
8
Dr. P. J. Mather
NHE2483 Digital Systems Integration
Developing Hamming Codes (2)
c1 c2 c3 c5 = 0
c1 c3 c4 c6 = 0
c2 c3 c4 c7 = 0
This leads to a very simple algorithm for decoding.
“parity-checks” can be used to determine whether
the codeword has been corrupted
P1 = c1 c2 c3 c5
P2 = c1 c3 c4 c6
Dr. P. J. Mather
P3 = c2 c3 c4 c7 9
NHE2483 Digital Systems Integration
Identifying Errors in Hamming Codes
1. If P1 = P2 = P3 = 0,
– c1 c2 c3 c4 c5 c6 c7 was a correct code-word and the
original data was c1 c2 c3 c4
Example 2: If 1011101 (c1 to c7) is received, then the parity bits are
p1 = c1 c2 c3 c5 = 1 0 1 1 = 1
p2 = c1 c3 c4 c6 = 1 1 1 0 = 1
p3 = c2 c3 c4 c7 = 0 1 1 1 = 1
• c common for p1,p2 & p3, is c3.
• The original transmitted code is determined by inverting c3.
• Hence the original codeword was 1001101 where the data is 1001
13
Dr. P. J. Mather
NHE2483 Digital Systems Integration
14
Dr. P. J. Mather
NHE2483 Digital Systems Integration
D-Type
FF
Dx D 2x D 3x clk
x
B
o/p B
A o/p
A
Encoder Z
Dx D 2x D 3x
x
Decoder
Z
15
Dr. P. J. Mather
NHE2483 Digital Systems Integration
Encoder
Apply an impulse x= 1 for one clock pulse (followed by ‘0’s)
monitor the output. Dx Dx Dx2 3
x
X Dx Dx 2
Dx 3
Z
1 0 0 0 1 Z
0 1 0 0 0
0 0 1 0 1 1st bit in 1st bit out
0 0 0 1 1
0 0 0 0
0000000 = 0000000
0
0000001 = 0001101
0 0 0 0 0 0000010 = 0011010
0 0 0 0 0
0000100 = 0110100
0001000 = 1101000
Note If x is all ‘0’s then the output is all ‘0’s 16 Valid Codes
(4 bits of data)
16
Dr. P. J. Mather
NHE2483 Digital Systems Integration
Decoding
x
Construct noise Look-Up
Dx Dx 2
Dx
3
0010111 0010101 x’
0011 Transmission Receiver
TX RX 0011
noise
0010101 impulse response from Look-up table
0000001 = 0011101
0000010 = 0111010
0011101 0111001 0000100 = 1110100
0000000 XOR
0111010 0001000 = 1101000
0010000 = 1010000
1110100 0000011 0100000 = 0100000
1010000
0111001
X 1000000 = 1000000
If the final error bits are not equal to 000 then the data has
been corrupted. Hence to determine the correct (original) data
the final output needs to be XOR’ed with the code in the LUT
with the same error code.
20
Dr. P. J. Mather
NHE2483 Digital Systems Integration
sin
6 5 4 3 2 1 0 3 2 1 0
control(6:0)
Induced
Error Bit
res dout(3:0)
Output Data
4.21
Dr. P. J. Mather