Cha 2.1 PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

1

UNIVERSITY OF GONDAR
INSTITUTE OF TECHNOLOGY
Department of Electrical and Computer Engineering
Course name: Digital Logic Design
Course code: ECEg3141
Course instructor: Amare Worku
Contact information:
Email: amareworku2154@gmail.com
Department of Electrical and Computer Engineering
Consultation hours: friday: from 8:00-11:00
CHAPTER TWO 2
Number system operation and code

Number system is nothing more than a code that uses symbol to refer a quantity of item.
Binary number system and digital code are fundamental to computer and digital electronics.
Decimal number system (0 1 2 3 4 5 6 7 8 9)
Any number is simply the sum of the product of each digit value and its positional weight.
 Decimal (base 10):
An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m
Integer Part Fraction Part

(724.56)10= 7 x 102 + 2 x 101 + 4 x 100 + 5 x 10-1 + 6 x 10-2


= 700 + 20 + 4 + 0.5 + 0.06 = 724.56
DLD chapter two 10/16/2017
3
Cont.….
 (base 10):
(312.4)10= 3 x 102 + 1 x 101 + 2 x 100 + 4 x 10-1
= 300+ 10 +2+ 0.4 = 312.4

 Binary number system (0 1)


 Base two number system.
 Like decimal numbering system binary number system is also positional value system where each binary digit has its
value expressed as power of two.
 Example, 5 4 3 2 1 0 -1 -2
b = 2: (1 1 0 1 0 1. 1 1)2  (D)10

DLD chapter two 10/16/2017


4
Cont.….

DLD chapter two 10/16/2017


5
Cont.…..

 In n bite binary number:

DLD chapter two 10/16/2017


6
Cont.…

 Binary to decimal conversion


The decimal value of any binary number is found by adding the weight value of all of the bit that are “1” and discard
all of the bit that are “0”. Conversion from base b to decimal: (N)b  (?)10

Example 1.

DLD chapter two 10/16/2017


7
Binary Numbers Special Powers of 2

210 (1024) is Kilo, denoted "K"

220 (1,048,576) is Mega, denoted "M"

230 (1,073, 741,824) is Giga, denoted "G"

240 (1,099,511,628) is Tera, denoted “T"

DLD chapter two 10/16/2017


8
Cont.….

The following are some of the technical terms used in binary system:
 Bit: It is the smallest unit of information used in a computer system. It can either have the value 0 or 1. Derived from the
words Binary ditIT.
 Nibble: It is a combination of 4 bits.
 Byte: It is a combination of 8 bits.
 Word: It is a combination of 16 bits.
 Double word: It is a combination of 32 bits.
 Kilobyte (KB): It is used to represent the 1024 bytes of information.
 Megabyte (MB): It is used to represent the 1024 KBs of information.
 Gigabyte (GB): It is used to represent the 1024 MBs of information.

DLD chapter two 10/16/2017


9
Cont.…
 Example 2.

DLD chapter two 10/16/2017


10
Cont.…
 Exercise 1. convert the following binary number to decimal
A. 10.111
B.1111000.101
C.0100110.00101
Decimal to binary conversion
Repeatedly divide the integer by the new base b and save the remainders, until you get a 0 quotient.
The digits for the new base are the remainders with the LS digit being the first remainder.
N)10  (?)b
 Procedure:
 Convert the Integer Part
 Convert the Fraction Part
 Join the two results with the new radix point
DLD chapter two 10/16/2017
11
Cont.…

Continue until
you get a 0
quotient
DLD chapter two 10/16/2017
12
Converting fraction from decimal to base b:

Repeatedly multiply the integer by the new base b and save the integer part of the result (will never exceed b)
until 0 fraction or enough digits .
 The digits for the new base are those integers with the MS digit being that computed first

Continue until
you get either:
 Zero fraction, or
 Enough # of
DLD chapter two 10/16/2017
Significant fraction digits
13
Cont.…

 Example3.
A.(153.513)10 = (?)2
B. (210.625)10= (?)2
C. (127.50)10 = (?)2

DLD chapter two 10/16/2017


14
Binary arithmetic

DLD chapter two 10/16/2017


15
Example

Add the following unsigned binary number

 A.11+11
 B.100+10
 C.111+11
 D.110+100
 E.100001110 +111100010
 F.1010101011+000011101

DLD chapter two 10/16/2017


16
Binary subtraction

DLD chapter two 10/16/2017


17
Cont.….
 Example
Perform the following unsigned binary subtraction
a.11-01
b.11-10
c.101-011
d.100110-011001

DLD chapter two 10/16/2017


18
Binary multiplication

 Binary number multiplication is performed in the same manner as decimal number multiplication.
 It involves forming partial product, shifting successive partial product left on place and then adding all the partial
product.

DLD chapter two 10/16/2017


19
Cont.….

Example 4.
 Perform the following unsigned binary multiplication.
a,11*11
b.101*111
c.1101*1010

DLD chapter two 10/16/2017


20
Binary division

 division in binary follow the same procedure as division in decimal.


 Example,
 a.110 / 11
 b. 110 / 10
 c. 1100 /100

DLD chapter two 10/16/2017


21
1’s and 2’s complement binary notation form

 1’s and 2’s complement binary number system are very important to represent negative
number.

Finding the 1’s complement


 1’s complement of the binary number is found by changing all 1’s by 0’s and all 0’s by 1’s.
 The simplest way to obtain the 1’s complement of the binary number with digital circuit is
use the parallel inverter.

DLD chapter two 10/16/2017


22
Cont.….

 Find the 1’s complement of the following binary number.


a.11111111111
b.0000000000
c.1010101010
d.1110010000
e.00100101101

DLD chapter two 10/16/2017


23
Alternative 1’s Complement Method

 For ‘n’ binary number First find , (rn – 1) in binary number form then subtract the
the complemented number from (rn – 1) .
Example.6
 For r = 2, N = 011100112, n = 8 (8 digits):
(rn – 1) = 256 -1 = 25510 or 111111112
 The 1's complement of 011100112 is then:
11111111 (8 1’s)
– 01110011
10001100
DLD chapter two 10/16/2017
24
Finding the 2’s complement

 The 2’s complement of the binary number is obtained by adding 1 to LSB of1’s complement of the
number.
 2’s complement = 1’s complement + 1
 2’s complement of the negative binary number is realized by using inverter and adder.
 Example 10101010

DLD chapter two 10/16/2017


25
Cont.….

 Example.5
perform the 2’s complement of the following binary number
A.00011010 C.1000101
B.11110111 D.111000

DLD chapter two 10/16/2017


26
Alternative 2’s Complement Method

 Given: an n-bit binary number, beginning at the least significant bit and proceeding
to higher bits:
 Starting at the LS bit, Copy all least significant 0’s
 Copy also the first 1
 Complement all remaining bits thereafter.
 2’s Complement Example:
10010100
 Copy underlined bits:

 and complement all remaining bits to the left:


01101100
DLD chapter two 10/16/2017
27
CONT….

 To convert from 1’s and 2’s complement back to the true (complemented) binary number form, use the
same procedure.
 To go from 1’s complement to true binary revers all the bite.
 To go from the 2’s complement back to the true binary form, take the 1’s complement of the 2’s
complement number and add 1 to the LSB

DLD chapter two 10/16/2017

You might also like