Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Self-Complementing Codes (Excess 3, 84-2-1, 2*421)

Tags:

bcd

I'm having a topic here which is from "Number Systems" in the subject of "Introduction to Computer Organisation & Architecture"

Then i came across this topic,"Self complementing Codes"

There are 3 parts of it which are as follows:

i)Excess-3 (I understand this part as it requires us to add 3 to BCD)

ii)84-2-1 (I don't understand)

iii)2*421 (I don't understand)

I hope someone could explain how the part ii & iii works.

Thanks alot.

like image 983
Beta Tracks Avatar asked Sep 09 '14 15:09

Beta Tracks


People also ask

What is the self complementing property of excess-3 code?

Self-complementary property The sum of binary number and its complement is always equal to decimal 9. In other words, the 1's complement of an excess-3 code is the excess-3 code for the 9's complement of the corresponding decimal number.

Is 2421 a self complementing code?

2 4 2 1 code It is an unnatural BCD code. Sum of weights of unnatural BCD codes is equal to 9. It is a self-complementing code. Self-complementing codes provide the 9's complement of a decimal number, just by interchanging 1's and 0's in its equivalent 2421 representation.

Is 5211 a self complementing code?

If the sum of the weights is 9 then it is self complementing e.g 5211=(5+2+1+1)=9 or 2421=(2+4+2+1)=9 8421 is not self complementing so ,8421!= 9.


2 Answers

I think this part of "Digital Design" book from Morris Mano will answer your question:

BCD and the 2421 code are examples of weighted codes. In a weighted code, each bit position is assigned a weighting factor in such a way that each digit can be evaluated by adding the weights of all the 1’s in the coded combination.

Four Different Binary Codes for the Decimal Digits
_____________________________________________________________
Decimal     BCD          2421       Excess‐3    8, 4, -2, -1
 Digit      8421
_____________________________________________________________
 0          0000         0000         0011         0000
 1          0001         0001         0100         0111
 2          0010         0010         0101         0110
 3          0011         0011         0110         0101
 4          0100         0100         0111         0100
 5          0101         1011         1000         1011
 6          0110         1100         1001         1010
 7          0111         1101         1010         1001
 8          1000         1110         1011         1000
 9          1001         1111         1100         1111
_____________________________________________________________
            1010         0101         0000         0001
 Unused     1011         0110         0001         0010
 bit        1100         0111         0010         0011
 combi-     1101         1000         1101         1100
 nations    1110         1001         1110         1101
            1111         1010         1111         1110

The 2421, the excess‐3 and the 84-2-1 codes are examples of self‐complementing codes. Such codes have the property that the 9’s complement of a decimal number is obtained directly by changing 1’s to 0’s and 0’s to 1’s (i.e., by complementing each bit in the pattern). For example, decimal 395 is represented in the excess‐3 code as 0110 1100 1000. The 9’s complement of 604 is represented as 1001 0011 0111, which is obtained simply by complementing each bit of the code (as with the 1’s complement of binary numbers).

Digital Design-Fifth edition-By Morris Mano

like image 193
Mehrshad Avatar answered Oct 03 '22 10:10

Mehrshad


First of all 84-2-1 & 2421 code are "weighted code" and as well as "self-complementing code" both (because the necessary condition for a code to be self-complementing is that the sum of all of its weight must be equal to 9) i.e. 84-2-1(8+4-2-1=9) and, 2421(2+4+2+1=9).
So, constructing binary equivalent of decimal of number you to need to make sure one thing:
The number's code and its 9's complement's code should have complementary relationship (i.e. the number & its 9's complement code are complements of each other)

For example let's take a 84-2-1 System.

Decimal 0=0000(in 84-2-1 system) & (9's complement of 0=9) than 9(in 84-2-1) should have 1111. Hence 0 & its 9's complement i.e. 9 maintain their self-complement relationship.

Let's take another example:

Decimal 1=0111(in 84-2-1 system) & (9's complement of 1=8 ) that implies (84-2-1) equivalent of 8 should be 1000,hence again the number & its complement preserve their self-complementary relationship.

Similarly, as in 2421 system, all you need to construct the code by making sure that the number and its 9's complement should have maintained their self-complementing relationship.

like image 29
Abhishek Avatar answered Oct 03 '22 12:10

Abhishek