You are on page 1of 17

Binary Arithmetic and Arithmetic Circuits-1

Lesson: Binary Arithmetic and Arithmetic Circuits-1

Lesson Developer: Dr. DivyaHaridas

College/ Department: KeshavMahavidyalaya,


University of Delhi

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

Arithmetic Circuits-1
Table of Contents

Chapter 1 Binary Arithmetic


1.1 Chapters Objective
1.2 Introduction
1.3 Binary Arithmetic
1.3.1 Binary Addition
1.3.2 Binary Subtraction
1.4 Representation of signed binary numbers
1.5 2’s Complement Method
1.6 Summary
1.7 Exercises
1.7.1 Subjective Questions
1.7.2 Fill in the Blanks
1.8 Glossary
1.9 References

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

1.1 Chapter Objectives


 Introduction to Binary Arithmetic.
 Carry out binary addition and binary subtraction
 Representation of signed binary numbers.
 Determine the 1’s complement and 2’s complements of binary number
 Carry out arithmetic operations with signed binary numbers
 Carry out binary multiplication.
 Carry out binary division.

1.2 Introduction
Modern day calculators and computers can perform arithmetic task with superfast speed
and accuracy. It is interesting to first understand how this simple arithmetic is done
manually. Then the chapter will help you to design simple combinational circuits. A
combinational circuit consists of logic gates whose outputs at any time are determined from
the present combination of inputs. Basic adder and subtractor circuits are examples of
combinational logic circuits. This chapter begins with binary addition and subtraction and
further simple logic circuits for binary addition and subtraction are designed.

Interesting Facts
Arithmetic or arithmetics (from the Greek word arithmos "number") is the oldest and most
elementary branch ofmathematics. It consists in the study of numbers, especially the
properties of the traditional operations between them – addition, subtraction, multiplication
and division. Arithmetic is an elementary part of number theory, and number theory is
considered to be one of the top-level divisions of modern mathematics, along
with algebra, geometry, and analysis.

Term arithmetic and higher arithmetic were


used until the beginning of 20th century as
synonyms for number theory and are,
sometimes, still used to refer to a wider
part of number theory.The basic arithmetic
operations are addition, subtraction,
multiplication and division, although this
subject also includes more advanced
operations, such as manipulations
of percentages, squareroot, exponentiation,
and logarithmic functions. Arithmetic is Leibniz’s Stepped Reckoner was the first
performed according to an order of calculator that could perform all four
operations arithmetic operations

Source: http://en.wikipedia.org/wiki/Arithmetic

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

1.3 Binary Arithmetic

Binary arithmetic plays a pivotal role in many digital systems. After completing this section
you should be able to

 Add two binary numbers


 Subtract two binary numbers
 Subtract two binary numbers using 2’s complement method.

1.3.1 Binary Addition:

Trivia:

Sum: The result of an addition operation

Carry: A bit which results from the sum of two binary numbers, which can have the
value of0 or 1

Addition and subtraction were taught in elementary school in decimal number system. This
section deals with the simple task of adding numbers in binary which is easier as binary
number system have just two numbers 0 and 1. The four basic rules for adding binary digits
are as follows:

0+0=0 Sum of 0 with a carry of 0

0+1=1 Sum of 1 with a carry of 0

1+0=1 Sum of 1 with a carry of 0

1 + 1 = 10 Sum of 0 with a carry of 1

Notice that first three rules result in a single bit and in the fourth rule the addition of two 1s
yields a binary two (10). The abovementioned four rules are very easy to understand and
revise but binary addition becomes little difficult when needed to add three bits. Taking an
example of 1 + 1 + 1. In decimal the answer should be 1 + 1 + 1 = 3. i.e. in binary it
should be 11. Lets apply the above-mentioned rules to procure this answer.

1 1 10

+1 +1 +1(Third number)

+1 10 11
? as mentioned
above

such a situation of adding three bits simultaneously arise when there is a carry in any column
except in LSB. A short form of addition table is given below:

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

1
0 1 0 1 1
+0 +0 +1 +1 +1
00 01 01 10 11
CS CS CS CS CS

Where C stands for carry and S stands for sum .

Short form addition table

Example 1:

Add the binary number 1011 and 1100

Solution: 1011
+1100
10111

Carry

Example 2:

Add the binary number 0101 and 1111

(1)(1) (1)
Solution: 0101
+1111
10100

Carry

1.3.2 Binary Subtraction:

Trivia:

Difference: The result of asubtraction operation

Borrow: A bit brought back from a more significant position when the subtracted
digit is larger than minuend digit.

The binary subtraction is performed in a manner similar to that in decimal subtraction. The
rules for binary subtraction are

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

0 1 1 0

- 0 - 1 - 0 - 1
0 0 1 1
with a borrow
of 1

Practically it can be shown as 10 – 1 = 1 where 10 in LHS shows that 1 is borrowed and


now the number is (10)2 in binary (which is equivalent to 2 in decimal). So in decimal it is
2-1=1.

Example 3:

Subtract the binary number 1011 from 1101

Solution:
Subtract LSB to get

1 1 0 1
-1 0 1 1
0

To subtract the bits of the second column borrow from the next higher column to
obtain:

Borrow 1
1 0 0 1
- 1 0 1 1
0

In the second column from the right, subtract as follows 10 – 1 = 1 to get:

Borrow 1
1 0 0 1
- 1 0 1 1
1 0

Then subtract the remaining colum

Borrow 1
1 0 0 1
- 1 0 1 1
00 1 0

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

Subtraction using the above rules are easier when in Minuend (M) – Subtrahend (S) =
Difference (D), M > S but the subtraction becomes difficult when M < S. To solve such
problems one must learn subtraction using 2’s compliment method. The following section
1.4 will help students to solve subtraction problems using 2’s compliment method.

Interesting Facts
Interesting story about the origin of ‘+’ and ‘-’ signs in arithmetic
The plus and minus signs (+ and −) are mathematical symbols used to represent the
notions of positive and negative as well as the operations of addition and subtraction. Their
use has been extended to many other meanings, more or less analogous.
Plus and minus are Latin terms meaning "more" and "less", respectively.

Though the signs now seem as familiar as the alphabet or the Hindu-Arabic numerals, they
are not of great antiquity. TheEgyptian hieroglyphic sign for addition, for example,
resembled a pair of legs walking in the direction in which the text was written
(Egyptian could be written either from right to left or left to right), with the reverse sign
indicating subtraction.

In Europe in the early 15th century the letters "P" and "M" were generally used. The
symbols (P with line p for più, i.e., plus, and M with line m for meno, i.e., minus) appeared
for the first time in Luca Pacioli’s mathematics compendium, Summa de arithmetica,
geometria, proportioni et proportionalità, first printed and published in Venice in
1494. The + isa simplification of the Latin "et". The − may be derived from a tilde written
over m when used to indicate subtraction; or it may come from a shorthand version of the
letter m itself. In his 1489 treatise Johannes Widmann referred to the symbols − and +
as minus and mer (Modern German mehr; "more"): "was − ist, das ist minus, und das + ist
das mer"

A Jewish tradition that dates from at least the 19th century is to write plus using a symbol
like an inverted T. This practice was adopted intoIsraeli schools (this practice goes back to
at least the 1940s) and is still commonplace today in elementary
schools (including secularschools) but in fewer secondary schools. It is also used
occasionally in books by religious authors, but most books for adults use the international
symbol "+". The usual explanation for this practice is that it avoids the writing of a symbol
"+" that looks like a Christian cross

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

https://en.wikipedia.org/wiki/Plus_and_minus_signs

1.4 Representation of signed Binary numbers

Digital systems handle both positive and negative numbers. A signed binary number consist
of both sign and magnitude information.

Trivia:

Sign bit: The left most bit in a signed binary number indicates whether the number is
positive or negative. A 0 is for positive and a 1 is for negative.

Magnitude bit: Value of the number (except the sign bit).

Complement representation: A form of signed binary notation in which negative numbers are
represented by complementing positive number.

The signed binary numbers are represented by using the following representation

1) Sign magnitude representation


2) 1’s complement representation
3) 2’s complement representation

Of these 2’s complement representation is the most important and the signed magnitude is
rarely used.

Sign Magnitude form

In sign magnitude form, the left most bit is the sign bit and the remaining bits are
magnitude bits. For example decimal number +26 is expressed as an 8 bit signed binary
number using sign magnitude form

000111010

Sign bit Magnitude

The decimal number -26 is expressed as

100111010

Sign bit Magnitude

If the left most bit is 1 then the number is negative and if the left most bit is 0 then the
number is positive.

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

1’s complement representation

Positive numbers in 1’s complement form are represented the same way as the positive sign
magnitude numbers. Negative numbers; however are 1’s complement of the corresponding
positive number. For example decimal number -26 is expressed as the 1’s complement of
+26 (00011010) as 11100101

1.5 2’s complement representation

Positive numbers in 2’s complement form are represented the same way as the sign
magnitude and 1’s complement form. Negative numbers are the 2’s compliment of the
corresponding positive number. In 2’s complement notation, a negative number is obtained
by adding 1 to the 1’s complement form of the number.

i.e. 2’s complement number = 1’s complement number + 1

so if there is a number +X and we use 2’s complement operation then the number becomes
–X and vice-versa

i.e. +X 2’s complement - X

- X+X 2’s complement

Example 4:

Represent -5710 in 8 bit 2’s complement notation.

Solution:
Binary form of 57 = 00111001
1’s complement of 57 = 11000110
+ 1
2’s complement of 57 = 11000111 -57

It can be verified that -57 2’s Complement +57

Binary form of - 57 = 11000111

1’s complement of - 57 = 00111000


+ 1
2’s complement of - 57 = 00111001 +57

Which can be verified from above.

2’s complement form for representing signed numbers is most widely used in computers
and microprocessors based systems. Subtraction using 2’s complement method is much
easier and normally error free and works with no constraints (such as M>S in normal case).
Subtraction is a special case of addition. For example, subtracting +3 (the subtrahend) from
+6 (the minuend) is equivalent to adding (-3) to (+6). Basically the subtraction operation
changes the sign of the subtrahend and adds it to minuend.

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

We can visualize that subtraction as a special case of addition so it very easy to subtract
any two numbers irrespective of the fact that M>S or M<S. The following cases will make
this picture very clear.

Case 1:

A) Subtracting both positive numbers; where M>S

9 9 1001( 9)
(  4 ) +(  4 ) 1100( 4)
5 5 1 0101( 5)

2’s complement of 4 = 1’s complement of 4 + 1

Binary form of 4 = 0100


1’s complement of 4 = 1011
+ 1
2’s complement of 4 = 1100

B) Subtracting both positive numbers; where M<S

4 4 0100( 4)
(  9 ) +(  9 ) 0111( 9)
5 5 1011( 5)

C) One positive and other large negative number

 14  14 00001110(14)
 (  108 ) +(  108 ) 01101100(108)
122 122 01111010(122)

D) Both negative numbers

 43  43 11010101(43)
 (  78 ) +(  78 ) 01001110(78)
35 35 1 00100011(35)

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

Interesting Facts
History of the Binary System
The modern binary number system was invented by Gottfried
Leibniz in 1679 and appears in his article Explication de
l'ArithmétiqueBinaire. The full title is translated into English as the
"Explanation of the binary arithmetic, which uses only the
characters 1 and 0, with some remarks on its usefulness. Leibniz's
system uses 0 and 1, like the modern binary numeral system.
Binary systems predating Leibniz also existed in the ancient
world. The binary system of the I Ching, a text for divination, is
based on the duality of yin and yang.Leibniz interpreted the
hexagrams as evidence of binary calculus. He said that this
arithmetic by 0 and 1 is found to contain the mystery of the lines
of an ancient King and philosopher named Fuxi, who is believed to Gottfried Leibniz
have lived more than 4000 years ago, and whom the Chinese regard
as the founder of their empire and their sciences.
The Binary System of numeration is the simplest of all positional number systems. The base
- or the radix - of the binary system is 2, which means that only two digits - 0 and 1 - may
appear in a binary representation of any number. Computer memory comprises small
elements that may only be in two states - off/on - that are associated with digits 0 and 1.
Such an element is said to represent one bit - binary digit.

The first electronic computer - ENIAC which stood for Electronic Numerical Integrator And
Calculator - was built in 1946 at the University of Pennsylvania, but the invention of the
binary system dates almost 3 centuries back. According to the Oxford Encyclopedic
Dictionary, an entry BINARY ARITHMETIC first appeared in English in 1796 in A
Mathematical and Philosophical Dictionary.

https://en.wikipedia.org/wiki/Binary_number

This is an interesting game based on simple binary arithmetic. Click


http://gwydir.demon.co.uk/jo/numbers/binary/cards.htm and enjoy the game.

Binary Card Game

Choose a number from 1 to 60. You will find it on one or more of the cards. Click on all the
cards with your number on. (Don't click on the number because that would make it too easy
for the computer!) If you make a mistake, click on the card again. Make sure you have
clicked on every card with your number on or it won't work. Then click on the button to
reveal your number. It will tell you the number which you have chosen.

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

Value Addition

Binary Multiplication

Binary multiplication is similar to decimal multiplication, which is a simple paper method.


This includes multiplying the multiplicand with each bit of the multiplier, and adding the
partial products. The partial product is the same as the multiplicand if the multiplier bit is a
1 and is zero if the multiplier bit is 0. The four basic rules for multiplying binary digits are as
follows:

0x0=0

0X1=0

1X0=0

1X1=1

Example: Multiply 11012 by 1102

Solution:

1 1 0 1
 1 1 0
0 0 0 0
1 1 0 1
1 1 0 1
1 0 0 1 1 1 0

The LSB of the multiplier is a 0. The first partial product is a 0. The next two bits of the
multiplier are 1s. so the next two partial products are equal to the multiplicand itself. The
sum of the partial products gives the answer.

Example: Multiply 11012 by 1102

Solution:

1 1 0 1 1
 1 0  1
1 1 0 1 1
0 0 0 0
1 1 0 1 1
10 0 0 0 1 1  1

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

Binary Division

Binary division can be done using paper method, long-division procedures similar to those in
decimal division system. An example will clear binary division.

1.6 Summary

 The basic rules of binary addition are as follows:

0+0=0 Sum of 0 with a carry of 0

0+1=1 Sum of 1 with a carry of 0

1+0=1 Sum of 1 with a carry of 0

1 + 1 = 10 Sum of 0 with a carry of 1

 The basic rules of binary subtraction are as follows:

0-0=0 Difference of 0 with a borrow 0

10 - 1 = 1 Difference of 1 with a borrow 1

1-0=1 Difference of 1 with a borrow 0

1-1=0 Difference of 0 with a borrow 0

 The basic rules of binary multiplication are as follows:

0x0=0

0X1=0

1X0=0

1X1=1

 The signed binary numbers can be represented by using sign magnitude


representation, 1’s complement representation or 2’s complement representation.
 The left most bit of a binary number is the sign bit.
 A 0 sign bit represents a positive number.

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

 A 1 sign bit represents a negative number.


 The 1’s complement of a binary number is derived by changing 1s to 0s and 0s to 1s.
 The 2’s complement of binary number can be derived by adding 1 to the 1’s
complement.
 Binary subtraction can be done using basic rules of binary subtraction or by using 2’s
complement method.

1.7 Exercises

1.7.1 Subjective Questions

1. How can negative numbers be represented.


2. What is sign magnitude form of representation.
3. What do you understand by 1’s complement and 2’s complement representation.
4. How do you perform binary subtraction using 2’s complement method.
5. Find the 1’s complement of the following binary numbers:
i) 1100
ii) 01011100
iii) 10001000
iv) 00000000
v) 10101010
vi) 01101100
vii) 00110011
6. Find the 2’s complement of the following binary numbers:
i) 0011
ii) 0101
iii) 00110011
iv) 10010101
v) 10110010
vi) 01010000
vii) 00001111
7. Add the following binary numbers.
i) 0101 + 1001
ii) 1011 + 1101 + 1111 + 1000
iii) 110111.01 + 111110.10
iv) 10100000+01100011
v) 01010110+11010101
vi) 0011+0101+1100
8. Subtract the following
i) 1101-1000
ii) (24)10-(12)10= (x)2
iii) 1100-1001
iv) 11110000-10001100
v) (68)10-(-27)10= (x)2
vi) (37)10-(115)10= (x)2
vii) (-43)10-(78)10= (x)2

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

9. Multiply the following binary numbers


i) 11001 X 10
ii) 1101.11 X 101.1
iii) 10110 X 10.1
iv) 1011.101 X 101.01
v) 1101 X 110

Answers for few questions

5. The 1’s complement of the binary numbers are as follows


i) 0011
ii) 10100011
iii) 01110111
iv) 11111111
v) 01010101
vi) 10010011
vii) 11001100

6. The 2’s complement of the binary numbers are as follows


i) 1101
ii) 1011
iii) 11001101
iv) 01101010
v) 01001110
vi) 10110000
vii) 11110001

7. Binary number after addition


i) 1110
ii) 101111
iii) 1110101.11
iv) 100000011
v) 100101011
vi) 10100
8. Binary number after subtraction
i) 0101
ii) 1100
iii) 1001
iv) 01100100
v) 01011111
vi) 10110010
vii) 00100011
9. Binary number after multiplication
i) 110010
ii) 1001011.101
iii) 110111

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

iv) 111101.00001
v) 1001110

1.7.2 Fill in the blank

1) The 2’s complement number 1111 represents ………………. in decimal.


2) The 2’s complement number 0111 represents ………………. In binary and ………………. In
decimal.
3) In 2’s complement representation the MSB is the ………………. Bit. If the MSB is 0 then the
number is ………………. (negative/positive) whereas if the MSB is 1 the number is
………………. (negative/positive)
4) The decimal number -5 equals in ………………. 2’s complement 4 bit representation.
5) The decimal number +5 equals in ………………. 2’s complement 4 bit representation.
6) Adding the hexadecimal number AC6 to B59 results in ……………….
7) Subtracting the hexadecimal numbers A2B from BC5 results in ……………….
8) Multiplying 1101 with 101 will result in ……………….
9) Binary ………………. can be used to understand 2’s complement representation.

Answers:

1) 1
2) 1001, 9
3) Sign, positive, negative
4) 1011
5) 0101
6) 161F
7) 19A
8) 1000001
9) Odometer

1.8 Glossary

Addend In addition, the number that is added to another number

Augend In addition, the number to which the addend is added

Carry The digit generated when the sum of two binary digits exceeds 1.

Carry generation When both the inputs are 1 in full adder an output carry is produced.

Sum The result when two or more numbers are added.

Minuend The number from which another number is subtracted.

Institute of Lifelong Learning, University of Delhi


Binary Arithmetic and Arithmetic Circuits-1

Subtrahend The number which is being subtracted from the minuend.

Difference The result of subtraction

Complement The inverse or opposite of a number in Boolean Algebra. This expressed with
a bar over the variable. The complement of 0 is 1 and vice versa.

Sign bit The left most bit of a binary number that designates whether the number is
positive (0) or negative (1).

Multiplicand The number that is being multiplied by another number.

Multiplier The number that multiples the multiplicand.

1.9 Reference Books:

 Digital Principles & Applications, A.P.Malvino, D.P.Leach&Saha, 7th Ed., 2011, Tata
McGraw
 Fundamentals of Digital Circuits, A. Anand Kumar, 2nd Edition, 2009, PHI Learning
Pvt. Ltd.
 Digital Electronics, Principles and applications, Roger L Tokheim, 2003, Tata McGraw
Hill.
 Digital Systems: Principles and Applications, R.J. Tocci, N.S.Widmer, 2001, PHI
Learning.
 Digital Electronics, An introduction to theory and practice, W H Gothmann, 1982, PHI
Learning.

Institute of Lifelong Learning, University of Delhi

You might also like