Page 9 - DCAP206_INTRODUCTION_TO_COMPUTER_ORGANIZATION_AND_ARCHITECTURE_DCAP502_COMPUTER_ORGANIZATION_AND_ARCHITECTURE
P. 9
Computer Organization and Architecture/Introduction to Computer Organization and Architecture
Notes The binary codes are classified as shown in figure 1.1.
Figure 1.1: Classification of Binary Codes
As mentioned earlier, numeric codes are used to represent numbers. The following are the numeric
codes:
1. Weighted Binary Codes: Weighted binary codes are those which follow the positional weighting
principles. In weighted codes, each position of the number represents a specific weight. For
example, in decimal code, if the number is 345, then the weight of 3 is 100, 4 is 10, and 5 is 1. In
the 8421 weighted binary code, each digit has a weight of 8, 4, 2 or 1 corresponding to its
position.
Example: The codes 8421, 2421 and 5211 are examples of weighted binary codes.
2. Non-Weighted Binary Codes: Non-weighted codes do not follow the positional weighting
principles. In non-weighted codes, each digit position within the number does not have any
fixed value.
Example:Excess-3 and Gray codes are examples of non-weighted codes. Excess-3 codes are
used to express decimal numbers. The code can be derived from the natural BCD (8421) code by
adding 3 (011 in binary) to the coded number. It is used in decimal arithmetic units. The excess-3
code of 1000 in 8421 is 1011. Gray codes represent each number in the sequence of integers {0...2^N-
1} as a binary string of length N such that the adjacent integers have Gray code representations
which differ in only one bit position.
3. Reflective Codes: A code is said to be reflective when the code for 9 is complement for the code
for 0, 8 for 1, 7 for 2, 6 for 3, and 5 for 4.
2 LOVELY PROFESSIONAL UNIVERSITY