digital logic and designhome.iitj.ac.in/~sptiwari/dld/lecture12_dld_midreview.pdf · 2019-02-04 ·...

31
2/4/2019 1 Digital Logic and Design (Course Code: EE222) Lecture 12: Mid1 Review for Initial Lectures Indian Institute of Technology Jodhpur, Year 20182019 Course Instructor: Shree Prakash Tiwari Email: [email protected] b h //h / / Webpage: http://home.iitj.ac.in/~sptiwari/ Course related documents will be uploaded on http://home.iitj.ac.in/~sptiwari/DLD/ 1 Note: The information provided in the slides are taken form text books Digital Electronics (including Mano & Ciletti), and various other resources from internet, for teaching/academic use only Understanding Decimal Numbers ° Decimal numbers are made of decimal digits: (0,1,2,3,4,5,6,7,8,9) ° But how many items does a decimal number represent? represent? 8653 = 8x10 3 + 6x10 2 + 5x10 1 + 3x10 0 ° What about fractions? 97654.35 = 9x10 4 + 7x10 3 + 6x10 2 + 5x10 1 + 4x10 0 + 3x10 -1 + 5x10 -2 In formal notation -> (97654.35) 10 ° Why do we use 10 digits, anyway?

Upload: others

Post on 14-Mar-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

1

Digital Logic and Design (Course Code: EE222)

Lecture 12: Mid‐1 Review for Initial Lectures

Indian Institute of Technology Jodhpur, Year 2018‐2019

Course Instructor: Shree PrakashTiwari

Email: [email protected]

b h //h / /Webpage: http://home.iitj.ac.in/~sptiwari/

Course related documents will be uploaded on  http://home.iitj.ac.in/~sptiwari/DLD/

1

Note: The information provided in the slides are taken form text books Digital Electronics (including Mano & Ciletti), and various other resources from internet, for teaching/academic use only

Understanding Decimal Numbers

° Decimal numbers are made of decimal digits: (0,1,2,3,4,5,6,7,8,9)

° But how many items does a decimal number represent?represent?• 8653 = 8x103 + 6x102 + 5x101 + 3x100

° What about fractions?• 97654.35 = 9x104 + 7x103 + 6x102 + 5x101 + 4x100 + 3x10-1 + 5x10-2

• In formal notation -> (97654.35)10

° Why do we use 10 digits, anyway?

Page 2: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

2

Understanding Octal Numbers

° Octal numbers are made of octal digits: (0,1,2,3,4,5,6,7)

° How many items does an octal number represent?(4536) 4 83 5 82 + 3 81 + 6 80 (1362)• (4536)8 = 4x83 + 5x82 + 3x81 + 6x80 = (1362)10

° What about fractions?• (465.27)8 = 4x82 + 6x81 + 5x80 + 2x8-1 + 7x8-2

° Octal numbers don’t use digits 8 or 9

° Who would use octal number, anyway?

Understanding Binary Numbers

° Binary numbers are made of binary digits (bits): • 0 and 1

° How many items does an binary number represent?• (1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10

° What about fractions?• (110.10)2 = 1x22 + 1x21 + 0x20 + 1x2-1 + 0x2-2

° Groups of eight bits are called a byte• (11001001) 2

° Groups of four bits are called a nibble° Groups of four bits are called a nibble.• (1101) 2

Page 3: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

3

Conversion Between Number Bases

Octal(base 8)

Decimal(base 10) Binary(base 2)

Hexadecimal

(base16)° Learn to convert between bases.

Convert an Integer from Decimal to Another Base

1. Divide decimal number by the base (e.g. 2)

2 The remainder is the lowest-order digit

For each digit position:

2. The remainder is the lowest order digit

3. Repeat first two steps until no divisor remains.

Example for (13)10:

IntegerQuotient

13/2 = 6 + ½ a0 = 1

Remainder Coefficient

0

6/2 = 3 + 0 a1 = 03/2 = 1 + ½ a2 = 11/2 = 0 + ½ a3 = 1

Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2

Page 4: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

4

Convert an Fraction from Decimal to Another Base

1. Multiply decimal number by the base (e.g. 2)

2 The integer is the highest-order digit

For each digit position:

2. The integer is the highest order digit

3. Repeat first two steps until fraction becomes zero.

Example for (0.625)10:

Integer

0.625 x 2 = 1 + 0.25 a-1 = 1

Fraction Coefficient

1

0.250 x 2 = 0 + 0.50 a-2 = 00.500 x 2 = 1 + 0 a-3 = 1

Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2

The Growth of Binary Numbersn 2n

0 20=1

1 21=2

n 2n

8 28=256

9 29=512

2 22=4

3 23=8

4 24=16

5 25=32

10 210=1024

11 211=2048

12 212=4096

20 220=1M5 2 32

6 26=64

7 27=128

20 2 1M

30 230=1G

40 240=1T

Mega

Giga

Tera

Page 5: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

5

Binary Addition

° Binary addition is very simple.

° This is best shown in an example of adding two binary numbers…binary numbers…

1 1 1 1 0 1+ 1 0 1 1 1---------------------

111111 carries

---------------------0011 1 00

Binary Subtraction

° We can also perform subtraction (with borrows in place of carries).

° Let’s subtract (10111)2 from (1001101)2…

1 100 10 10 0 0 10

1 0 0 1 1 0 11 0 1 1 1

borrows

- 1 0 1 1 1------------------------

1 1 0 1 1 0

Page 6: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

6

Binary Multiplication

° Binary multiplication is much the same as decimal multiplication, except that the multiplication operations are much simpler…

1 0 1 1 1X 1 0 1 0-----------------------

0 0 0 0 01 0 1 1 1

0 0 0 0 00 0 0 0 01 0 1 1 1-----------------------1 1 1 0 0 1 1 0

Convert an Integer from Decimal to Octal

1. Divide decimal number by the base (8)

2 The remainder is the lowest-order digit

For each digit position:

2. The remainder is the lowest order digit

3. Repeat first two steps until no divisor remains.

Example for (175)10:

IntegerQuotient

175/8 = 21 + 7/8 a0 = 7

Remainder Coefficient

0

21/8 = 2 + 5/8 a1 = 52/8 = 0 + 2/8 a2 = 2

Answer (175)10 = (a2 a1 a0)2 = (257)8

Page 7: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

7

Convert an Fraction from Decimal to Octal

1. Multiply decimal number by the base (e.g. 8)

2 The integer is the highest-order digit

For each digit position:

2. The integer is the highest order digit

3. Repeat first two steps until fraction becomes zero.

Example for (0.3125)10:

Integer

0.3125 x 8 = 2 + 5 a-1 = 2

Fraction Coefficient

1

0.5000 x 8 = 4 + 0 a-2 = 4

Answer (0.3125)10 = (0.24)8

Understanding Hexadecimal Numbers

° Hexadecimal numbers are made of 16 digits: • (0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F)

° How many items does an hex number represent?• (3A9F)16 = 3x163 + 10x162 + 9x161 + 15x160 = 1499910

° What about fractions?• (2D3.5)16 = 2x162 + 13x161 + 3x160 + 5x16-1 = 723.312510

° Note that each hexadecimal digit can be represented with four bits.• (1110) 2 = (E)16

° Groups of four bits are called a nibble.• (1110) 2

Page 8: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

8

Converting Between Base 16 and Base 2

3A9F16 = 0011 1010 1001 11112

3 A 9 F

° Conversion is easy!

Determine 4-bit value for each hex digit

° Note that there are 24 = 16 different values of four bits

° Easier to read and write in hexadecimal.

° Representations are equivalent!

Converting Between Base 16 and Base 8

3A9F16 = 0011 1010 1001 11112

3 A 9 F

1. Convert from Base 16 to Base 2

2 Regroup bits into groups of three starting from right

352378 = 011 101 010 011 1112

5 2 3 73

2. Regroup bits into groups of three starting from right

3. Ignore leading zeros

4. Each group of three bits forms an octal digit.

Page 9: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

9

How To Represent Signed Numbers

• Plus and minus sign used for decimal numbers: 25 (or +25), -16, etc.

• For computers, desirable to represent everything as bitseverything as bits..

• Three types of signed binary number representations: signed magnitude, 1’s complement, 2’s complement.

• In each case: left-most bit indicates sign: positive (0) or negative (1).

Consider signed magnitude:

000011002 = 1210

Sign bit Magnitude

100011002 = -1210

Sign bit Magnitude

One’s Complement Representation

• The one’s complement of a binary number involves inverting all bits.

• 1’s comp of 00110011 is 11001100

• 1’s comp of 10101010 is 01010101

• For an n bit number N the 1’s complement is (2n-1) – N.

• Called diminished radix complement by Manosince 1’s complement for base (radix 2).

• To find negative of 1’s complement number• To find negative of 1 s complement number take the 1’s complement.

000011002 = 1210

Sign bit Magnitude

111100112 = -1210

Sign bit Magnitude

Page 10: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

10

Two’s Complement Representation

• The two’s complement of a binary number involves inverting all bits and adding 1.

• 2’s comp of 00110011 is 11001101

• 2’s comp of 10101010 is 01010110

• For an n bit number N the 2’s complement is (2n-1) – N + 1.

• Called radix complement by Mano since 2’s complement for base (radix 2).

• To find negative of 2’s complement number• To find negative of 2 s complement number take the 2’s complement.

000011002 = 1210

Sign bit Magnitude

111101002 = -1210

Sign bit Magnitude

Two’s Complement Shortcuts

° Algorithm 1 – Simply complement each bit and then add 1 to the result.• Finding the 2’s complement of (01100101)2 and of its 2’s

complement…

N = 01100101 [N] = 10011011[ ]

10011010 01100100

+ 1 + 1

--------------- ---------------

10011011 01100101

° Algorithm 2 – Starting with the least significant bit, copy all of the bits up to and including the first 1 bit and then complementing the remaining bitsbit and then complementing the remaining bits.• N = 0 1 1 0 0 1 0 1

[N] = 1 0 0 1 1 0 1 1

Page 11: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

11

1’s Complement Addition

° Using 1’s complement numbers, adding numbers is easy.

° For example, suppose we wish to add +(1100)2and +(0001)2.

° Let’s compute (12)10 + (1)10.• (12)10 = +(1100)2 = 011002 in 1’s comp.

• (1)10 = +(0001)2 = 000012 in 1’s comp. 0 1 1 0 0 + 0 0 0 0 1--------------0 0 1 1 0 1

Step 1: Add binary numbersStep 2: Add carry to low-order bit

Add

0 0 1 1 0 10

--------------0 1 1 0 1

Add carry

Final Result

p y

1’s Complement Subtraction

° Using 1’s complement numbers, subtracting numbers is also easy.

° For example, suppose we wish to subtract+(0001)2 from +(1100)2. 0 1 1 0 0

° Let’s compute (12)10 - (1)10.• (12)10 = +(1100)2 = 011002 in 1’s comp.

• (-1)10 = -(0001)2 = 111102 in 1’s comp.

0 1 1 0 0 - 0 0 0 0 1--------------

0 1 1 0 0 + 1 1 1 1 0--------------

Step 1: Take 1’s complement of 2nd operandStep 2: Add binary numbers

1’s comp

Add

1 0 1 0 1 01

--------------0 1 0 1 1

Add carry

Final Result

p yStep 3: Add carry to low order bit

Page 12: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

12

2’s Complement Addition

° Using 2’s complement numbers, adding numbers is easy.

° For example, suppose we wish to add +(1100)2and +(0001)2.

° Let’s compute (12)10 + (1)10.• (12)10 = +(1100)2 = 011002 in 2’s comp.

• (1)10 = +(0001)2 = 000012 in 2’s comp. 0 1 1 0 0 + 0 0 0 0 1--------------0 0 1 1 0 1Final

Step 1: Add binary numbersStep 2: Ignore carry bit

Add

0 0 1 1 0 1Result

p g y

Ignore

2’s Complement Subtraction

° Using 2’s complement numbers, follow steps for subtraction

° For example, suppose we wish to subtract+(0001)2 from +(1100)2. 0 1 1 0 0

° Let’s compute (12)10 - (1)10.• (12)10 = +(1100)2 = 011002 in 2’s comp.

• (-1)10 = -(0001)2 = 111112 in 2’s comp.

0 1 1 0 0 - 0 0 0 0 1--------------

0 1 1 0 0 + 1 1 1 1 1--------------

Step 1: Take 2’s complement of 2nd operandStep 2: Add binary numbers

2’s comp

Add

1 0 1 0 1 1Final Result

p yStep 3: Ignore carry bit

IgnoreCarry

Page 13: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

13

2’s Complement Subtraction: Example #2

° Let’s compute (13)10 – (5)10.• (13)10 = +(1101)2 = (01101)2

• (-5)10 = -(0101)2 = (11011)210 2 2

° Adding these two 5-bit codes…

° Di di th bit th i bit i t b

0 1 1 0 1 + 1 1 0 1 1--------------1 0 1 0 0 0

carry

° Discarding the carry bit, the sign bit is seen to be zero, indicating a correct result. Indeed,

(01000)2 = +(1000)2 = +(8)10.

2’s Complement Subtraction: Example #3

° Let’s compute (5)10 – (12)10.• (-12)10 = -(1100)2 = (10100)2

• (5)10 = +(0101)2 = (00101)2

° Adding these two 5 bit codesAdding these two 5-bit codes…

° Here, there is no carry bit and the sign bit is 1. Thi i di t ti lt hi h i h t

0 0 1 0 1 + 1 0 1 0 0--------------

1 1 0 0 1

This indicates a negative result, which is what we expect. (11001)2 = -(7)10.

Page 14: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

14

Binary Coded Decimal

Digit BCD Code

Digit BCD Code

0 0000 5 01011 0001 6 01102 0010 7 0111

° Binary coded decimal (BCD) represents each decimal digit with four bits• Ex. 0011 0010 1001 = 32910

2 0010 7 01113 0011 8 10004 0100 9 1001

3 2 9

° This is NOT the same as 0011001010012

° Why do this? Because people think in decimal.

3 2 9

Putting It All Together

° BCD not very efficient

° Used in early ycomputers (40s, 50s)

° Used to encode numbers for seven-segment displays.

° Easier to read?

Page 15: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

15

Gray Code

° Gray code is not a number system.• It is an alternate way to represent

four bit data

Digit Binary Gray Code

0 0000 00001 0001 00012 0010 0011

° Only one bit changes from one decimal digit to the next

° Useful for reducing errors in communication.

° Can be scaled to larger numbers.

3 0011 00104 0100 01105 0101 01116 0110 01017 0111 01008 1000 11009 1001 110110 1010 1111

u be s10 1010 111111 1011 111012 1100 101013 1101 101114 1110 100115 1111 1000

ASCII Code

° American Standard Code for Information Interchange

° ASCII is a 7-bit code, frequently used with an 8th bit for error detection (more about that in a bit)for error detection (more about that in a bit).

Character ASCII (bin) ASCII (hex) Decimal Octal

A 1000001 41 65 101

B 1000010 42 66 102

C 1000011 43 67 103

Z

a

1

Page 16: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

16

Describing Circuit Functionality: Waveforms

A B Y

0 0 0

AND Gate

° Waveforms provide another approach for representing

0 1 0

1 0 0

1 1 1

Waveforms provide another approach for representing functionality.

° Values are either high (logic 1) or low (logic 0).

° Can you create a truth table from the waveforms?

Boolean Algebra

Basic Postulates

P1: x + 0 = x

P2: x + y = y + x

P1: x . 1 = x

P2: x y = y xP2: x + y = y + x

P3: x.(y+z) = x.y+x.z

P4: x + x = 1

P2: x . y = y . x

P3: x+y.z = (x+y).(x+z)

P4: x . x = 0

Basic TheoremsT1: x + x = x

T2: x + 1 = 1 T1: x . x = xT2: x + 1 1

T3: ( x ) = x

T4: x + (y+z) = (x+y)+z

T5 (x+y) = x . y (DeMorgan's theorem)

T6: x+ x.y = x

T2: x . 0 = 0

T4: x . (y.z) = (x.y).z

T5 (x.y) = x + y (DeMorgan's theorem)

T6: x.( x+y) = x

Page 17: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

17

Boolean Algebra: Proving Theorems

P1: x + 0 = x

P2: x + y = y + x

P3: x.(y+z) = x.y+x.z

P1: x . 1 = x

P2: x . y = y . x

P3: x+y.z = (x+y).(x+z)

P4: x + x = 1 P4: x . x = 0

Prove T1: x + x = x

x + x = (x+x). 1 (P1)

= (x+x). (x+x) (P4)

Prove T1: x . x = x

x . x = x.x+ 0 (P1)

= x.x + x.x (P4)( ) ( ) ( )

= x + x.x (P3)

= x + 0 (P4)

= x (P1)

( )

= x . (x+x ) (P3)

= x . 1 (P4)

= x (P1)

Boolean Algebra: Proving Theorems

P1: x + 0 = x

P2: x + y = y + x

P3: x.(y+z) = x.y+x.z

P4: x + x = 1

P1: x . 1 = x

P2: x . y = y . x

P3: x+y.z = (x+y).(x+z)

P4: x . x = 0

Prove : x + 1 = 1

x + 1 = x+(x+ x)

= (x+x)+ x

= x + x

P4: x x 1 P4: x . x 0

x + x .y = x

= x . 1 + x. y

= x. (1+ y)

= x . 1

=x

x + x .y = x+y

= (x + x ). (x+ y)

= 1. (x+ y)

= x + y

= 1

DeMorgan’s theorem1 2 3 1 2 3(x x x ....) x . x .x .

1 2 3 1 2 3(x . x . x .....) ( x + x x +.....)

Page 18: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

18

Boolean Algebra: Simplification of Functions

1 2 2 3(x .x x .x ) ? 1 2 3 1 2 3(x x x ....) x . x .x .

(x x x ) ( x + x x + )1 2 2 3( )1 2 3 1 2 3(x . x . x .....) ( x + x x +.....)

1 2 2 3(x x ) . (x + x )

1 2 1 3 2 3x . x x . x x . x

Boolean Functions

° Boolean algebra deals with binary variables and logic operations.

° Function results in binary 0 or 1Function results in binary 0 or 1

x00001

y00110

z01010

xy00000

x

y

z

G = xy +yz

xy

yz00010

G000101

111

0011

0101

0011

zyz

We will learn how to transition between equation, symbols, and truth table.

0001

0011

Page 19: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

19

Representation Conversion

° Need to transition between boolean expression, truth table, and circuit (symbols).

° Converting between truth table and expression is easy.easy

° Converting between expression and circuit is easy.

° More difficult to convert to truth table.

Circuit Boolean

TruthTable

CircuitExpression

Truth Table to Expression

° Converting a truth table to an expression• Each row with output of 1 becomes a product term

• Sum product terms together.

x00001

y00110

z01010

G00010

Any Boolean Expression can be represented in sum of products form!

1111

0011

0101

0011

xyz + xyz’ + x’yz

Page 20: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

20

Equivalent Representations of Circuits

° All three formats are equivalent

° Number of 1’s in truth table output column equals AND terms for Sum-of-Products (SOP)

x y z Gx0000111

y0011001

z0101010

G0001001

G

x x x

x xx

xx x

x y z

11

11

01

11

G = xyz + xyz’ + x’yz

Reduced Hardware Implementation

° Reduced equation requires less hardware!

° Same function implemented!

x0

y0

z0

G00

0001111

00110011

01010101

00010011

G

x x

x x

x y z

1 1 1 1

G = xyz + xyz’ + x’yz = xy + yz

Page 21: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

21

Minterms and Maxterms

° Each variable in a Boolean expression is a literal

° Boolean variables can appear in normal (x) or complement form (x’)

° Each AND combination of terms is a minterm

° Each OR combination of terms is a maxterm

For example:Minterms

x y z Minterm

For example:Maxterms

x y z Maxterm0 0 0 x’y’z’ m0

0 0 1 x’y’z m1

…1 0 0 xy’z’ m4

…1 1 1 xyz m7

x y z Maxterm0 0 0 x+y+z M0

0 0 1 x+y+z’ M1

…1 0 0 x’+y+z M4

…1 1 1 x’+y’+z’ M7

Conversion Between Canonical Forms

° Easy to convert between minterm and maxtermrepresentations

° For maxterm representation, select rows with 0’s

x00001

y00110

z01010

G00010

G = xyz + xyz’ + x’yz

G = m7 + m6 + m3 = Σ(3, 6, 7)

111

011

101

011

G = M0M1M2M4M5 = Π(0,1,2,4,5)

G = (x+y+z)(x+y+z’)(x+y’+z)(x’+y+z)(x’+y+z’)

Page 22: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

22

Representation of Circuits

° All logic expressions can be represented in 2-level format

° Circuits can be reduced to minimal 2-level representation

° Sum of products representation most common in industry.

NAND Gates into Other Gates

(what are these circuits?)A

Y

A

YAB

NOT Gate

AND Gate

( )

BY

OR Gate

Page 23: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

23

NOR Gates into Other Gates

(what are these circuits?)

NOT Gate

OR Gate

( )A

Y

YAB

A

AND Gate

BY

The XOR Gate (Exclusive-OR)

AY

° This is a XOR gate.

° XOR gates assert their output

when exactly one of the inputs

i t d h th

A B Y

0 0 0

0 1 1

BY

is asserted, hence the name.

° The switching algebra symbol

for this operation is , i.e.

1 1 = 0 and 1 0 = 1.

1 0 1

1 1 0

Page 24: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

24

The XNOR Gate

AY

° This is a XNOR gate.

° This functions as an

exclusive-NOR gate, or

simply the complement of

A B Y

0 0 1

0 1 0

BY

simply the complement of

the XOR gate.

° The switching algebra symbol

for this operation is , i.e.

1 1 = 1 and 1 0 = 0.

1 0 0

1 1 1

Example

° Determine the output expression for the below circuit and simplify it using DeMorgan’s Theorem

Page 25: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

25

Summary

° Basic logic functions can be made from NAND, and NOR functions

° The behavior of digital circuits can be represented with waveforms truth tables or symbolswith waveforms, truth tables, or symbols

° Primitive gates can be combined to form larger circuits

° Boolean algebra defines how binary variables with NAND, NOR can be combined

° DeMorgan’s rules are important. • Allow conversion to NAND/NOR representations

Definitions

Literal: each appearance of a variable, either uncomplemented or complementeduncomplemented or complemented

Implicant: a product term that implies F=1

Prime Implicant: an implicant that cannot be combined into another implicant that has fewer literals

Cannot be further minimized

Essential Prime Implicant: a prime implicantthat covers a minterm uniquely.

50

Page 26: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

26

Definitions

F A B

C 0 0 0 1 1 1 1 0

0

1

1 1 0 0

1 1 1 0

51

Which are the implicants, prime implicants, and essential prime implicants?

Definition: Implicants

F A B

C 0 0 0 1 1 1 1 0

0

1

1 1 0 0

1 1 1 0

52

Implicants: A'B'C', A'B'C, A'BC', A'BC, ABC (minterms)

Page 27: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

27

Definition: Implicants

F A B

C 0 0 0 1 1 1 1 0

0

1

1 1 0 0

1 1 1 0

53

Implicants: A'B'C', A'B'C, A'BC', A'BC, ABC (minterms)A'C', A'C, A'B', A'B, BC (pairs of minterms)

Definition: Implicants

F A B

C 0 0 0 1 1 1 1 0

0

1

1 1 0 0

1 1 1 0

54

Implicants: A'B'C', A'B'C, A'BC', A'BC, ABC (minterms)A'C', A'C, A'B', A'B, BC (pairs of minterms)A' (quartet of minterms)

Page 28: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

28

Definition: Prime Implicants

F A B

C 0 0 0 1 1 1 1 0

0

1

1 1 0 0

1 1 1 0

55

Prime Implicants: BC, A'

Definition: Essential Prime Implicants

F A B

C 0 0 0 1 1 1 1 0

0

1

1 1 0 0

1 1 1 0

56

Essential Prime Implicants: BC, A'

Page 29: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

29

Definitions

Minimal Cover (SOP): the sum (ORing) of prime implicantsprime implicants

Solution may not be unique

For SOP, must cover each “1” at least once

A minimal solution is one with the fewest product terms in the SOP expression, excluding input inversionsexcluding input inversions

57

Selecting a Minimal Cover (SOP) Identify all prime implicants

Select all essential prime implicants Select all essential prime implicants

Select prime implicant(s) to cover remaining terms by considering all possibilities

Sometimes selection is obvious

Sometimes “guess” next prime implicant

Continue, perhaps recursively

Try all possible “guesses”

Write minimum Boolean expression

May not be unique58

Page 30: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

30

Selecting a Minimal Cover

Example:

Determine the minimal cover for the following K-Map:

a b c d

0

00 01 11 10

1 1 000

F

1. Identify Prime Implicants2. Identify Essential Prime Implicants

59

1 1 1 0

1 0 1 1

0 0 1 1

01

11

10

2. Identify Essential Prime Implicants3. Determine Minimal Cover

Example #1

a b c d

00 01 11 10

F

Prime Implicants: a'b'd bc' ac a'c'd ab b'cd

0 1 1 0

1 1 1 0

1 0 1 1

0 0 1 1

00

01

11

10

Prime Implicants: a b d, bc , ac, a c d, ab, b cd

Essential Prime Implicants: bc', ac

Minimal Cover (SOP): F = a'b'd + bc' + ac

60

Page 31: Digital Logic and Designhome.iitj.ac.in/~sptiwari/DLD/Lecture12_DLD_MidReview.pdf · 2019-02-04 · 2/4/2019 3 Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base

2/4/2019

31

Selecting a Minimal Cover

Example:

Determine the minimal cover for the following K-Map:

1. Identify Prime Implicants2. Identify Essential Prime Implicants

y z w x

0

00 01 11 10

0 0 0 00

F

61

2. Identify Essential Prime Implicants3. Determine Minimal Cover

1 1 1 0

1 0 1 1

0 0 0 0

01

11

10

Example #2

y z w x

00 01 11 10

F

Prime Implicants: xy'z' w'xy' w'xz xyz wxy wxz'

0 0 0 0

1 1 1 0

1 0 1 1

0 0 0 0

00

01

11

10

Prime Implicants: xy z , w xy , w xz, xyz, wxy, wxz

Essential Prime Implicants: none

Minimal Cover: F = xy'z' + w'xz + wxy

F = w'xy' + xyz + wxz'62