digital circuit and logic design - ecpe.nu.ac.th method ... quiz 15% midterm exam 25% ... logic...

22
1 Digital Circuit And Logic Design Lecture 1 Panupong Sornkhom, 2006/1 2 Outline Introduction 1. Course characteristics 2. Digital system versus Analog system 3. Digital devices 4. Integrated Circuit (IC) Number Systems 1. Number system and conversion 2. Addition and subtraction 3. Representation of negative numbers

Upload: vuongtruc

Post on 29-Mar-2018

221 views

Category:

Documents


1 download

TRANSCRIPT

1

Digital Circuit And Logic Design

Lecture 1

Panupong Sornkhom, 2006/1 2

Outline

Introduction1. Course characteristics2. Digital system versus Analog system3. Digital devices4. Integrated Circuit (IC)Number Systems1. Number system and conversion2. Addition and subtraction3. Representation of negative numbers

2

Introduction

Panupong Sornkhom, 2006/1 4

1. Course characteristic

InstructorCourse descriptionCourse objectivesRecommended text booksCourse scheduleEvaluationAgreements

3

Panupong Sornkhom, 2006/1 5

Instructor

Panupong SornkhomDepartment of Electrical and Computer EngineeringFaculty of EngineeringNaresuan University

Office room EE213Office hours Tuesday 13.00 – 16.00Telephone 01-2830195, 09-1650922Website http://www.ecpe.nu.ac.th/panupongsEmail [email protected]

Panupong Sornkhom, 2006/1 6

Course description

ทฤษฎีเบื้องตนของวงจรสวิทชิ่ง คณิตศาสตรแบบบูลลีน รหัสคอมพิวเตอร การตรวจสอบความผิดพลาด ตารางความจริงวิธีการลดรูปสมการบูลลีนและวงจรตรรกชนิดตาง ๆ มัลติเพลกเซอร ดีมัลติเพลกเซอร วงจรเขารหัสและถอดรหัส วงจรบวกลบ วงจรเชิงลําดับ ฟลิปฟลอบ วงจรนับ รีจิสเตอร ระบบดิจิตอลแบบตาง ๆ แนะนําไมโครโปรเซสเซอร เบื้องตน

4

Panupong Sornkhom, 2006/1 7

Course objectives

Understand process of digital system designUnderstand Boolean algebra and minimization methodCan design and implement digital system using combinational circuit and sequential circuit

Panupong Sornkhom, 2006/1 8

Recommended text books

1. John Wakerly, Digital Design Principles and Practices, Third edition, Prentice Hall.

2. Sajjan Shjiva, Introduction to Logic Design, Second edition, Macel Dekker.

3. Kenneth Breeding, Digital Design Fundamentals, Second edition, Prentice Hall.

4. Randy Katz, Contemporary logic design, Addison Wesley.

5

Panupong Sornkhom, 2006/1 9

Evaluation

Score weightingQuiz 15%Midterm exam 25%Final exam 30%Homework 15%Laboratory 15%

Grading policies< 40% F>= 40% grading by statistical distribution

Panupong Sornkhom, 2006/1 10

Agreements

การสงงานตองสงกับผูสอนโดยตรงในชัน้เรียน หรือ ท่ีหองทํางานของผูสอนเทานั้น

สงงานชา 5 นาที ตัดคะแนน 10% ของคะแนนเต็มของงานนั้นสงงานชาเกินกวา 5 นาที แตไมเกนิ 1 วัน ตัดคะแนน 20% ของคะแนนเตม็ของงานนั้นสงงานชาเกินกวา 1 วัน แตไมเกนิ 1 สัปดาห ตัดคะแนน 50% ของคะแนนเต็มของงานนั้น

6

Panupong Sornkhom, 2006/1 11

Agreements (cont.)

งานทุกชิ้น จะตองทําดวยตนเองเทานั้น หากเปนงานที่ตองมีการคนควาและเรยีบเรยีงขอมูลตองระบุเอกสารอางอิงทุกครั้ง

ถาพบวามกีารลอกกันครั้งแรก จะปรับคะแนนของงานนั้นทั้งหมดเปนศูนย และผูสอนจะแจงใหทราบถาพบวามกีารลอกกันครั้งที่สอง จะปรับตกในรายวชิานี้ทันที และ ผูสอนจะแจงใหทราบ

Panupong Sornkhom, 2006/1 12

Agreements (cont.)

ในการสอบ ทั้งสอบยอย สอบกลางภาค และ สอบปลายภาค จะตองไมมีการทุจริตสอบ ซ่ึงพฤติกรรมตอไปนี้จะถือวาทุจริตสอบ

ชําเลืองมองคําตอบผูอ่ืนหรือปรึกษากันมีบันทึกเนื้อหาของรายวิชาไมวาจะในรูปแบบใด ๆ อยูกับตัวในขณะสอบ โดยไมไดรับอนุญาตใชเครื่องมือสื่อสารขณะสอบลุกออกจากที่นั่งขณะทําการสอบ ละเมิดกฏ/ขอปฏิบัติในการสอบ ตามประกาศของมหาวิทยาลัย

หากพบการทุจรติในระหวางการสอบ ปรับตกในรายวิชานี้ทันที และสงเรื่องใหทางคณะพิจารณาโทษหากตรวจพบการทุจริตในระหวางการตรวจขอสอบ ผูสอนจะทําการสอบสวนและหากพบวามีการทุจรติจริง ปรับตกในรายวิชานี้ทันที และสงเรื่องใหทางคณะพิจารณาโทษ

7

Panupong Sornkhom, 2006/1 13

Agreements (cont.)

เมื่อมีการประกาศคะแนนหรือเกรด หากพบวามีขอผิดพลาดในการใหคะแนนหรือเกรด สามารถมาตรวจสอบไดกับผูสอนภายใน 3 วันหลังจากประกาศ หลังจากนีจ้ะถือวาคะแนนหรือเกรดนั้นเปนที่ยอมรับและจะไมมีการแกไขใด ๆ อีก

Panupong Sornkhom, 2006/1 14

2. Digital system versus Analog system

DefinitionAnalog system process continuous range signalDigital system process discrete value signal

time

value

8

Panupong Sornkhom, 2006/1 15

2. Digital system versus Analog system (cont.)

ApplicationsStill picture recordingAudio/Video recordingTelephone system

Panupong Sornkhom, 2006/1 16

2. Digital system versus Analog system (cont.)

Why every products becoming digitalFlexibilityReliabilitySpeedCost

9

Panupong Sornkhom, 2006/1 17

3. Digital devices

Logic gatesAND gateOR gateNOT gateNAND gateNOR gateXOR gate

Panupong Sornkhom, 2006/1 18

3. Digital devices (cont.)

Flip-flopsD flip-flopJK flip-flopRS flip-flop

Q

QSET

CLR

D J

Q

Q

K

SET

CLR Q

QSET

CLR

S

R

D flip-flop JK flip-flop RS flip-flop

10

Panupong Sornkhom, 2006/1 19

4. Integrated Circuit

Integrated Circuit (IC) A collection of one or more gates fabricated on a single silicon chip

* Picture from http://www.tiscali.co.uk/reference/encyclopaedia/hutchinson/m0030289.html

Panupong Sornkhom, 2006/1 20

4. Integrated Circuit (cont.)

Scales of ICSmall-scale integration (SSI)

1-20 gatesBasic building block (gates, flip-flop)

Medium-scale integration (MSI)

20 – 200 gatesFunctional building block (decoder, register , counter)

Large-scale integration (LSI)

200 – 200,000 gates or moreSmall memories, microprocessors, programmable logic devices (PLD), custom devices

Very large-scale integration (VLSI)

More than 1,000,000 transistors

11

Number system and Codes (1)

Panupong Sornkhom, 2006/1 22

1. Number system and conversion

Positional number systemEach digit position has weightValue = weighted sum of all digitsFor example, 2457 = 2x1000+4x100+5x10+7x1623.57 = 6x100+2x10+3x1+5x0.1+7x0.01In general, a number D of the form d1d0.d-1d-2 has the value D = d1x101+d0x100+d-1x10-1+d-2x10-2

In this case, 10 is called base or radix of the number system

12

Panupong Sornkhom, 2006/1 23

1. Number system and conversion (cont.)

Positional number system (cont.)In general positional number system, the radix is an integer r ≥ 2, and the digit in position i has weight ri

The general form is dp-1dp-2…d1d0.d-1d-2 …d-nwhere there are p digits to the left of the point and n digits to the right of the point, called radix pointThe value of the number is the sum of each digit multiplied by the corresponding power of the radix

Panupong Sornkhom, 2006/1 24

1. Number system and conversion (cont.)

Positional number system (cont.)The leftmost digit in such a number is called the high-order or most significant digit; the rightmost is the low-order or least significant digit.Digital circuits have signals that are normally in one of only two conditions – low or high, off or on.The signals in these circuits are interpreted to represent binary digits (or bits) that have one of two values. Thus, the binary radix is normally used to represent numbers in a digital system

13

Panupong Sornkhom, 2006/1 25

1. Number system and conversion (cont.)

Positional number system (cont.)The leftmost bit of a binary number is called the high-order or most significant bit (MSB); the rightmost is the low-order or least significant bit (LSB).Radix 10 use it in everyday businessRadix 2 use it in digital systemOther radices may be used in other purposes for example radices 8 and 16 used for shorthand representation of multibit numbers

Panupong Sornkhom, 2006/1 26

1. Number system and conversion (cont.)

Positional number system (cont.)

F17111115771117

E16111014661106

D15110113551015

C14110012441004

B1310111133113

A1210101022102

911100191111

810100080000

HexadecimalOctalBinaryDecimalHexadecimalOctalBinaryDecimal

14

Panupong Sornkhom, 2006/1 27

1. Number system and conversion (cont.)

ConversionsConvert from radix r to decimal value

Convert from decimal value (integer) to radix rDivide the value D by r the remainder is least significant digit in radix r number and the quotient will be divided by r againWe collect all remainder as digit in radix r numberThe last remainder is most significant digit

1pi

ii n

D d r−

=−

= ⋅∑

Panupong Sornkhom, 2006/1 28

1. Number system and conversion (cont.)

Conversions (cont.)Convert from decimal fraction to radix r

Multiply D by r then collect the integer part of result as a digit of answer and repeatedly multiply fraction part of result by ra terminating fraction in one base may not terminate in another

15

Panupong Sornkhom, 2006/1 29

1. Number system and conversion (cont.)

Conversions (cont.)Example

Convert 17910 to binary number179/2 = 89 remainder 1 (LSB)89/2 = 44 remainder 144/2 = 22 remainder 022/2 = 11 remainder 011/2 = 5 remainder 15/2 = 2 remainder 12/2 = 1 remainder 01/2 = 0 remainder 1 (MSB)

Thus 17910 = 101100112

Panupong Sornkhom, 2006/1 30

1. Number system and conversion (cont.)

Conversions (cont.)Example

Convert 46710 to octal number

467/8 = 58 remainder 3 (Least significant digit)58/8 = 7 remainder 2

7/8 = 0 remainder 7 (Most significant digit)Thus 46710 = 7238

Convert 0.13210 to octal number

0.132 x 8 = 1.0560.056 x 8 = 0.4480.448 x 8 = 3.5840.584 x 8 = 4.6720.672 x 8 = 5.3760.376 x 8 = 3.0080.008 x 8 = 0.0640.064 x 8 = 0.5120.512 x 8 = 4.096

….Thus 0.13210 = 0.103453004…8

16

Panupong Sornkhom, 2006/1 31

2. Addition and Subtraction

ConceptAddition and subtraction of nondecimal numbers by hand uses the same technique that we use in decimal numbers

Addition uses carry in and carry out

1111110110

1001101010

1010101100

0100100000

Carry out

SumYXCarry in

Carry out

SumYXCarry in

Addition table including carries

Panupong Sornkhom, 2006/1 32

2. Addition and Subtraction

Concept (cont.)4 bit adder

17

Panupong Sornkhom, 2006/1 33

2. Addition and Subtraction (cont.)

Concept (cont.)Subtraction uses borrow in and borrow out

1111100110

0001101010

1010111100

1100100000

Borrow out

DiffYXBorrow in

Borrow out

DiffYXBorrow in

Subtraction table including borrows

Panupong Sornkhom, 2006/1 34

2. Addition and Subtraction

Concept (cont.)4 bit subtracter

18

Panupong Sornkhom, 2006/1 35

2. Addition and Subtraction (cont.)

Example

Panupong Sornkhom, 2006/1 36

3. Representation of negative numbers

Signed-Magnitude representationUsing extra bit position (MSB) to represent the sign

0 = plus (+)1 = minus (-)

The rest bits represent magnitude of the numbern-bit signed-magnitude system represent number from –(2n-1-1) to +(2n-1-1) and there are two possible representations of zero.

19

Panupong Sornkhom, 2006/1 37

3. Representation of negative numbers (cont.)

Signed-Magnitude representation (cont.)The sign and magnitude portions are handled separately in arithmetic using signed-magnitude number.Signed-magnitude addition

If the signs are the same, add the magnitude and give the result the same signElse compare the magnitude, subtract the smaller from the larger and give the result the sign of the larger

Signed-magnitude subtractionChange the sign of the subtrahend and pass it to adder

Panupong Sornkhom, 2006/1 38

3. Representation of negative numbers (cont.)

Complement number systemsRadix-complement representation

The radix-complement of n-digit number N in radix r-N = rn – NDecimal number Ten’s complementBinary number Two’s complement

Diminished radix-complement representationThe diminished radix-complement of n-digit number N in radix r

-N = rn - N – 1Decimal number Nine’s complementBinary number One’s complement

20

Panupong Sornkhom, 2006/1 39

3. Representation of negative numbers (cont.)

Complement number systems (cont.)Two’s complement

Complement of n-bit number N in two’s complement is computed by using the method below

Complement each bit (change 0 to 1 and 1 to 0)Then add 1 to the LSB

The MSB of a number represents sign bit0 = plus1 = minus

n-bit two’s-complement system represent number from –(2n-1) to +(2n-1-1) and there are only one representation of zero (positive zero)

Panupong Sornkhom, 2006/1 40

3. Representation of negative numbers (cont.)

Complement number systems (cont.)Two’s complement (cont.)

Two’s complement additionUses ordinary binary addition, ignoring any carries beyond the MSB. The result will always be the correct sum as long as the range of the number system is not exceeded.If an addition operation produces a result that exceeds the range of the number system, overflow is said to occurAddition of two numbers with different signs can never produce overflowA simple rule for detecting overflow in addition is checking that if the signs of the addends are the same and the sign of the sum isdifferent from the addends’ sign.

21

Panupong Sornkhom, 2006/1 41

3. Representation of negative numbers (cont.)

Complement number systems (cont.)Two’s complement (cont.)

Two’s complement subtractionNegate the subtrahend by taking its two’s complementThen add it to the minuend using the normal rules for additionHowever, an attempt to negate the extra negative number results in overflow, for example, 10002 = -8 but its two’s complement is not equal to +8 because overflow occurs when represent +8 in 4-bit two’s complement number.The extra negative number can still be used in additions and subtractions as long as the final result does not exceed the number range

Panupong Sornkhom, 2006/1 42

3. Representation of negative numbers (cont.)

Complement number systems (cont.)One’s complement

Complement of n-bit number N in one’s complement is computed by using the method below

Complement each bit (change 0 to 1 and 1 to 0)The MSB of a number represents sign bit

0 = plus1 = minus

n-bit one’s-complement system represent number from –(2n-1-1) to +(2n-1-1) and there are two representation of zero

22

Panupong Sornkhom, 2006/1 43

3. Representation of negative numbers (cont.)

Complement number systems (cont.)One’s complement (cont.)

One’s complement additionUse ordinary binary addition then add the result with carry out of MSB, this rule is called end-around carryThe overflow detection can perform as in two’s complement system

One’s complement subtractionNegate the subtrahend by taking its one’s complementThen add it to the minuend using the normal rules for addition

Panupong Sornkhom, 2006/1 44

3. Representation of negative numbers (cont.)

Decimal and 4-bit numbers

- / -1000/ -- / --8/+8

1000/01111001/01111111/0111-7/+7

1001/01101010/01101110/0110-6/+6

1010/01011011/01011101/0101-5/+5

1011/01001100/01001100/0100-4/+4

1100/00111101/00111011/0011-3/+3

1101/00101110/00101010/0010-2/+2

1110/00011111/00011001/0001-1/+1

1111/0000- / 00001000/0000-0/+0

One’s complement

Two’s complement

Signed magnitudeDecimal