You are on page 1of 19

3rd Lecture

Assistance Professor
Dr. Mahmood F. Mosleh
Block Codes

• In Block codes data is grouped into blocks of length k bits (dataword)

• Each dataword is coded into blocks of length n bits (codeword), where


in general n>k

• This is known as an (n,k) block code


Block Codes
• A vector notation is used for the datawords and
codewords,
• Dataword m = (m1 m2….mk)
• Codeword c = (c1 c2……..cn)
• The redundancy introduced by the code is
quantified by the code rate,
• Code rate = k/n
• i.e., the higher the redundancy, the lower the code rate
Block Code - Example

• Dataword length k = 4

• Codeword length n = 7

• This is a (7,4) block code with code rate = 4/7

• For example, m = (1101), c = (1101001)


Parity Codes is a block code
Coding table for (4,3) even parity code •

Dataword Codeword
0 0 0 0 0 0 0
0 0 1 0 0 1 1
0 1 0 0 1 0 1
0 1 1 0 1 1 0
1 0 0 1 0 0 1
1 0 1 1 0 1 0
1 1 0 1 1 0 0
1 1 1 1 1 1 1
Linear Block Codes
• As seen from the Parity Code, it is possible to use a
table to hold all the codewords for a code and to
look-up the appropriate codeword based on the
supplied dataword
• Alternatively, it is possible to create codewords by
addition of other codewords. This has the
advantage that there is now no longer the need to
held every possible codeword in the table.
Linear Block Codes
 Linearity: If m1  c1 and m 2  c2
then m1  m 2  c1  c2

where m is a k-bit information sequence


c is an n-bit codeword.
is a bit-by-bit mod-2 addition without carry
 Linear code: The sum of any two codewords is a codeword.
 Observation: The all-zero sequence is a codeword.
Linear Block Codes
• A block codes of an (n, k) binary block code can be selected a 2k
codewords from 2n possibilities to form the code, such that each k
bit information block is uniquely mapped to one of these 2k
codewords.

• An (n,k) block code has code vectors

m=(m1 m2….mk) and

c=(c1 c2……..cn)
Linear Block Codes
• For example for a (7,4) code, only four codewords are
required, e.g.,

1 0 0 0 1 1 0
0 1 0 0 1 0 1
0 0 1 0 0 1 1
0 0 0 1 1 1 1

• So, to obtain the codeword for dataword 1011,


the first, third and fourth codewords in the list are
added together, giving 1011010
Generator matrix
If k is a large, a table look-up implementation of the encoder becomes prohibitive
for a (127,92) code there are 292 or approximately 5 × 1027 code vectors. It is
possible to reduce complexity using generator matrix (G) which can be define by
the following 𝑘 × 𝑛 array:

𝑉1 𝑉11 𝑉12 … 𝑉1𝑛


𝑉 𝑉 𝑉 … 𝑉2𝑛
𝐺 = 2 = 21 22
⋮ ⋮ ⋮ … ⋮
𝑉𝑘 𝑉𝑘1 𝑉𝑘2 … 𝑉𝑘𝑛
If m is a sequence of k message bits, the codeword U is generated by the
product of 𝑈 = 𝑚 × 𝐺
Example
Let us generate the codeword U4 for the fourth message vector 110
using the table
Suppose we have the generated matrix:
𝑉1 1 1 0 1 0 0
𝐺 = 𝑉2 = 0 1 1 0 1 0
𝑉3 1 0 1 0 0 1
For the message of the vector 𝑚 = [1 1 0]
The codeword vector is:
𝑉1
𝑈 = 1 1 0 𝑉2 = 1. 𝑉1 + 1. 𝑉2 + 0. 𝑉3
𝑉3
=110100+011010+000000=101110
Therefor the codeword for the message vector [1 1 0] is [1 0 1 1 1 0]
Systematic Linear Block Codes
A systematic linear block code have the following generator matrix:

𝑝11 𝑝12 ⋯ 𝑝1 𝑛−𝑘 1 0 ⋯ 0


𝑝 𝑝22 ⋯ 𝑝2 𝑛−𝑘 0 1 ⋯ 0
𝐺 = 21
⋮ ⋮
𝑝𝑘1 𝑝𝑘2 ⋯ 𝑝𝑘 𝑛−𝑘 0 0 ⋯ 1
Where p is the parity array portion of generator matrix 𝑝𝑖𝑗 = (0 𝑜𝑟 1), and 𝐼𝑘 is the 𝑘
× 𝑘 identity matrix. In this case the encoding complexity is further reduced since it is
not necessary to store the identity matrix portion of the array.
Parity Check Matrix
For each (𝑘 × 𝑛) generator matrix G there exists an (𝑛 − 𝑘) × 𝑛 matrix H, such that the rows
of G are orthogonal to the rows of H: that is 𝐺 × 𝐻𝑇 = 0, where 𝐻𝑇 is the transpose of H. The
components of H is written as:
𝐻 = 𝐼𝑛−𝑘 ⋮ 𝑃𝑇
Therefor 𝐻𝑇 is written as:

𝐼𝑛−𝑘
𝐻𝑇 = −−
𝑃
It can be test whether a received vector is a valid member of the codeword set, such that U is a
codeword generated by matrix G if, and only if 𝑈 × 𝐻𝑇 = 0
Syndrome testing
Let 𝑟 = 𝑟1 , 𝑟2 , … … . , 𝑟𝑛 be a received vector resulting from the transmission of 𝑈 = 𝑢1 , 𝑢2 , … . , 𝑢𝑛 . It can
describe r as:
𝑟=𝑈+𝑒
where 𝑒 = 𝑒1 , 𝑒2 , … . . , 𝑒𝑛 is an error vector introduced by the channel. The syndrome of r is defined as:
𝑆 = 𝑟 × 𝐻𝑇
So 𝑆 = 𝑈 + 𝑒 𝐻𝑇 = (𝑈𝐻𝑇 + 𝑒𝐻𝑇 )
However 𝑈𝐻𝑇 = 0 for all member of cpdeword set, therefor
𝑆 = 𝑒𝐻𝑇
The parity check matrix have two required properties:
1. No column of H can all zeros.
2. All columns of H must be unique.
Example for syndrome testing
Therefor the codeword for the message vector [1 1 0] is [1 0 1 1 1 0]
The received vector is 𝑟 = [0 0 1 1 1 0]
Now if the resulted syndrome is not zero, the received vector is corrupted:
𝑆 = 0 0 1 1 1 0 𝐻𝑇 = [1 0 0]
Which is indicate that an error in the received vector.
Not that:

1 0 0
0 1 0
𝐼𝑛−𝑘
0 0 1
𝐻𝑇 = − − =
1 1 0
𝑃
0 1 1
1 0 1
Locating the Error Pattern
First determine the syndrome corresponding to each of the
one-bit correctable error sequences by computing
𝑒𝑗 𝐻 𝑇 as follow:

1 0 0
0 1 0
0 0 1
S= 𝑒𝑗
1 1 0
0 1 1
1 0 1
The results are listed in the table
Example of Correcting Error
Assume the received codeword is 𝑟 = [0 0 1 1 1 0]. The syndrome of r is
computed 𝑆 = 0 0 1 1 1 0 𝐻 𝑇 = [1 0 0]. Using the previous table, the error
pattern corresponding to the syndrome is estimated to be
𝑒Ƹ = 1 0 0 0 0 0
The corrected vector is then estimated by
෡ = 𝑟 + 𝑒Ƹ
𝑈
=001110+100000
=101110
Decoder Implementation
We can write an expression of each of the syndrome
digits in term of received codeword digits as:
𝑆 = 𝑒𝐻 𝑇
1 0 0
0 1 0
0 0 1
S= [𝑟1 𝑟2 𝑟3 𝑟4 𝑟5 𝑟6 ]
1 1 0
0 1 1
1 0 1
and
Circuit Diagram of (6,3) SLBC

You might also like