KEMBAR78
Arithematic Binary Operations | PDF | Subtraction | Computer Science
0% found this document useful (0 votes)
25 views16 pages

Arithematic Binary Operations

Arithematic Binary Operations

Uploaded by

vvonline2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views16 pages

Arithematic Binary Operations

Arithematic Binary Operations

Uploaded by

vvonline2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

BINARY ADDITION:-

The binary addition rules are as follows


0+0=0;
0+1=1;
1+0=1;
1 + 1 = 10 , i.e 0 with a carry of 1
BINARY SUBTRACTION:-

The binary subtraction rules are as follows


0-0=0;
1-1=0;
1-0=1;
0 - 1 = 1 , with a borrow of 1

BINARY MULTIPLICATION:-

The binary multiplication rules are as follows


0x0=0;
1x1=1;
1x0=0;
0x1=0
• 1’s complement:
To obtain 1’s complement of a binary number each bit of the number is subtracted from 1.
Thus 1’s complement of a binary number is the number that results when we change each 0 to a 1 and each 1
to a 0.

1’s complement subtraction:


Instead of subtracting the second number from the first, the 1’s complement of the second number is added to
the first number. The last carry which is said to be a END AROUND CARRY, is added to get the final result.
• If there is no carry in the 1’s complement subtraction, it indicates that the

• The following points should be noted down when we do 1’s complement subtraction.
1. Write the first number (minuend) as such.
2. Write the 1’s complement of second number(subtrahend)
3. Add the two numbers.
4. The carry that arises from the addition is said to be “end around carry”.
5. End-around carry should be added with the sum to get the result.
6. If there is no end around carry find out the 1’s complement of the sum and put a negative sign before the
result as the result is negative.
• 2’s Complement:
2’s complement results when we add ‘1’ to 1’s complement
of the given number i.e., 2’s complement =1’s complement +
1.

2’s Complement Subtraction:


Steps: 1. Write the first number as such
2. Write down the 2’s complement of the second number.
3. Add the two numbers.
4. If there is a carry, discard it and the remaining part (sum)
will be the result (positive).
5. If there is no carry, find out the 2’s complement of the sum
and put negative sign before the result as the result is
negative.
Binary multiplication: Binary division:
The table for binary multiplication is given below The table for binary division is as follows.
0x0=0 0÷1=0
0x1=0 1÷1=1
1x0=0 As in the decimal system division by zero is
1x1=1 meaning less.

1100 => 12
1011 => 11 11 => 3
110 => 6 100 => 4
1000010 => 66 12 / 3 = 4
11 x 6 = 66
• SIGNED NUMBER :-
In sign – magnitude form, additional bit called the sign bit is placed in front of the number.
If the sign bit is 0, the number is positive.
If it is a 1, the number is negative.
For example:-
0 1 0 1 0 0 1 = +41
1 1 0 1 0 0 1 = -41

DIGITAL CODES:-

✓ In practice the digital electronics requires to handle data which may be numeric, alphabets and special
characters.
✓ This requires the conversion of the incoming data into binary format before it can be processed.
✓ There is various possible ways of doing this and this process is called encoding.
✓ To achieve the reverse of it, we use decoders.
• WEIGHTED AND NON-WEIGHTED CODES:-
• There are two types of binary codes 1) Weighted binary codes 2) Non- weighted binary codes
• In weighted codes, for each position ( or bit) ,there is specific weight attached. For example, in binary
number, each bit is assigned particular weight 2n where ‘n’ is the bit number for n = 0,1,2,3,4 the weights are
1,2,4,8,16 respectively.
Example :- BCD
• Non-weighted codes are codes which are not assigned with any weight to each digit position, i.e., each digit
position within the number is not assigned fixed value.
Example:- Gray codes and Excess – 3 (XS -3) code

BINARY CODED DECIMAL (BCD):-


• BCD is a weighted code. In weighted codes, each successive digit from right to left represents weights equal
to some specified value and to get the equivalent decimal number add the products of the weights by the
corresponding binary digit.
• 8421 is the most common because 8421 BCD is the most natural amongst the other possible codes.
• BINARY CODED DECIMAL (BCD):
Binary Coded Decimal(BCD) is a way to express each of the decimal digits with a binary code.
There are only ten code groups in the BCD system.
The 8421 code is a type of BCD code.
In BCD each decimal digit , 0 through 9 is represented by a binary code of four bits.
The designation of 8421 indicates the binary weights of the four bits (23 ,22 ,21 ,20 ). The largest 4-bit code is
1001. The numbers 1010, 1011, 1100, 1101, 1110, and 1111 are called forbidden numbers.
The following table represents the decimal and 8421 equivalent numbers.
8421 or BCD Addition:
In 8421 addition, if there is a carry or if it results in a forbidden group, then 0110(6) should be added in
order to bring the result to the 8421 mode again.
• GRAY CODE:-
✓ The gray code is a non-weighted code.
✓ It is not a BCD code.
✓ It is cyclic code because successive words in this differ in one bit position only i.e it is a unit distance code.

BINARY- TO – GRAY CONVERSION:-


Binary to Gray code conversion is done by making use of the following steps
1. The MSB (left most) of the Gray code is same as that of the binary number
2. Add the MSB to the next bit to get the next Gray code digit, neglecting carry, if any.
3. Continue the process till the LSB is reached.
Convert the binary 1011 to the Gray code.

The gray code is 1110


• Gray to Binary CONVERSION:-
Gray code to binary conversion is done by making use of the following steps
1. The MSB (left most) of the binary number is same as that of the Gray code
2. Add each binary digit generated to the Gray code in the next adjacent position of the binary code to get the
next Gray code bit, neglecting carry, if any.
3. Continue the process till the LSB is reached.
• EXCESS THREE(XS-3) CODE:-
• The Excess-3 code, also called XS-3, is a non- weighted BCD code.
• This derives it name from the fact that each binary code word is the corresponding 8421 code word plus 0011(3).
• It is a sequential code. It is a self complementing code.
• Alphanumeric code
• Computers, printers and the other devices must process both alphabetic and numeric information. Serial
coding systems have been developed to represent alphanumeric information as a series of 1’s and 0’s.
• The characters to be coded are alphabets(26), numerals (10) and special characters such as +,-, /,*, $ etc
• In order to code a character, string of binary digits is used.
• In order to ensure uniformity in coding, two standard codes have been used.
• 1. ASCII: American Standard Code for Information Interchange.
• 2. EBCDIC: Extended Binary Coded Decimal Interchange Code. It is an 8 bit code.
• ASCII is 7-bit code of the form X6, X5, X4, X3, X2, X1, X0 and is used to code two types of information.
• One type is the printable character such as alphabets, digits and special characters. The other type is known as
control characters which represent the coded information to control the operation of the digital computer and
are not printed.
• The full form of ASCII code is the American Standard Code for Information Interchange. It is a seven-bit code
based on the English alphabet.
• EBCDIC stands for Extended Binary Coded Decimal Interchange Code. IBM invented this code to extend the
Binary Coded Decimal which existed at that time. All the IBM computers and peripherals use this code. It is
an 8-bit code and therefore can accommodate 256 characters.

You might also like