You are on page 1of 31

DIGITAL LOGIC DESIGN

Digital Computers and Digital Systems A computer is a programmable device, usually electronic in nature that can Store , Retrieve, and process data. A computer that stores data in terms of digits (numbers) and proceeds in discrete steps from one state to the next is called as digital computer. Digital System Characteristics of a digital system is its manipulation of discrete elements of information. Such discrete elements may be electric impulses, the decimal digits, and the letters of an alphabet, arithmetic operations, punctuation marks, or any other set of meaningful symbols. A sequence of discrete elements forms a language. Analog vs. Digital System Analog system process continuous range signal Digital System process discrete value signal

Analog vs. Digital Applications Still picture recording audio/video recording Telephone system

Why becoming digital? Flexibility Reliability Speed cost Binary Numbers The number system followed by computers Base is two and any number is represented as an array containing 1s and 0s representing coefficients of power of two. Used in computer systems because of the ease of representing 1 and 0 as two levels of voltage/power high and low Numbers can be expressed using many representations. For eg: 15 - Decimal 1111 Binary F Hexadecimal 17 - Octal Base or Radix of a number is the number of different digits which can occur at each position in the number system Counting is done with reference to a Base Decimal has base of Ten Binary has base of Two Octal has base of Eight Hexadecimal has base of Sixteen Decimal 0,1,2,3.9 Octal 0,1,2,3,..7 Binary 0,1 Hexadecimal 0-9,A-F Binary Numbering systems Base: 2 Digits: 0, 1 binary number: 1101012 5 4 positional powers of 2: 2 2 23 22 21 20 decimal positional value: 32 16 8 4 2 1 2

binary number:

0 1

Binary to Decimal Conversion Ex1: 1101012 positional powers of 2: decimal positional value: binary number: 25 24 23 22 21 20 32 16 8 4 2 1 1 1 0 1 0 1 32 + 16 + 0 + 4 + 1 = 5310

Binary to Decimal Conversion Ex2: 1010112 positional powers of 2: decimal positional value: binary number: 25 24 23 22 21 20 32 16 8 4 2 1 1 0 1 0 1 1 32 + 8 + 2 + 1 = 4310

Decimal to Binary Conversion The Division Method. Divide by 2 until you reach zero, and then collect the remainders in reverse. Ex 1: 5610 = 1110002 2 ) 56 Rem: 2 ) 28 0 2 ) 14 0 2) 7 0 2) 3 1 2) 1 1 0 1

Decimal to Binary Conversion Ex 2: 3510 = 2) 2) 2) 2) 2) 2) Rem:

Answer:

3510 = (

Octal Numbering systems


Base: 8 Digits: 0, 1, 2, 3, 4, 5, 6, 7 Octal number: 12468

Octal to Decimal Conversion To convert to base 10, beginning with the rightmost digit multiply each nth digit by 8 , and add all of the results together. Ex: 12468 3 2 1 0 positional powers of 8: 8 8 8 8 decimal positional value: 512 64 8 1 Octal number: 1 2 4 6 512 + 128 + 32 + 6 = 67810

(n-1)

Octal to Decimal Conversion Ex2: 103528 positional powers of 8: decimal positional value: Octal number: 84 83 82 81 80

Decimal to Octal Conversion The Division Method. Divide by 8 until you reach zero, and then collect the remainders in reverse. Ex 1: 433010 = 103528 8 ) 4330 Rem: 8 ) 541 2 8 ) 67 5 8) 8 3 8) 1 0 0 1 Decimal to Octal Conversion Ex 2: 81010 = 8 ) 810 Rem: 8) 8) 8) Answer: 81010 = ( )8

Hexadecimal Numbering systems Base: 16 Digits: 0, 1, 2, 3, 4, 5, 6, 7,8,9,A,B,C,D,E,F Hexadecimal number: 1F416 Hexadecimal Numbering systems Four-bit Group 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 Decimal Digit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Hexadecimal Digit 0 1 2 3 4 5 6 7 8 9 A B C D E

1111

15

Hexa to Decimal Conversion To convert to base 10, beginning with the rightmost digit multiply each nth digit by 16(n-1), and add all of the results together.

Ex1: 1F416 positional powers of 16: 163 162 161 160 decimal positional value: 4096 256 16 1 Hexadecimal number: 1 F 4 256 + 240 + 4 = 50010 Hexa to Decimal Conversion Ex2: 7E16 positional powers of 16: decimal positional value: Hexa number: 163 162 161 160

Decimal to Hexa Conversion The Division Method. Divide by 16 until you reach zero, and then collect the remainders in reverse. Ex 1: 12610 = 7E16 16) 126 Rem: 16) 7 14=E 0 7 Decimal to Hexa Conversion Ex 2: 81010 = 16 ) 810 16 ) 16 ) Rem:

Answer:

81010 = (

)16

Binary to Octal Conversion Since the maximum value represented in 3 bit is equal to: 23 1 = 7 i.e. using 3 bits we can represent values from 0 7 which are the digits of the Octal numbering system. Thus, three binary digits can be converted to one octal digit and visa versa.

Binary to Octal Conversion Three-bit Group 000 001 010 011 100 101 110 111

Decimal Digit 0 1 2 3 4 5 6 7

Octal Digit 0 1 2 3 4 5 6 7

Octal to Binary Conversion Ex1 : Convert 7428 = ( 7 = 111 4 = 100 2 = 010 7428 = 111 100 0102 Binary to Octal Conversion Ex2 : Convert 101001102 = ( 110 = 6 100 = 4 010 = 2 )8 )2

( pad empty digits with 0)

101001102 = 2468

Binary to Hexa Conversion Since the maximum value represented in 4 bit is equal to: 24 1 = 15 i.e. using 4 bits we can represent values from 0 15 which are the digits of the Hexadecimal numbering system. Thus, Four binary digits can be converted to one Hexadecimal digit. Binary to Hexa conversion Four-bit Group 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Decimal Digit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hexadecimal Digit 0 1 2 3 4 5 6 7 8 9 A B C D E F

Hexa to Binary Conversion Ex1 : Convert 3D916 =( )2 3 = 0011 D = 1101 9 = 1001 3D916 = 0011 1101 10012 Binary to Hexa Conversion Ex2 : Convert 101001102 = ( )16 0110 = 6

1010 = A 101001102 = A616

Octal to Hexa Conversion To convert between Octal to Hexadecimal numbering systems and visa versa convert from one system to binary first then convert from binary to the new numbering system Hexa to Octal Conversion Ex1 : Convert E8A16 =( )8 1110 111 7 E8A16 = 72178 1000 10102 010 2 001 1 010 2 (group by 3 bits)

Octal to Hexa Conversion Ex1 : Convert 7528 = ( )16 111 0001 1 7528 = 1EA16 For floating points: -(1010.011)2 = 23+21+2-2+2-3=(10.375)10 - (630.4)8=6*82+3*8+4*8-1=(408.5)10 Complement Addition and Subtraction: 101 1110 E 0102 1010 A (group by 4 bits)

Signed Numbers

10

11

12

Binary Coded Decimal


One of the most widely used representations of numerical data is the binary coded decimal (BCD) form in which each integer of a decimal number is represented by a 4bit binary number. Example: Convert 4096 into BCD First of all we take the Left Hand digit. 4 = 0100 Then we go through the rest of the digits in turn: 0 = 0000 9 = 1001 6 = 0110 Finally we stick all of it together in the order it appears in the original number, i.e. 0100 0000 1001 0110 so 4096 = 0100000010010110 (BCD).

Excess-3-Code
It is a 4 bit code. In this code, a digit is represented by adding 3 to the number and then converting it to a 4-bit binary number. It can be used for the representation of multi-digit decimal numbers as can BCD. Conversion of Decimal to Excess 3- Code Convert 2910 to Excess 3 code 2 9 3 3 5 12 0101 1100 Excess 3 code for 29 = (0 1 0 1 1 1 0 0)

ASCII Alphanumeric Code


The American Standard Code for Information Interchange (ASCII) is the standard alphanumeric code for keyboards and a host of other data interchange tasks. Letters, numbers, and single keystroke commands are represented by a seven-bit word.

13

Char A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

7 bit ASCII 100 0001 100 0010 100 0011 100 0100 100 0101 100 0110 100 0111 100 1000 100 1001 100 1010 100 1011 100 1100 100 1101 100 1110 100 1111 101 0000 101 0001 101 0010 101 0011 101 0100 101 0101 101 0110 101 0111 101 1000 101 1001 101 1010

HEX 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A

Char a b c d e f g h i J k l m n o p q r s t u v w x y z

7 bit ASCII 110 0001 110 0010 110 0011 110 0100 110 0101 110 0110 110 0111 110 1000 110 1001 110 1010 110 1011 110 1100 110 1101 110 1110 110 1111 111 0000 111 0001 111 0010 111 0011 111 0100 111 0101 111 0110 111 0111 111 1000 111 1001 111 1010

HEX 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A

Char 0 1 2 3 4 5 6 7 8 9 blank . ( + $ * ) / , =

7 bit ASCII 011 0000 011 0001 011 0010 011 0011 011 0100 011 0101 011 0110 011 0111 011 1000 011 1001 010 0000 010 1110 010 1000 010 1011 010 0100 010 1010 010 1001 010 1101 010 1111 010 1100 010 1101

HEX 30 31 32 33 34 35 36 37 38 39 20 2E 28 2B 24 2A 29 2D 2F 2C 2D

Problem-1 ASCII keyboard, produces ASCII equivalent of the designated character. PRINT X What is the output? P 101 0000 R 101 0010 I 100 1001 N 100 1110 T 101 0100 010 0000 X 101 1000

14

Boolean Algebra
Boolean algebra is a deductive mathematical system closed over the values zero and one (false and true).

Laws of Boolean Algebra


Note that every law has two expressions, (a) and (b). This is known as duality. These are obtained by changing every AND(.) to OR(+), every OR(+) to AND(.) and all 1's to 0's and vice-versa. T1 : Commutative Law (a) A + B = B + A (b) A B = B A T2 : Associate Law (a) (A + B) + C = A + (B + C) (b) (A B) C = A (B C) T3 : Distributive Law (a) A (B + C) = A B + A C (b) A + (B C) = (A + B) (A + C) T4 : Identity Law (a) A + A = A (b) A A = A T5 : (a) AB + AB1 = A (b) (A+B) (A+B1 )= A T6 : Redundance Law (a) A + A B = A (b) A (A + B) = A T7 : (a) 0 + A = A (b) 0 A = 0 T8 : (a) 1 + A = 1 (b) 1 A = A

15

T9 : (a) A1+A=1 (b) A1A=1 T10 : (a) A+ A1B=A+B (b) A( A1 +B)=AB T11 : De Morgan's Theorem (a)(A+B)1 =A1 B1 (b) (AB)1=A1+ B1 Prove the Following Question : 1 (1) Algebraically

Complement of a Function Complement of a variable x is x (0 -> 1 and 1 -> 0) The complement of a function F is F and is obtained from an interchange of 0s for 1s and 1s for 0s in the value of F The dual of a function is obtained from the interchange of AND and OR operators and 1s and 0s The complement of a function can be obtained by demorgans law. The demorgan law with 2 variables (X+Y)' = x' y' (XY) ' = x' + y' Demorgans law can be extended for 3 variables (X + Y + Z) ' = (X +A)' A = Y+Z = X'A' Demorgans Theorem = X' (Y+Z)' A = Y + Z = X'(Y'Z') Demorgans theorem = X'Y'Z' Associative Law 16

Example Find the Complement of the Function F1 = X'YZ' + Z'Y'Z = (X + Y' + Z) (X + Y + Z') F2 = X(Y'Z' + YZ) = (X' + ( Y + Z) (Y' + Z') Logic Gates Digital systems are said to be constructed by using logic gates. These gates are the AND, OR, NOT, NAND, NOR, EXOR and EXNOR gates. The basic operations are described with the aid of truth tables.

17

Logic Gates The AND Gate The AND gate implements the AND function. With the gate shown to the left, both inputs must have logic 1 signals applied to them in order for the output to be a logic 1. With either input at logic 0, the output will be held to logic 0.

A 0 0 1 1

B 0 1 0 1

Y=A.B 0 0 0 1

The OR Gate The OR gate is sort of the reverse of the AND gate. The OR function, like its verbal counterpart, allows the output to be true (logic 1) if any one or more of its inputs are true. In symbols, the OR function is designated with a plus sign (+). In logical diagrams, the symbol to the left designates the OR gate.

The NOT Gate, or Inverter The inverter is a little different from AND and OR gates in that it always has exactly one input as well as one output. Whatever logical state is applied to the input, the opposite state will appear at the output. The NOT function is denoted by a horizontal bar over the value to be inverted, as shown in the figure to the left. In some cases a single quote mark (') may also be used for this purpose: 0' = 1 and 1' = 0.

18

Derived Logical Functions and Gates While the three basic functions AND, OR, and NOT are sufficient to accomplish all possible logical functions and operations, some combinations are used so commonly that they have been given names and logic symbols of their own. The first is called NAND, and consists of an AND function followed by a NOT FUNCTION

The NOR Gate The NOR gate is an OR gate with the output inverted. Where the OR gate allows the output to be true (logic 1) if any one or more of its inputs are true, the NOR gate inverts this and forces the output to logic 0 when any input is true.

19

The Exclusive-OR, or XOR Gate The Exclusive-OR, or XOR function is an interesting and useful variation on the basic OR function. Verbally, it can be stated as, "Either A or B, but not both." The XOR gate produces a logic 1 output only if its two inputs are different. If the inputs are the same, the output is a logic 0.

A function in sum of products form can be implemented using NAND gates by replacing all AND and OR gates by NAND gates. A function in product of sums form can be implemented using NOR gates by replacing all AND and OR gates by NOR gates. Minterms and Maxterms A binary variable may appear either in its normal form (x) or in its complement form X'. Consider 2 binary variables X & Y combined with an AND operation There are 4 possible outcomes 1. X'Y' 2. XY' 3. X'Y 4. XY Each of these four AND terms represent a minterm or standard product. N variables can be combined to form 2n Minterms.

20

Minterm (or standard product): n variables combined with AND n variables can be combined to form 2n minterms two variables: xy, xy, xy, and xy A variable of a minterm is primed if the corresponding bit of the binary number is a 0, and unprimed if a 1 Maxterm (or standard sum): n variables combined with OR A variable of a maxterm is unprimed if the corresponding bit is a 0 and primed if a 1 Any Boolean function can be expressed as a sum of minterms or a product of maxterms (either 0 or 1 for each term) is said to be in a canonical form Each maxterm is the complement of its corresponding minterm: m'i = Mi

X 0 0 0 0 1 1 1 1

Variables Y 0 0 1 1 0 0 1 1

Z 0 1 0 1 0 1 0 1

Minterms Term Designation x'y'z' m0 x'y'z m1 x'y z' m2 x'y z m3 x y'z' m4 x y'z m5 x y z' m6 xyz m7

Maxterms Term Designation x'+y'+z' M0 x'+y'+z M1 x'+y + z' M2 x'+y + z M3 x +y'+z' M4 x + y'+z M5 x + y + z' M6 x+y+z M7

Express the Boolean Function F = A + B'C is a sum of minterms. The function has 3 variables A,B,C. The first term A has 2 Missing variables B & C and is written as A = A(B + B') (C+C') (B + B') = 1 (C + C') = 1 A = (AB + AB') (C + C') = ABC + ABC' + AB'C + AB'C' The Second term B'C has one of the missing variable A B'C (A + A') = B'CA + B'CA' = AB'C + A'B'C (Rewriting) Combining all terms we get = ABC + ABC' + AB'C + AB'C' + AB'C + A'B'C

21

= ABC + ABC' + AB'C + AB'C' + A'B'C (since x + x' = 1) Rearranging the minterms in Ascending order A'B' C + AB'C' + AB'C + ABC' + ABC m1 + m4 + m5 + m6 + m7 F(A,B,C) = (1,4,5,6,7)

Product of MaxTerms
Express the Boolean function F = XY+X'Z is a product of maxterms Converting the function into OR terms F = (X+X') (X+Z) (Y+X') (Y+Z) = 1 (X+Z) (X'+Y) (Y +Z) Each one has missing variables F = (X+Z) (X'+Y) (Y +Z) (X+Z) -> (X+Z) + YY' -> (X + Z+Y) (X+Z+ Y') (X'+Y) -> (X'+Y) + ZZ' -> (X'+Y+Z) (X'+Y+Z') (Y+Z) -> (Y+Z) + XX' ->(Y+Z+X) (Y+Z+X') Combining all these terms (X+Y+Z) (X+Y'+Z) (X'+Y+Z) (X'+Y+Z') (X+Y+Z) (X'+Y+Z) (X+Y+Z) (X+Y'+Z) (X'+Y+Z) (X+Y+Z') (X+Y+Z) has appeared twice and written only once -> M0 M2 M4 M5 F(X,Y,Z) = (0,2,4,5) denotes ANDing of maxterms

22

The Karnaugh Map Method


The Karnaugh map provides a simple and straight-forward method of minimizing boolean expressions. With the Karnaugh map Boolean expressions having up to four and even six variables can be simplified. A Karnaugh map provides a pictorial method of grouping together expressions with common factors and therefore eliminating unwanted variables. The Karnaugh map can also be described as a special arrangement of a truth table.

Two Variable Map The diagram below illustrates the correspondence between the Karnaugh map and the truth table for the general case of a two variable problem.

Example:

23

Three Variable Map

Simplify the following Boolean functions: 1)

2)

24

C)

D)

25

E)

F)

26

Four Variable Map: 1.

27

2.Simplify the Boolean Function

Combinational Circuits A combinational logic circuit has: A set of m Boolean inputs, A set of n Boolean outputs, and n switching functions, each mapping the 2m input combinations to an output such that the current output depends only on the current input 28

values.

Figure : A Block Diagram Adders: Adders are the basic building blocks of all arithmetic circuits; adders add two binary numbers and give out sum and carry as output. A quarter adder is a circuit that can add two binary digits but will not produce a carry. This circuit will produce the following results: 0 plus 0 = 0 0 plus 1 = 1 1 plus 0 = 1 1 plus 1 = 0 (no carry)

Quarter Adder Basically we have two types of adders. 1)Half Adder. 2)Full Adder. Half Adder Adding two single-bit binary values X, Y produces a sum S bit and a carry out C-out bit. This operation is called half addition and the circuit to realize it is called a half adder.

29

Circuit Diagram of Half Adder X 0 0 1 1 Y 0 1 0 1 SUM 0 1 1 0 CARRY 0 0 0 1 Truth Table of Half Adder

Full Adder: Full adder takes a three-bits input. Adding two single-bit binary values X, Y with a carry input bit C-in produces a sum bit S and a carry out C-out bit.

Full Adder Circuit SUM

30

Full Adder Circuit CARRY X 0 0 0 0 1 1 1 1 Y 0 0 1 1 0 0 1 1 Z 0 1 0 1 0 1 0 1 SUM CARRY 0 0 1 0 1 0 0 1 1 0 0 1 0 1 1 1 Truth Table of FULL Adder

31

You might also like