Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Digital Unit I Part 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 137

18ECC212J - FUNDAMENTALS OF COMPUTER

SYSTEM DESIGN

1
UNIT-1
Binary Codes, Digital Arithmetic and
Simplification of Boolean Functions

2
COMMON NUMBER SYSTEMS

System Base Symbols


Decimal 10 0, 1, … 9
Binary 2 0, 1
Octal 8 0, 1, … 7
Hexa- 16 0, 1, … 9,
decimal A, B, … F

3
QUANTITIES/COUNTING (1 OF 3)
Hexa-
Decimal Binary Octal decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
4 p. 33
QUANTITIES/COUNTING (2 OF 3)
Hexa-
Decimal Binary Octal decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
5
QUANTITIES/COUNTING (3 OF 3)
Hexa-
Decimal Binary Octal decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17 Etc.
6
CODE CONVERSION

Decimal Octal

Binary Hexadecimal

7
QUICK EXAMPLE

2510 = 110012 = 318 = 1916

Base

8
DECIMAL TO DECIMAL

Decimal Octal

Binary Hexadecimal

9
Weight

12510 => 5 x 100 = 5


2 x 101 = 20
1 x 102 = 100
125

Base

10
BINARY TO DECIMAL

Decimal Octal

Binary Hexadecimal

11
BINARY TO DECIMAL
 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

12
EXAMPLE
Bit “0”

1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310

13
OCTAL TO DECIMAL

Decimal Octal

Binary Hexadecimal

14
OCTAL TO DECIMAL
 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

15
EXAMPLE

7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810

16
HEXADECIMAL TO DECIMAL

Decimal Octal

Binary Hexadecimal

17
HEXADECIMAL TO DECIMAL
 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

18
EXAMPLE

ABC16 => C x 160 = 12 x 1 = 12


B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810

19
DECIMAL TO BINARY

Decimal Octal

Binary Hexadecimal

20
DECIMAL TO BINARY
 Technique
 Divide by two, keep track of the remainder
 First remainder is bit 0 (LSB, least-significant bit)
 Second remainder is bit 1
 Etc.

21
EXAMPLE
12510 = ?2 2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1

12510 = 11111012
22
OCTAL TO BINARY

Decimal Octal

Binary Hexadecimal

23
OCTAL TO BINARY
 Technique
 Convert each octal digit to a 3-bit equivalent binary
representation

24
EXAMPLE
7058 = ?2

7 0 5

111 000 101

7058 = 1110001012
25
HEXADECIMAL TO BINARY

Decimal Octal

Binary Hexadecimal

26
HEXADECIMAL TO BINARY
 Technique
 Convert each hexadecimal digit to a 4-bit equivalent binary
representation

27
EXAMPLE
10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112
28
DECIMAL TO OCTAL

Decimal Octal

Binary Hexadecimal

29
DECIMAL TO OCTAL
 Technique
 Divide by 8
 Keep track of the remainder

30
EXAMPLE
123410 = ?8

8 1234
8 154 2
8 19 2
8 2 3
0 2

123410 = 23228

31
DECIMAL TO HEXADECIMAL

Decimal Octal

Binary Hexadecimal

32
DECIMAL TO HEXADECIMAL
 Technique
 Divide by 16
 Keep track of the remainder

33
EXAMPLE
123410 = ?16

16 1234
16 77 2
16 4 13 = D
0 4

123410 = 4D216

34
BINARY TO OCTAL

Decimal Octal

Binary Hexadecimal

35
BINARY TO OCTAL
 Technique
 Group bits in threes, starting on right
 Convert to octal digits

36
EXAMPLE
10110101112 = ?8

1 011 010 111

1 3 2 7

10110101112 = 13278
37
BINARY TO HEXADECIMAL

Decimal Octal

Binary Hexadecimal

38
BINARY TO HEXADECIMAL
 Technique
 Group bits in fours, starting on right
 Convert to hexadecimal digits

39
EXAMPLE
10101110112 = ?16

10 1011 1011

2 B B

10101110112 = 2BB16
40
OCTAL TO HEXADECIMAL

Decimal Octal

Binary Hexadecimal

41
OCTAL TO HEXADECIMAL
 Technique
 Use binary as an intermediary

42
EXAMPLE
10768 = ?16

1 0 7 6

001 000 111 110

2 3 E

10768 = 23E
43 16
HEXADECIMAL TO OCTAL

Decimal Octal

Binary Hexadecimal

44
HEXADECIMAL TO OCTAL
 Technique
 Use binary as an intermediary

45
EXAMPLE
1F0C16 = ?8

1 F 0 C

0001 1111 0000 1100

1 7 4 1 4

1F0C16 = 17414
46 8
BASIC BINARY ARITHMETIC
 Binary Addition

47
BINARY ADDITION

0 0 1 1
+ 0 + 1 + 0 + 1
0 1 1 10

Sum Carry Sum

48
BINARY ADDITION

Examples:

01011011 10110101 00111100


+ 01110010 + 01101100 + 10101010
11001101

49
BASIC BINARY ARITHMETIC
 Binary Subtraction

50
BINARY SUBTRACTION

Borrow

0 10 1 1
- 0 - 1 - 0 - 1
0 1 1 0

Difference

51
BINARY SUBTRACTION

Examples:

01110101 10110001 00111100


- 00110010 - 01101100 - 10101100
01000011

52
BASIC BINARY ARITHMETIC

Single-bit Addition Single-bit Subtraction

Carry Sum Difference


x y c s x y d

0 0 0 0 0 0 0
0 1 0 1 0 1 1
1 0 0 1 1 0 1
1 1 1 0 1 1 0

53
INTRODUCTION

 Subtraction of a number from another can be

accomplished by adding the complement of the

subtrahend to the minuend.

54
1’S COMPLEMENT SUBTRACTION

 Subtraction of binary numbers using the 1’s

complement method allows subtraction only by

addition.

55
CONT.,

 The 1’s complement of a binary number can be obtained

by changing all 1s to 0s and all 0s and 1s.

56
1’S COMPLEMENT METHOD

 To subtract a smaller number from a larger number, the

1’s complement method is as follows

3.
1. Determine
2. Add this the
Remove tothe
the
carry
1’s
larger
complement
andnumber
add it toof
thethe
result.
smaller
Thisnumber.
carry is

called end-around-carry
57
EXAMPLE OF 1’S COMPLEMENT

Subtract (1010)2 from (1111) 2


1’s complement method
Direct Subtraction
1 1 1 1
1 1 1 1 1’s complement 0 1 0 1
1 0 1 0
Carry 1 01 0 0
0 1 01
Add Carry 1
58
0 10 1
SUBTRACTION STEPS

 Subtraction of a large number a smaller one by the 1’s

complement method involves the following steps

3.
1. The
2. Determine
Add answer
this to the
the
is the
1’s
smaller
1’s
complement
complement
numberof aoflarge
the result
numberand is

opposite in sign. There is no carry.


59
2’s Complement Subtraction

 The 2’s complement of a binary number can be obtained

by adding 1 to its 1’s complement.

60
STEPS

 Subtraction of a smaller number from a larger one by the

2’s complement method involves the following steps

1.
3.
2. Determine
Omit
Add this
the to the
the2’s
carry complement
(larger
there is alwaysof
number the smaller
a carry in thisnumber
case )

61
EXAMPLE OF 2’S COMPLEMENT

Subtract (1010)2 from (1111) 2


2’s complement method
Direct Subtraction

1 1 1 1 1 1 1 1

1 0 1 0 2’s complement 0 1 1 0
0 1 01 Carry 1 01 0 1

62
SUBTRACTION STEPS

 The carry is discarded. Thus answer is (0101)2

 The 2’s complement method for subtraction of a large

number from a smaller one is as follows.

3.
1.
2.
4. Add
There
Determine
the
To get isan2’s
noanswer
the
carry
complement
2’s .complement
The
in result
truetoform,
theissmaller
ofinthe
2’s larger
take complement
number
the 2’snumber
63
form is negative
complement and change the sign.
COMPARISON BETWEEN 1’S AND 2’S
COMPLEMENTS

1’s Complement 2’s Complement

It can be easily obtained using It has to be arrived at by first


an Inverter obtaining the 1’s complement
and then adding one (1) to it

It requires two operations Only one arithmetic operation is


required

It is often used in logical It is used only for arithmetic


manipulations for inversion applications 64
operation
LOGIC GATES

65
LOGIC GATES

66
LOGIC GATES

 The building blocks used to create digital circuits are logic


gates
 There are three elementary logic gates and a range of other
simple gates
 Each gate has its own logic symbol which allows complex
functions to be represented by a logic diagram
 The function of each gate can be represented by a truth table or
using Boolean notation

67
 The AND gate

68
 The OR gate

69
 The NOT gate (or inverter)

70
 A logic buffer gate

71
 The NAND gate

72
 The NOR gate

73
 The Exclusive OR gate

74
 The Exclusive NOR gate

75
Boolean Algebra and Logic Simplification

76
BOOLEAN OPERATIONS AND EXPRESSIONS

77
BOOLEAN OPERATIONS AND
EXPRESSIONS
 Addition  Multiplication
0+0=0 0*0=0
0+1=1 0*1=0
1+0=1 1*0=0
1+1=1 1*1 =1

78
LAWS AND RULES OF BOOLEAN ALGEBRA

79
LAWS BOOLEAN ALGEBRA

 Commutative Laws
 Associative Laws

 Distributive Law

80
LAWS OF BOOLEAN ALGEBRA
 Commutative Law of Addition:
A+B= B+A

81
LAWS OF BOOLEAN ALGEBRA

 Commutative Law of Multiplication:


A* B=B*A

82
LAWS OF BOOLEAN ALGEBRA

 Associative Law of Addition:


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

83
LAWS OF BOOLEAN ALGEBRA

 Associative Law of Multiplication:


A * (B * C) = (A * B) * C

84
LAWS OF BOOLEAN ALGEBRA

 Distributive Law:
A(B + C) = AB + AC
RULES OF BOOLEAN ALGEBRA

86
RULES OF BOOLEAN ALGEBRA

 Rule 1

OR Truth Table

87
RULES OF BOOLEAN ALGEBRA

 Rule 2

OR Truth Table

88
RULES OF BOOLEAN ALGEBRA

 Rule 3

AND Truth Table


RULES OF BOOLEAN ALGEBRA

 Rule 4

AND Truth Table

90
RULES OF BOOLEAN ALGEBRA

 Rule 5

OR Truth Table

91
RULES OF BOOLEAN ALGEBRA
 Rule 6

OR Truth Table

92
RULES OF BOOLEAN ALGEBRA

 Rule 7

AND Truth Table

93
RULES OF BOOLEAN ALGEBRA

 Rule 8

AND Truth Table

94
RULES OF BOOLEAN ALGEBRA

 Rule 9

95
RULES OF BOOLEAN ALGEBRA
 Rule 10: A + AB = A

AND Truth Table OR Truth Table 96


RULES OF BOOLEAN ALGEBRA

 Rule 11: A  AB  A  B

AND Truth Table OR Truth Table


RULES OF BOOLEAN ALGEBRA

 Rule 12: (A + B)(A + C) = A + BC

AND Truth Table OR Truth Table


DEMORGAN’S THEOREM

99
DEMORGAN’S THEOREMS

 Theorem 1

XY  X  Y
XY  X  Y
 Theorem 2

X  Y  XY
Remember:
“Break the bar,
change the sign”

100
STANDARD FORMS OF BOOLEAN
EXPRESSIONS

101
STANDARD FORMS OF BOOLEAN EXPRESSIONS

 The sum-of-product (SOP) form


Example: X = AB + CD + EF

 The product of sum (POS) form


Example: X = (A + B)(C + D)(E + F)

102
CONVERTING BETWEEN CIRCUITS
AND EQUATIONS
 Find the output of the following circuit

x x+y
y (x+y)y

y y

 Answer: (x+y)y
103
PROPERTY

COMMUTATIVE
A+B=B+A A.B=B.A

ASSOCIATIVE PROPERTY
A+(B+C)=(A+B)+C A.(B.C)=(A.B).C

DISTRIBUTIVE
A+BC= (A+B)(A+C) A.(B+C)=(A.C)+(A.B)

104
BOOLEAN LAWS
ADDITION
  
1) A+0=A
2) A+1=1
3) A+A=A
4) A+=1
MULTIPLICATION
5) A.0=0
6) A.1=A
7) A.A=A
8) A=0
9) =A
105
PROOF

i)   A+AB = A
ii) A+ B=A+B
iii) AB+
SOLUTION
A+AB= A(1+B) DIS
= A(1) LAW 2
=A LAW 6

106
A+ 
 B= (A+ ).(A+B) DIS
= (1) .(A+B) LAW4
= A+B LAW6

AB+ BC+ C = AB+ C +BC(A+ )


= AB+ C +ABC + BC
= AB(1+C)+ C (B+1)
= AB + C (CONSENSUS THEOREM)

107
DE MORGANS
   =+
BUBBLE PUSHING THEOREM

=.

108
SOLVE
   THE FOLLOWING
A+AB+ AC = A+ AC (A+AB=A)
= A(1+ C)
= A(1)
=A
AC(BD+CED)+A
=ACBD+ACCED+ A (DIS)
= 0 + ACED + A (LAW 7&8)
= A (CED+ (A+B=A+B)
= A (ED

109
 
=F

F
=
= (a+b)(a+c)=a+bc
=
=

110
BCD ADDITION
What is BCD
Binary Coded Decimal
Mean’s
If decimal converted binary (eg) 17
2 17
2 8 -1
2 4 -0
2 2 -0
1- 0 0001 0001
BCD 1 7
0001 0111
111
1 0 0 1
0 1 0 0 (+)
1 1 0 1
0 1 1 0 (+)
000100 1 1
1 3

112
19 - 00011001
14 - 00010100
33- 00101101

00101101
0110
00110011
3 3

113
GATES
BASIC
AND
OR
NOT
UNIVERSAL
NAND
NOR
DERIVED
EX-OR
EX-NOR

114
AND

A B OUT
A 0 0 0
OUT 0 1 0
B 1 0 0
1 1 1

115
OR

A A B OUT
OUT 0 0 0
B 0 1 1
1 0 1
1 1 1

116
NOT
A OUT A OUT
0 1
1 0

OR + NOT
NOR

117
NAND GATE

A B OUT
A 0 0 1
0 1 1
B 1 0 1
1 1 0

118
IMPLEMENT INVERTER USING NAND GATE

A
OUT
B
A OUT
B

0 0 1
0 1 1
1 0 1
1 1 0

119
 
OR gate using NAND gate

A
= A+B

120
121
122
123
124
125
126
ERROR DETECTING AND
CORRECTING CODES
127
INTRO
 The dynamic physical interaction of the electrical signals
affecting the data path of a memory unit may cause occasional
errors in storing and retrieving the binary information. The
reliability of a memory unit may be improved by employing
error‐detecting and error‐correcting codes. The most common
error detection scheme is the parity bit.
 A parity bit is generated and stored along with the data word in
memory. The parity of the word is checked after reading it
from memory. The data word is accepted if the parity of the
bits read out is correct. If the parity checked results in an
inversion, an error is detected, but it cannot be corrected.
128
INTRO-CONT
 An error‐correcting code generates multiple parity check
bits that are stored with the data word in memory. Each
check bit is a parity over a group of bits in the data
word. When the word is read back from memory, the
associated parity bits are also read from memory and
compared with a new set of check bits generated from the
data that have been read.
 If the check bits are correct, no error has occurred.

 A single error occurs when a bit changes in value from 1 to


0 or from 0 to 1 during the write or read operation. If the
specific bit in error is identified, then the error can be
corrected by complementing the erroneous bit. 129
PARITY BIT
 It is used for the purpose of detecting errors during Tx of
the binary information.
 A parity bit is an extra bit included with a binary
massage to make the number of 1’s either odd or even.
 The message, including the parity bit is transmitted and
then checked at the receiving end for errors.
 An error is detected if the checked parity does not
correspond with the one transmitted.

130
PARITY GENERATOR AND CHECKER
 The CKT that generates the parity bit in the transmitter is
called a parity generator and the CKT that checks the
parity in the receiver is called parity checker
EVEN & ODD Parity
 In even parity , the added parity bit will make the total
no of 1’s even amount. Use XOR
 In odd parity , the added parity bit will make the total no
of 1’s odd amount. Use XNOR

131
HAMMING CODE
 Hamming code not only provide the detection of a bit error,
but also identifies which bit is in error so that it can be
corrected.
Number of Parity Bits
2r  m + r + 1
m -> information bit
r -> parity bit
Case:1
m=4, let r=2 then 2 2 = 4 , 4+2+1=7, 4 ≠7 Not satisfied
Case:1
m=4, let r=3 then 2 3 = 8 , 4+3+1=8, 8 =7 satisfied 132
CONT……
  
The parity bits are located in the position that are
numbered corresponding to ascending power of Two
(1,2,4,8….)
 Format of (4,3) 7 bit hamming code to be transmitted ,
were 4 mgs bit, 3 parity bit

Assignment FOR P1
m7 m6 m5 p4 m3 p2 p1

111 110 101 100 011 010 001


P1 has one in right position 133

So it will calculated m7
CONT……
Assignment
   FOR P4
m7 m6 m5 p4 m3 p2 p1

111 110 101 100 011 010 001


P4 has one in left position
So it will calculated m7
Assignment FOR P2
m7 m6 m5 p4 m3 p2 p1

111 110 101 100 011 010 001


134
P2 has one in middle position
So it will calculated m7
PROBLEM-1
Encode the binary word 1011 into seven bit even parity
hamming code.
2r  m + r + 1
  m7=1
So m= 4 , let r = 3   m7=0
23  4 + 3+ 1   m7=0
88

Bit desinition m7 m6 m5 p4 m3 p2 p1
Bit location 7 6 5 4 3 2 1
Binary code 111 110 101 100 011 010 001
Information bits 1 0 1 1
Paity Bit 0 0 1
Coded message 1 0 1 0 1 0 1 135
PROBLEM-2
Encode the binary word 10111 into seven bit odd parity
hamming code.
=0
 
2 m+r+1
r

=1
 
So m= 5 , let r = 4
24  5 + 4+ 1
=1
 
16  10 =0
 
Bit desinition m9 p8 m7 m6 m5 p4 m3 p2 p1
Bit location 9 8 7 6 5 4 3 2 1
Binary code 1001 1000 0111 0110 0101 0100 0011 0010 0001

Information bits 1 0 1 1 1
Paity Bit 0 1 1 0
Coded message 1 0 0 1 1 1 1 1 0 136
PROBLEM-3
Assume that even parity hamming code 0100011 is
received. Find error in the message and correct it ?
Bit desinition m7 m6 m5 p4 m3 p2 p1
Bit location 7 6 5 4 3 2 1
Binary code 111 110 101 100 011 010 001
Information bits 0 1 0 0 0 1 1

Correct information 0 1 1 0 0 0 1

c=p
  m7=1 101 = 5
c=
  p2 m7=0 Invert the bit
c=p4
  m7 = 1 in 5th 137

location

You might also like