You are on page 1of 138

Decimal Binary

Octal

Hexadecimal

Decimal Binary

Octal

Hexadecimal

0
1

0
1

0
1

0
1

8
9

1000
1001

10
11

8
9

2
3
4
5
6
7

10
11
100
101
110
111

2
3
4
5
6
7

2
3
4
5
6
7

10
11
12
13
14
15

1010
1011
1100
1101
1110
1111

12
13
14
15
16
17

A
B
C
D
E
F
1

Number Systems

System

Used by
humans?

Used in
computers?

Base

Symbols

Decimal

10

0, 1, 9

Yes

No

Binary

0, 1

No

Yes

Octal

0, 1, 7

No

No

Hexadecimal

16

0, 1, 9,
A, B, F

No

No
2

The decimal number system is also known as base 10. The

values of the positions are calculated by taking 10 to some


power.
Why is the base 10 for decimal numbers?
Because we use 10 digits, the digits 0 through 9.

1/12/2015 2:33 AM
3

The binary number system is also known as base 2.

The values of the positions are calculated by taking 2


to some power.
Why is the base 2 for binary numbers?
o

Because we use 2 digits, the digits 0 and 1.

1/12/2015 2:33 AM
4

Example of a binary number and the values of the

positions:
1 0 0 1 1 0 1
26 25 24 23 22 21 20

The hexadecimal number system is also known as base 16.


The values of the positions are calculated by taking 16 to
some power.

Why is the base 16 for hexadecimal numbers ?


Because we use 16 symbols, the digits 0 to 9 and the
letters A through F.

1/12/2015 2:33 AM
6

Binary Decimal Hexadecimal


0
0
0
1
1
1
10
2
2
11
3
3
100
4
4
101
5
5
110
6
6
111
7
7
1000
8
8
1001
9
9

Binary Decimal
1010
10
1011
11
1100
12
1101
13
1110
14
1111
15

Hexadecimal
A
B
C
D
E
F

Example of a hexadecimal number and the


values of the positions:

3 C 8 B 0 5 1
166 165 164 163 162 161 160
7

The possibilities:
Decimal

Octal

Binary

Hexadecimal

1/12/2015 2:33 AM
8

2510 = 110012 = 318 = 1916


Base

1/12/2015 2:33 AM
9

Decimal to Decimal (for understanding)


Weight

12510 =>

5 x 100=
5
2 x 101= 20
1 x 102= 100
125

Base

1/12/2015 2:33 AM
10

Technique
Multiply each bit by 2n, where n is the weight of the

bit
The weight is the position of the bit, starting from 0 on

the right
Add the results

1/12/2015 2:33 AM
11

Bit 0
1010112 =>

1
1
0
1
0
1

x
x
x
x
x
x

20
21
22
23
24
25

=
=
=
=
=
=

1
2
0
8
0
32
4310

1/12/2015 2:33 AM
12

(100010)2
=020+121+022+023+024+125
=0+2+0+0+0+32
=(34)10

(0.1011)2
=12-1+02-2+12-3+12-4
=0.5+0+0.125+0.0625
=(0.6875)10
(10101.011)2
Integer part: (10101)2=120+021+122+023+124
=1+0+4+0+16 = (21)10

Decimal part: (0.011)2 =02-1+12-2+12-3


= (0.375)10
= (21.375)10
13

Technique
Multiply each bit by 8n, where n is the weight of the

bit
The weight is the position of the bit, starting from 0 on

the right
Add the results

1/12/2015 2:33 AM
14

7248 =>

4 x 80 =

2 x 81 =

16

7 x 82 =

448
46810

15

(2376)8 = (?)10
= 283+382+781+680
= 1024+192+56+6
= (1278)10
(1234.567)8
=183+282+381+480 +58-1+68-2+78-

=512+128+24+4+0.625+0.09375+0.01367
= (668.7324219)10
16

Technique
Multiply each bit by 16n, where n is the weight of the

bit
The weight is the position of the bit, starting from 0 on

the right
Add the results

1/12/2015 2:33 AM
17

ABC16 =>

C x 160 = 12 x

1 =

12

B x 161 = 11 x

16 =

176

A x 162 = 10 x 256 = 2560


274810

18

(269)16
=2162+6161+9160
= 2256+96+9
= (617)10

(2B8D.E2)16
=2163+11162+8161+13160 +1416-1+216-2
=8192+2816+128+13+0.875+0.0078125
= (11149.88281)10

19

Technique
Divide by two, keep track of the remainder

1/12/2015 2:33 AM
20

12510 = ?2

2 125
2 62
2 31
2 15
7
2
3
2
1
2
0

1
0
1
1
1
1
1
12510 = 11111012
21

(734)10=(X)2
Take the numbers from
bottom to top,
(734)10 = ( 1011011110)2

22

(0.705)10

0.7052=1.410 ---1
0.4102=0.820 ---0
0.822= 1.64------1
0.642= 1.28------1
0.282= 0.56------0
0.562=1.12-------1
0.122=0.24-------0
0.242=0.48-------0
0.482=0.96-------0
0.962=1.92-------1

Take the number from top to bottom,


(0.705)10 = (0.1011010001)2
23

(41.915)10 =(?)2

24

Technique
Convert each octal digit to a 3-bit equivalent binary

representation

1/12/2015 2:33 AM
25

7058 = ?2
7

111 000 101

7058 = 1110001012
1/12/2015 2:33 AM
26

(632)8

110

011

010

So, (632)8=(110011010)2
27

(7423.245)8

111 100 010 011 .

010 100 101

(7423.245)8= (111100010011.010100101)2
28

Technique
Convert each hexadecimal digit to a 4-bit equivalent

binary representation

1/12/2015 2:33 AM
29

10AF16 = ?2
1

0001 0000 1010 1111

10AF16 = 00010000101011112
1/12/2015 2:33 AM
30

Technique
Divide by 8

Keep track of the remainder

1/12/2015 2:33 AM
31

123410 = ?8

8
8
8
8

1234
154
19
2
0

2
2
3
2

123410 = 23228

1/12/2015 2:33 AM
32

(2003)10=(X)8

Take the numbers from bottom to top,


(2003)10= (3723)8

33

(0.12)10 = (X)8
0.128=0.96---0
0.968=7.68---7
0.688=5.44---5
0.448=3.52---3
0.528=4.16---4
(0.12)10=(0.07534)8

34

Technique
Divide by 16

Keep track of the remainder

1/12/2015 2:33 AM
35

123410 = ?16

16
16
16

1234
77
4
0

2
13 = D
4

123410 = 4D216

36

To convert, Starting from the binary point, the


binary digits are arranged in groups of three
on both sides. Each in group of binary digit is
replaced by its octal equivalent.
Note: 0s can be added on either side, if
needed to complete a group of three.

37

10110101112 = ?8
1 011 010 111

10110101112 = 13278

38

(011101.110)2 = (?)8

011

101

110

39

Technique
Group bits in fours, starting on right

Convert to hexadecimal digits

40

10101110112 = ?16
10 1011 1011

10101110112 = 2BB16

41

When a hexadecimal number is to be


converted its equivalent binary number,
each of its digits is replaced by equivalent
group of 4 binary digits.

42

(347.28)16 = (?)2
3

0011 0100 0111 .

0010 1000

(347.28)16= (001101000111.00101000)2

43

(8BE6.7A)16 =(?)2
8

. 7

1000 1011 1110 0110 . 0111 1010


(8BE6.7A) 16 = (1000101111100110.01111010)2
44

Write down the three bit binary equivalent of


octal digit and then rearranging into group of

four bits with 0s added on either side of


decimal point, if needed to complete the

group of four.

45

(46) 8 = (?)16
Octal equivalent

Hexadecimal
equivalent

100

110

0010 0110
2

(46) 8 =(26)16
46

(764.352) 8 = (?)16
Octal equivalent

4 . 3

111 110 100.011 101 010


Hexadecimal
equivalent

0001 1111 0100.0111 0101 0000


1

4 . 7

(764.352) 8 = (1F4.750)16
47

10768 = ?16
1

001

000

111

110

10768 = 23E16

48

Technique
Use binary as an intermediary

1/12/2015 2:33 AM
49

1F0C16 = ?8
1

0001

1111

0000
4

1100

1F0C16 = 174148
1/12/2015 2:33 AM
50

The Binary Coded Decimal (BCD) is a combination


of four binary digits that represent decimal
numbers.
It has four bits and represents the decimal digits 0
to 9.
Below table gives the BCD codes for the decimal
number 0 to 15.

51

Decimal number

BCD number

0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

10

0001 0000

11

0001 0001

12

0001 0010

13

0001 0011

14

0001 0100

15

0001 0101

52

Represent the (743.3)10 in BCD


7
0111

0100 0011 . 0110

(743.3)10=(0111010000110110) BCD
53

Convert the following BCD into Decimal:

(11011100001001)BCD
0011 0111 0000 1001

(11011100001001) BCD=(3709)10
54

The rules adopted for binary additions are


0

+0

+1

+0

+1

C=0 S=0 C=0 S=1 C=0 S=1 C=1 S=0

The sum of two 1s gives binary 10 i.e.2, there is a


carry. The carry is taken to the next higher
column.
55

Two 1-bit values


A
0
0
1
1

B
0
1
0
1

A+B
0
1
1
10
two

1/12/2015 2:33 AM
56

(1010)2+(0111)2
1010 =10

+0111 =7
10001 =17

(1010)2+(0111)2=(10001)2
57

(101)2+(011)2
101=5

+011=3
1000=8

(101)2+(011)2=(1000)2
58

Add the digit in each column in decimal


and convert this sum into octal.
Write the sum in that column and carry the
carry term to the next higher significant
column.

59

Add ( 334.65)8 to (671.14) 8


3

10

10

C=1 S=2 C=1 S=2 C=0

S=6

C=1

S=0 C=1 S=1

( 334.65)8 to (671.14) 8 =(1226.01)8


60

1) (173) 8+(265) 8
2) (222) 8+(333) 8
3) (25.36) 8+(37.11) 8

4) (12) 8+(20) 8

61

Add the digit in each column in decimal


and convert this sum into hexadecimal
number.
Write the sum in that column and carry
term to the next higher significant column.

62

Add ( 7AB.67)16 to (15C.71) 16


7

16

23

13

C=0 S=9 C=1 S=0

C=1

S=7

C=0

S=D

C=0

S=8

( 7AB.67)16 + (15C.71) 16 =(0907.D8) 16


63

1) (ABC) 16+(BCD) 16
2) (9349) 16+(AACE) 16
3) (AA.BB) 16+(BB.CC) 16

4) (A0FC) 16+(B75F) 16

64

The subtraction operation and logical manipulations


become easy in digital computers by using the
concept of complements.
For a given number N in base-r, we can define two
types of complements:
rs complement
(r-1)s complement

2s & 1s complement for binary numbers


8s & 7s complement for octal numbers
10s & 9s complement for decimal numbers
16s & 15s complement for hexadecimal numbers
65

1s form of any binary number can be obtained by


replacing 0s by 1s and 1s by 0s.

Example:

1/12/2015 2:33 AM

Binary

1s

number

complement

10101

01010

11100

00011

1111

0000
66

Step1: Add minuend to the 1s complement


of the subtrahend.
Step2: Inspect the result obtained in step1
for an end carry.
(a) If an end carry occurs, add 1 to the least
significant bit. (end round carry)
(b) If an end carry doesnt occur, take 1s
complement of the number obtained in step1
and place a negative sign in front of it.

67

( 1000)2 from (1101)2

1101minuend
1000 subtrahend
1s complement of subtrahend = 0111

Add minuend
subtrahend

and

1s complement of

68

End carry

Add to LSB
0

+1
1

(1101)2 - ( 1000)2= (0101)2


69

1)

( 0101)2 from (1111)2

(1111)2 - ( 0101)2
1111minuend
0101 subtrahend
1s complement of subtrahend = 1010
Add minuend and 1s complement of
subtrahend,
70

End carry Add to LSB


1

+1
0

71

(6)10-(14)10
6=0110minuend
14=1110 subtrahend
1s complement of subtrahend = 0001
Add minuend and 1s complement of
subtrahend,

72

No End carry

Take 1s complement of the 0111 & place negative sign


in front of it =-1000

(0110)2 - ( 1110)2= -(1000)2


73

(1101) 2-(11001) 2
(1111) 2-(1011) 2

(110011) 2-(100101) 2
(10001) 2from(10011) 2

74

To find the 2s form of any binary number,


obtain the 1s complement of the given
number and then add 1 to the LSB.
Example:
(100100)2
Take 1s complement of the number = 011011
Add 1 to LSB to get 2s complement = 011011
+1
011100
2s complement = (011100)2

75

Step1: find 2s complement of subtrahend.


Step2: Add minuend and 2s complement
subtrahend.
Step3: (a) If an end carry occurs, discard it.
(b) If an end carry doesnt occur, take 2s
complement of the number obtained in
step2 and place a negative sign in front of
it.
76

(1111)2-(1100)2
1111minuend; 1100 subtrahend
2s complement of subtrahend = 0100

Add minuend and 2s complement of subtrahend,

+
1
Neglect end carry

0 (1111)2-(1100)2=

(0011)2
77

(15)10-(31)10

(1111)2-(11111)2

78

1111minuend; 11111 subtrahend


2s complement of subtrahend = 00001
Add minuend and 2s complement of subtrahend,

No end carry

So, take the 2s complement of the answer and place


negative sign in front of it, i.e.= -(10000)2

(1111)2-(11111)2= -(10000)2

79

(1101) 2-(11001) 2
125 and -68

-83 and +16


(1111) 2-(1101) 2
(10111) 2-(10011) 2
(1101) 2-(1001) 2

80

George Boole in 1854 invented a new kind of


algebra known as Boolean algebra.
It is sometimes called switching algebra.
Boolean algebra is the mathematical frame
work on which logic design based.
It is used in synthesis & analysis of binary
logical function.
81

Laws of complementation: The term


complement means invert. i.e. to change 0s
to 1s and 1 to 0s. The following are the laws
of complement. =1; = 0; =A.
OR laws
0+0=0; 0+1=1; 1+0=1;1+1=1
1+A=1; A+ =1; A+A=A; 1+ =1
AND laws
0.0=0; 0.1=0;1.0=0; 1.1=1; A. =0; A.A=A

82

Property 1: This states that the order in


which the variables ORed makes no
difference in output. i.e. A+B=B+A
A B

A+B

B+A

0 0

0 1

1 0

83

Property 2: This property of multiplication


states that the order in which the variables
are ANDed makes no difference in the
output. i.e. A.B=B.A
A

A.B

B.A

84

Commutative Laws

The commutative law of addition for two variables


is written as: A+B = B+A
A
B

A+B

B
A

B+A

The commutative law of multiplication for two


variables is written as: AB = BA
A
B

AB

B
A

BA

Property1: This property states that in the


ORing of the several variables, the result is
same regardless of grouping of variables.
For three variables i.e.(A ORed with
B)ored with C is same as A ORed with (B
ORed with C)
i.e. (A+B)+C = A+(B+C)

86

C A+B B+C (A+B)+C

A+(B+C)

87

Property2: The associative property of


multiplication states that, it makes no
difference in what order the variables are
grouped when ANDing several variables.
For three variables(A ANDed B)ANDed C
is same as A ANDed (B ANDed C)
i.e. (A.B)C = A(B.C)

88

A.B

B.C (A.B)C

A(B.C)

89

Associative Laws

The associative law of addition for 3 variables is


written as: A+(B+C) = (A+B)+C
A

A+(B+C)

B
C

B+C

A+B

B
C

(A+B)+C

The associative law of multiplication for 3 variables is


written as: A(BC) = (AB)C
A
B
C

A(BC)
BC

A
B
C

AB
(AB)C

Property 1: A(B+C) = A.B + A.C


1

B+C

A(B+C)

A.B

A.C

A.B+A.C

Column number 5= Column number 8, hence the proof.

91

Property 2: A + A B = A+B
A

AB

A B+A

A+B

92

Distributive Laws

The distributive law is written for 3 variables as follows:


A(B+C) = AB + AC
A

B+C

A
C

X=A(B+C)

AB

AC

X=AB+AC

Rules of Boolean Algebra


1. A 0 A
2. A 1 1
3. A 0 0
4. A 1 A
5. A A A
6. A A 1

7. A A A
8. A A 0
9. A A
10. A AB A
11. A A B A B
12.( A B )( A C ) A BC

___________________________________________________________
A, B, and C can represent a single variable or a combination of variables.

The important property to Boolean algebra


is called Duality principle. The Dual of any
expression can be obtained easily by the
following rules.
1. Change all 0s to 1s
2. Change all 1s to 0s
3. .s (dots) are replaced by +s (plus)
4. +s (plus) are replaced by .s (dots)
95

Examples:
X +0=X X .1=X
X+Y=Y+X X.Y=Y.X
X+1=0 X.0=1

96

DeMorgans Theorems

The complement of two or


more ANDed variables is
equivalent to the OR of the
complements of the
individual variables.

The complement of two or


more ORed variables is
equivalent to the AND of the
complements of the
individual variables.

NAND

Negative-OR

X Y X Y
NOR

Negative-AND

X Y X Y

It states that the complements of product of two


variables equal to sum of the complements of
individual variable. i.e.
=
+
A

A.B

98

A
A

It states that complement of sum of two


variables is equal to product of complement
of two individual variables.
= .

99

A+B

100

DeMorgans Theorems (Exercises)

Apply DeMorgans theorems to the expressions:

X Y Z
X Y Z
X Y Z
W X Y Z

Function Minimization using Boolean


Algebra

Examples:
(a) a + ab = a(1+b)=a
(b) a(a + b) = a.a +ab=a+ab=a(1+b)=a.

(c) a + a'b = (a + a')(a + b)=1(a + b) =a+b


(d) a(a' + b) = a. a' +ab=0+ab=ab

The other type of question


Show that;
1- ab + ab' = a
2- (a + b)(a + b') = a
1- ab + ab' = a(b+b') = a.1=a
2- (a + b)(a + b') = a.a +a.b' +a.b+b.b'
= a + a.b' +a.b + 0
= a + a.(b' +b) + 0

= a + a.1 + 0
= a +a=a

More Examples

Show that;
(a) ab + ab'c = ab + ac
(b) (a + b)(a + b' + c) = a + bc
(a) ab + ab'c = a(b + b'c)
= a((b+b').(b+c))=a(b+c)=ab+ac
(b) (a + b)(a + b' + c)
= (a.a + a.b' + a.c + ab +b.b' +bc)
=

1.
Z+
YZ
= Z[
+Y]
= Z[1]= Z
2. f = B(A+C)+C
=BA+BC+C
=BA+C(1+B)
=BA+C

105

Why logic gates are called gate?


Because they are based on physical semi-conductor
devices, called gates.

The flow of electrons of your circuit is directed and


controlled by the logical operations that the circuit
designer wanted them to follow. Then the devices that
control the flow of electrons are called gates.
What kind of gates? logic, digital gates operating with
low voltages: 0 (no difference in potential) and 1
(voltage applied).
106

What are the uses of logic gates?

107

It is an electronic circuit, which makes logic


decisions.

A digital circuit is referred to as logic gate for


simple reason i.e. it can be analysed based on
Boolean algebra.

To make logical decisions, three gates are


used.
They are OR, AND & NOT gate. These logic
gates are building blocks, which are available
in the form of IC.

108

The OR gate performs logical additions


commonly known as OR function.

Two or more inputs and only one output.

The operation of OR gate is such that a


HIGH(1) on the output is produced when any
of the input is HIGH.

The output is LOW(0) only when all the


inputs are LOW.
109

Truth table for two input OR gate:


Input

Output

Y= A+B

1
110

The AND gate performs logical multiplication.

Two or more inputs and a single output.

The output of an AND gate is HIGH only when all


the inputs are HIGH.

Even if any one of the input is LOW, the output


will be LOW.
111

Truth table for two input AND gate:


Input

Output

Y=A.B

112

The NOT gate performs the basic logical


function
called
inversion
or
complementation.

The purpose of this gate is to convert one


logic level into the opposite logic level.

It has one input and one output.


113

Truth Table

Input

output

Y=

114

The output of a NAND gate is LOW only


when all inputs are HIGH and output of the
NAND is HIGH if one or more inputs are
LOW.
Input

Output

Y = AB

0
115

The output of the NOR gate is HIGH only


when all the inputs are LOW.
Input

Output

Y=

A B

116

In this gate output is HIGH only when any


one of the input is HIGH.
The circuit is also called as inequality
comparator, because it produces output
when two inputs are different.

117

A B
B
A

Input
A

Output
Y = A B

Y = A B = A +

118

An XNOR gate is a gate with two or more


inputs and one output.
XNOR operation is complementary of XOR
operation. i.e. The output of XNOR gate is
High, when all the inputs are identical;
otherwise it is low.

119

Truth Table:
Input

Output

Y=

AB

+AB

120

NAND and NOR gates are called Universal


gates or Universal building blocks, because
both can be used to implement any gate
like AND,OR an NOT gates or any
combination of these basic gates.

121

NOT operation:

AND operation:

122

A
A+B

A B

OR operation:

NOR operation:

123

NOT operation:
AND operation:
OR operation:
NAND operation:

124

Draw the logic circuit for the Boolean


expression. Y= BC+A C+ABC

125

126

Basically digital circuits can be classified into


two types.
Sequential Digital Circuits
Combinational Digital Circuits

127

The logic circuits whose output at any


instant of time depend not only on the
present input but also on the past outputs
are called Sequential Circuits.

In sequential circuits, the output signals


are feedback to the input side. Thus, an
output signal is a function of present input
signals and a sequences of the past input
signal. i.e. the output signals.
128

The logic circuits whose output at any instant


of time are entirely dependent upon the input
signals present at that time are known as
combinational digital circuits. In particular,
the output of the combinational circuit doesnt
depend upon any past input or output So that
the circuit doesnt possess any memory. The
output signals of combinational circuits are
not feedback to any other part of the circuit.
Combinational circuit are faster, since the
operation dont have to be performed in
sequences.
129

An electronic combinational circuit which


performs the arithmetic addition of two
binary digits is called Half Adder. In the
half adder circuit, there are two inputs, one
is addend and augend and two outputs are
Sum and Carry.

130

Output
Input
A

Sum

Carry

Sum= A

B=A

Carry= A.B
131

The circuit for Half Adder using Basic Gates


is as follows:

132

The full adder is a combinational circuit


that performs the arithmetic sum of three
input bits. It consists of three inputs and
two outputs. Two of the inputs are
variables, denoted by A and B, represent
the two significant bit to be added The
third input, Cin represents carry form the
previous lower significant position.
133

134

Input

Output

Cin

Sum

Carry

1
135

Cin

Sum= Cin + B +A
+ABCin
= [ Cin +B ]+A[
+BCin]
= [B Cin]+ A[
]
= A B Cin

136

Carry = BCin+A Cin+ AB +ABCin


= BCin+A Cin+AB( +Cin)
= BCin+A Cin+ AB
= BCin+A( Cin+B)
= BCin+AB+ACin
= B( Cin+A)+ACin
=B(A+Cin)+ACin
= AB+BCin+ACin
137

138

You might also like