This document discusses different types of codes used to encode information for transmission and storage. It begins by explaining that encoding is required to send information unambiguously over long distances and that decoding is needed to retrieve the original information. It then provides reasons for using coding, such as increasing transmission efficiency and enabling error correction. The document proceeds to describe binary coding and how increasing the number of bits allows more items to be uniquely represented. It also discusses properties of good codes like ease of use and error detection. Specific code types are then outlined, including binary coded decimal codes, unit distance codes, error detection codes, and alphanumeric codes. Gray code and excess-3 code are explained as examples.
4.2
Codes
➔ Encoding isrequired for sending information over long
distances unambiguously
➔ Information needs to be decoded at the receiving end
to get back the original information
“Coding is the process of altering the characteristics of
information to make it more suitable for intended
application”
3.
4.3
Codes
➔ Need touse coding of information for a variety of reasons
◆ Increase efficiency of transmission
◆ Make data error free
◆ Enable receiver to correct information if error occurred
◆ Inform the sender if error occurred in the received
information
◆ Limit the accessibility of information
◆ Standardize a universal code
4.
4.4
Binary coding
➔ Usebinary digits (0, 1) to code the elements of an
information set
➔ For example, suppose n is the number of bits in the
word to be coded and x is the number of uniquely
coded words
◆ if n = 1, then x = 2 (0, 1)
◆ if n = 2, then x = 4 (00, 01, 10, 11)
◆ if n = 3, then x = 8 (000, 001, 010, … , 111)
➔ So, if n = j then x = 2j and
◆ n = log2 x = 3.32 log10 x
5.
4.5
Binary coding
➔ Thereare ten different symbols in the decimal number system
0, 1, 2, .. , 9
➔ We need at least four bits to represent them in binary form
8 -> 1 0 0 0
9 -> 1 0 0 1
➔ With 4 bit groups, we can have 16 four bit groups. As there are 10
digits in decimal notation, number of possible codes,
(16 C 10) x (10!)
➔ Most of these codes will not have any special properties that
would be useful in hardware design
6.
4.6
Properties Of Codes
➔Some of the desirable properties of codes
◆ Ease of coding
◆ Ease in arithmetic operations
◆ Minimum use of hardware
◆ Error detection property
◆ Ability to prevent wrong output during transitions
7.
4.7
Properties Of Codes
Someof the most commonly used codes
1) Binary Coded Decimal Codes (BCD Codes)
2) Unit Distance Codes
3) Error Detection Codes
4) Alphanumeric Codes
8.
4.8
Binary Coded DecimalCodes
➔ In a BCD/ Weighted Code, decimal value of a code is the algebraic sum of the
weights of 1’s appearing in the number
➔ More popularly used codes have the weights as,
w3 w2 w1 w0
8 4 2 1
2 4 2 1
8 4 -2 -1
9.
4.9
Binary Coded DecimalCode (BCD Code)
➔ Two desirable properties
◆ Self-complementing Codes: Complement of a code number is also
its arithmetic complement
● Example: 2421 code of (4)10 is 0110
Complement of 0110 => 1001 => (5)10 = (9 - 4)10
◆ Reflective Codes: 9’s complement of the code word can be achieved
by taking the reflected BCD code
● Example:
Excess-3 is a reflective code
0 -> 0 0 1 1 -> 1 1 0 0 (complement) -> 9 (which is 9’s
complement of 0)
5 -> 1 0 0 0 -> 0 1 1 1 (complement) -> 4 (which is 9’s
complement of 5)
10.
4.10
Binary Coded DecimalCode (BCD Code)
➔ Only 10 combinations are
utilized
➔ Remaining 6 combinations
are illegal
➔ They may be utilized for
error detection
11.
4.11
The Excess-3 codeis also called as XS-3 code.
It is non-weighted code used to express decimal
numbers.
The Excess-3 code words are derived from the
8421 BCD code words adding (0011)2 or (3)10 to
each code word in 8421.
Excess-3 code
4.13
It is thenon-weighted code and it is not arithmetic
codes.
That means there are no specific weights assigned to
the bit position.
The gray code is called as a unit distance code.
The gray code is a cyclic code.
Gray code cannot be used for arithmetic operation.
Gray Code