30
Digital Logic and Design (ELE-241) L t 1 Dr M G Abbas Malik Lecture 1 Dr . M. G. Abbas Malik [email protected] Picture Source: http://www.vanoast.com/old-portfolio/digital-design-logo-one%5Ba%5D.jpg

Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Embed Size (px)

Citation preview

Page 1: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Digital Logic and Design (ELE-241)L t 1

Dr M G Abbas Malik

Lecture 1

Dr. M. G. Abbas [email protected]

Picture Source: http://www.vanoast.com/old-portfolio/digital-design-logo-one%5Ba%5D.jpg

Page 2: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

I t d tiIntroductionDr Muhammad Ghulam Abbas MalikDr. Muhammad Ghulam Abbas Malik

PhD in Computer Science from University of Grenoble (Ex University Joseph Fourier) FranceGrenoble (Ex. University Joseph Fourier), FranceAreas of specialization:

Artificial IntelligencegAlgorithmic AnalysisMachine TranslationFi it t t M hiFinite-state MachinesMachine Learning

Contact: abbas malik@ciitlahore edu pkContact: [email protected] Introduction

Dr. M. G. Abbas Malik – COMSATS Lahore2

Page 3: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

C I t d tiCourse IntroductionCourse: Digital Logic and DesignCourse: Digital Logic and Design

Contact Hours (16 weeks)3 hours of Lectures per weekp3 hours of Lab per weekStudent Office Hours: Friday 11:30 to 13:30

%Midterms Total weight 25%Sessional 1 – Weight 10%Sessional 2 – Weight 15%Sessional 2 – Weight 15%

Final Exam Total weight 50%Assignment & Quiz Total weight 25%Assignment & Quiz Total weight 25%80% attendance in lectures and labs is mandatory to sit in the final exams

Dr. M. G. Abbas Malik – COMSATS Lahore3

Page 4: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

C I t d tiCourse IntroductionCourse: Digital Logic and DesignCourse: Digital Logic and Design

Text bookDigital Design 2nd Ed., by Morris Mano, Prentice-Hall.(PDF i il bl )(PDF is available)Reference books

Digital Logic and Computer Design by Morris Mano, Pearson g g p g y ,(available in Pakistan, Rs. 360 Allied Books)Digital Principles and Logic Design by A. Saha & N. Manna, Infinity Science Press LLC. (PDF is available), y ( )Digital Design and Computer Organization by Hassan A. Farhat, CRC Press Washington. (PDF is available)

Course websiteCourse websitewww.sanlp.org/dld

Dr. M. G. Abbas Malik – COMSATS Lahore4

Page 5: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Di it l A l D tDigital vs. Analog Data

Digital or Discontinuous Analog or ContinuousA set of data is digital if A set of date is analog if git contains a finite set of elementsModel discontinuous

git contains an infinite set of elementsModel continuousModel discontinuous

data/informationDigital watchDigital song CD

Model continuous data/information

Analog watchAnalog song tapeDigital song CD

Information does not degrade over time

Analog song tapeInformation may degrade over time

Information can be compressed

Information cannot be compressed

Dr. M. G. Abbas Malik – COMSATS Lahore5

Page 6: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Di it l A l D tDigital vs. Analog Data

Dr. M. G. Abbas Malik – COMSATS Lahore6

Page 7: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Di it l S tDigital SystemA digital system is data processing technologyA digital system is data processing technology that uses discrete values or elements.

Discrete: having a clear independent shape or formDiscrete elements can represent either discontinuous signals such as numbers, or

g p p

words, or continuous signals such as sounds, images or other measurements of continuous systemssystems.Discrete elements may be decimal digits, letters of an alphabet arithmetic operations or any otherof an alphabet, arithmetic operations or any other set of meaningful symbols.

Dr. M. G. Abbas Malik – COMSATS Lahore7

Page 8: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Di it l S tDigital SystemA sequence of discrete elements forms aA sequence of discrete elements forms a language, that is, a discipline that conveys informationinformation.Juxtaposition of discrete elements represents a quantity of informationquantity of informationExamples:

Letters t, o, p can form words “top” or “pot” –Letters t, o, p can form words top or pot English LanguageDigits 2, 3, 9 can form words “239” or “923” or “329” g– Numbers (language of digits)

Dr. M. G. Abbas Malik – COMSATS Lahore8

Page 9: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Di it l S tDigital SystemDiscrete elements are represented in a digitalDiscrete elements are represented in a digital system by physical quantities called signals: Electrical signals such as voltages and currentsElectrical signals such as voltages and currents are the most common.The signals in the present day electronic digitalThe signals in the present day electronic digital systems have only two discrete values and are said to be Binary.yDigital system designer is restricted to use binary signals because of low reliability of many-valued g y yelectronic circuits.

Dr. M. G. Abbas Malik – COMSATS Lahore9

Page 10: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Di it l S t C tDigital System – ComputersMade possible many scientificMade possible many scientific, industrial and commercial advances

S d tiSpace programs need continuous monitoringBusiness enterprises function efficiently with the aid of automatic ydata processingScientific calculationsScientific calculationsAir traffic control

10 Dr. M. G. Abbas Malik – COMSATS Lahore

Page 11: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Di it l S t C tDigital System – ComputersGeneralityGenerality

They can follow a sequence of yinstructions, called Program, that operates on Dataoperates on DataUser can specify and change programs and/or data according to theprograms and/or data according to the specific need.

11 Dr. M. G. Abbas Malik – COMSATS Lahore

Page 12: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Di it l S tDigital SystemDi it l tDigital systems are constrained first to takeconstrained first to take Discrete Values &Discrete Values &

then to takeBinary Values (Binary Numbers – {0,1})

Dr. M. G. Abbas Malik – COMSATS Lahore12

Page 13: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

N b S tNumber SystemVarious Number systemsVarious Number systems

PositionalDecimal (the most commonly used base 10)Decimal (the most commonly used – base 10)Binary (base 2)Hexa decimal (base 16)Hexa-decimal (base 16)Octal (base 8)Mayan (base 20)Mayan (base 20)

Non-positionalChinese

AbacusChineseRoman

Dr. M. G. Abbas Malik – COMSATS Lahore13 Pictures source: Wikipedia

Page 14: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

N b S tNumber SystemPositional Number systemsPositional Number systems

Decimalthe most commonly used base 10

Horizontal Positioning

the most commonly used – base 10275.42 = 2 × 102 + 7 × 101 + 5 × 100 + 4 × 10-1 + 2 × 10-2

100th 10th it 1/10th 1/100th100th 10th unit 1/10th 1/100th

Most significant digit Least significant digit

MayanBase 20

400=202

Base 20 Vertical Positioning20=201

1=200

Dr. M. G. Abbas Malik – COMSATS Lahore14

1 20429 5125

Page 15: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Bi N bBinary NumbersIt is used in implementation of digital electronicIt is used in implementation of digital electronic circuits.It is used to design all modern computersIt is used to design all modern computers.Indian Scholar Pingala first describe binary numbers to describe prosody in 2 B C [Wikipedia]numbers to describe prosody in 2 B.C. [Wikipedia]Positional number system with base 2S t f Di it {0 1}Set of Digits = {0,1}

Example: Horizontal Positioning

(110100)2⇔ 1 × 25 + 1 × 24 + 0 × 23 + 1 × 22 + 0 × 21 + 0 × 20

Dr. M. G. Abbas Malik – COMSATS Lahore15

Page 16: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Bi N bBinary NumbersDecimal to Binary ConversionDecimal to Binary Conversion

Exercise: Covert 455 and 24 into Binary numbers.Binary to Decimal ConversionBinary to Decimal Conversion

Exercise: Convert (1101)2 and (10010)2 into Decimal numbersDecimal numbers.

Binary AdditionExercise: Add (1111) and (11101)Exercise: Add (1111)2 and (11101)2.

Binary SubtractionExercise: Subtract (101) from (1010)Exercise: Subtract (101)2 from (1010)2.

Dr. M. G. Abbas Malik – COMSATS Lahore16

Page 17: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Bi N bBinary NumbersBinary MultiplicationBinary Multiplication

Exercise: Multiply (1101)2 and (10010)2.Binary DivisionBinary Division

Example: 1001 ÷ 11 1101 ÷ 100Exercise: Divide 11101 by 100 and 1100 by 10Exercise: Divide 11101 by 100 and 1100 by 10.

Dr. M. G. Abbas Malik – COMSATS Lahore17

Page 18: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

O t l N bOctal NumbersThe Yuki language in California and the PameanThe Yuki language in California and the Pameanlanguages in Mexico have octal number systemsbecause people count using the space betweenbecause people count using the space between their fingers instead of fingers themselves. [Wikipedia]Positional number system with base 8Positional number system with base 8Set of digits = {0, 1, 2, 3, 4, 5, 6, 7} – total 8 digits

Example:(564)

Horizontal Positioning

(564)8⇔ 5 × 82 + 6 × 81 + 4 × 80

Dr. M. G. Abbas Malik – COMSATS Lahore18

Page 19: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

O t l N bOctal NumbersDecimal to Octal ConversionDecimal to Octal Conversion

Exercise: Covert 455 and 24 into Octal numbers.Octal to Decimal ConversionOctal to Decimal Conversion

Exercise: Convert (4367)8 and (25)8 into Decimal numbersnumbers.

Binary to Octal ConversionMethod1: Convert the input binary number intoMethod1: Convert the input binary number into decimal number and then convert the decimal number into the output octal numberpExercise: Convert (1111)2 and (11101)2 into octal numbers.

Dr. M. G. Abbas Malik – COMSATS Lahore19

Page 20: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

O t l N bOctal NumbersBinary to Octal ConversionBinary to Octal Conversion

Method2:1 Group binary digits in groups of 3-digits from right to left1. Group binary digits in groups of 3 digits from right to left.

For example (10111010)2 ⇒ (10 111 010)2

2. Now convert each 3-digit group into decimal number. For l 010 2example 010 → 2

111 → 7010 → 2

3. Finally right these decimal number together and put base 8. For example (272)8

E i C t (1111) d (11101) i t t lExercise: Convert (1111)2 and (11101)2 into octal numbers.

Dr. M. G. Abbas Malik – COMSATS Lahore20

Page 21: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

O t l N bOctal NumbersOctal to Binary ConversionOctal to Binary Conversion

Method1: First convert the input Octal number into Decimal number and then convert the decimalDecimal number and then convert the decimal number into Binary numberExercise: Convert (467)8 and (23)8 into binary ( )8 ( )8 ynumbers.

Dr. M. G. Abbas Malik – COMSATS Lahore21

Page 22: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

O t l N bOctal NumbersOctal to Binary ConversionOctal to Binary Conversion

Method2:1. Convert each digit of the input octal number into Binary

considering it as a decimal number. For example, take the g p ,number (472)8 and now convert 4, 7 and 2 into binary representation like

4 → 1007 1117 → 1112 → 10

2. Create groups of 3-digits4 100 1004 → 100 → 1007 → 111 → 1112 → 10 → 010

3 Fi ll t t th 3 di it t t bi3. Finally concatenate these 3-digit groups to generate binary number. (4 7 2)8 = (100 111 010)2

Exercise: Convert (342)8 and (673)8 into binary numbers.

Dr. M. G. Abbas Malik – COMSATS Lahore22

Page 23: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

O t l N bOctal NumbersDecimal Octal Binary

0 0 000Why 3-digit 1 1 0012 2 010

y ggroups while conversion from

3 3 0114 4 100

conversion from Binary to octal 4 4 100

5 5 1016 6 110

yand vice versa?

6 6 1107 7 111

Dr. M. G. Abbas Malik – COMSATS Lahore23

Page 24: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

H d i l N bHexadecimal NumbersThese numbers are used as a human friendlyThese numbers are used as a human friendly representation of binary coded values in computing and digital electronicscomputing and digital electronicsCommonly used to represent memory addresses (RAM and Hard disk)(RAM and Hard disk)Positional number system with base 16Set of digits = {0 1 2 3 4 5 6 7 8 9 A B CSet of digits = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} – 15 digits and symbolsE l Horizontal PositioningExample:

(56A)16⇔ 5 × 162 + 6 × 161 + A × 160

Horizontal Positioning

Dr. M. G. Abbas Malik – COMSATS Lahore24

⇔ 5 × 16 + 6 × 16 + A × 16

Page 25: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

H d i l N bHexadecimal NumbersDecimal to Hexadecimal ConversionDecimal to Hexadecimal Conversion

Exercise: Covert 455 and 24 into Hexadecimal numbers.

Hexadecimal to Decimal ConversionExercise: Convert (B3A7)16 and (EF)16 into Decimal

bnumbers.Binary to Hexadecimal Conversion

Method1 Con ert the inp t binar n mber intoMethod1: Convert the input binary number into decimal number and then convert decimal number into Hexadecimal numberExercise: Convert (1111)2 and (11101)2 into Hexadecimal numbers.

Dr. M. G. Abbas Malik – COMSATS Lahore25

Page 26: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

H d i l N bHexadecimal NumbersBinary to Hexadecimal ConversionBinary to Hexadecimal Conversion

Method2:1 Group binary digits in groups of 4-digits from right to left1. Group binary digits in groups of 4 digits from right to left.

For example (10111010)2 ⇒ (1011 1010)2

2. Now convert each 4-digit group into decimal number. For l 1010 10 Aexample 1010 → 10=A

1011 → 11=B3. Finally right these decimal number together and put base y g g p

16. For example (BA)16

Exercise: Convert (1111001)2 and (11010101)2 into H d i l bHexadecimal numbers.

Dr. M. G. Abbas Malik – COMSATS Lahore26

Page 27: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

H d i l N bHexadecimal NumbersHexadecimal to Binary ConversionHexadecimal to Binary Conversion

Method1: First convert the input Hexadecimal number into Decimal number and then convert thenumber into Decimal number and then convert the decimal number into Binary numberExercise: Convert (4B7)16 and (2D)16 into binary ( )16 ( )16 ynumbers.

Dr. M. G. Abbas Malik – COMSATS Lahore27

Page 28: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

H d i l N bHexadecimal NumbersHexadecimal to Binary ConversionHexadecimal to Binary Conversion

Method2:1. Convert each digit of the input hexadecimal number into Binary

considering it as a decimal number. For example, take the numberconsidering it as a decimal number. For example, take the number (4D2)16 and now convert 4, D and 2 into binary representation like

4 → 100D or 13 → 11012 → 10

2. Create groups of 4-digits4 → 100 → 0100D → 1101 → 11012 → 10 → 0010

3. Finally concatenate these 3-digit groups to generate binary number. (4 D 2)16 = (100 1101 0010)2

Exercise: Convert (3F2)16 and (6C3)16 into binary numbers.

Dr. M. G. Abbas Malik – COMSATS Lahore28

Page 29: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

Decimal Hexadecimal Binary0 0 0000

Hexadecimal Numbers0 0 00001 1 00012 2 00103 3 00114 4 0100Why 4-digit 5 5 01016 6 01107 7 0111

groups while conversion from 7 7 0111

8 8 10009 9 1001

conversion from Binary to

10 A 101011 B 1011

Hexadecimal and vice versa?

12 C 110013 D 110114 E 1110

and vice versa?

Dr. M. G. Abbas Malik – COMSATS Lahore29

14 E 111015 F 1111

Page 30: Digital Logic and Design 01 - sanlp.org Logic and Design 01.pdf · Digital Logic and Design (ELE-241) ... Digital Logic and Design yText book Digital Design 2nd Ed., ... 9Digital

A i t # 1Assignment # 1Available on the course websiteAvailable on the course websiteDue date is 27th Feb 2011 till Mid-nightAll i t ill b b itt d l t i llAll assignments will be submitted electronically either by email or by USB.E h t d t ill b it ZIP fil h illEach student will submit a ZIP file whose name will like

“<dt d t id> A i t < i t b >”“<dtudent id> – Assignment <assignment number>”No late assignment will be evaluated or entertainedCopied assignment will be evaluated with ZERO

Dr. M. G. Abbas Malik – COMSATS Lahore30