Top Banner
CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal
32
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

CPS-304DIGITAL LOGIC & DESIGN

Instructor : Ms. Saba Iqbal

Page 2: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Textbook – Digital Design by Morris Mano , 2 nd Edition/ 3rd

Edition/Digital Fundamentals.

Page 3: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Introduction to concepts of digital logic, gates, and the digital circuits• Design and analysis of combinational and sequential circuits• Basics of logic design of computer hardware

What’s Course About?

Page 4: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Binary Systems• Binary Algebra• Simplification of Boolean Functions• Combinational Logic• Sequential Logic• MSI Sequential Circuits

Course Outline

Page 5: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Digital Computer follow a sequence of instructions, Digital System play a prominent role in this digital age– Communication, medical treatment, internet, DVD, CD,

Space ,Programme.Scientific &Educational field ,ATC commercial etc.– called programs, that operate on given data– User can specify and change program or data according to needs

• Like Digital Computers, most digital devices are programmable

• Digital Systems have the ability to Manipulate discrete elements of information.– Any set that is restricted to a finite number of elements contains discrete

information• 10 Decimal digits• 26 Alphabet letters• 52 Playing cards• 64 squares of a chessboard

Digital Systems

Page 6: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Digital Systems can do hundreds of millions of operations per second

• Extreme reliability due to error-correcting codes• A Digital System is interconnection of digital modules• To understand Digital module, we need to know about

digital circuits and their logical functions• Hardware Description Language (HDL) is a programming

language that is suitable for describing digital circuit in a textual form– Simulate a digital system to verify operation before it is

built

Digital Systems

Page 7: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

7

COMPUTERAnalog Computer,. It responds to continuous signals.

Digital computer. It responds to 0 and 1. also called Binary.

Main Modules.

Memory Unit

Processor Unit

Control Unit

Input Device / Output Device

CPU Processor combined with Control Unit

Micro Processor. CPU in a Small integrated circuit

CPU combined with Memory and Interface control for i/p and o/p devices form a micro computer.

Page 8: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Fetch Time. Getting data and instructions from ALU and then issue command Fix time

• Execute Time. ALU carries out execution Time is variable• Master clock. It is in control unit and control all functions• Memory

– RAM Semi conductor memory & Ferrite core memory– Sequential Memory . Mag tape, mag disk, CD Floppy Mag Drum.

• each info has a location and an address.

8

DATA FLOW

Page 9: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

– Random Access Memory,. Access time to a location is constant.

– Sequential access memory. Access time to all locations are different

– Main memory and Secondary memory. How we store• Semi conductor Magnetic Material• Binary Req. as material can store only 1 and 0

– Three things are stored, Instructions, Data, Address.

9

DEFINATIONS MEMORY

Page 10: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• 7,392= 7x103 + 3x102 + 9x101 + 2x100

– Thousands, hundreds, etc…power of 10 implied by position of coefficient

• Generally a decimal number is represented by a series of coefficients– a6 a5 a4 a3 a2 a1 a0. a-1 a-2 a-3 a-4

• aj cofficient are any of the 10 digit (0,1,2…9)• Decimal number are base 10

Decimal Number

Page 11: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Digital Systems manipulate discrete quantities of information in binary form– Operands in calculations– Decimal Digits– Results

• Strings of binary digits (“bits”)• Two possible values 0 and 1

Binary Number

Page 12: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Each digit represents a power of 2• Coefficient have two possible values 0 and 1• Strings of binary digits (“bits”)

– n bits can store numbers from 0 to 2n -1– n bits can store 2n distinct combinations of 1’s and 0’s

• Each coefficient aj is multiplied by 2j

• So 101 binary is 1 x 22 + 0 x 21 + 1 x 20

or 1 x 4 + 0 x 2 + 1 x 1 = 5

Binary Numbers

Page 13: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• A bit (short for binary digit) is the smallest unit of data in a computer. – A bit can hold only one of two values: 0 or 1, corresponding to the

electrical values of off or on, respectively.– Because bits are so small, you rarely work with information one bit at a

time – A byte is a unit of measure for digital information. – A single byte contains eight consecutive bits

• Binary Arithmetic. Addition, Subtraction Multiplication• Give example

BITs & Bytes

Page 14: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

GATES

Page 15: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

Octal

• Octal is base 8• A number is represented by a series of coefficients

– a6 a5 a4 a3 a2 a1 a0. a-1 a-2 a-3 a-4

• aj cofficient are any of 8 digit (0,1,2…7)• Need 3 bits for representation

• Example: (127.4)8= 1 X 82 +2 X 81 +7 X 80 + 4 X 8-1

64+16+7+.5= (87.5)10

Dec Bin Octal

0 000 0

1 001 1

2 010 2

3 011 3

4 100 4

5 101 5

6 110 6

7 111 7

8 1000 -

9 1001 -

Page 16: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

Hexadecimal

• Hexadecimal is base 16• A number is represented by a series of

coefficients– a6 a5 a4 a3 a2 a1 a0. a-1 a-2 a-3 a-4

• aj cofficient are any of 16 digit (0,1,2,3,4,5,6,7,8, 9,A,B,C,D,E,F)

• Need 4 bits for representation

• (B65F)1611 X 163 +6 X 162 + 5 X 161 +15 X 160 = 11x4096 + 6x256 +5x16 +15= 45056 + 1536 + 80 +15 = 46,687

Dec Bin Hex

0 0000 0

1 0001 1

2 0010 2

3 0011 3

4 0100 4

5 0101 5

6 0110 6

7 0111 7

8 1000 8

9 1001 9

10 1010 a

11 1011 b

12 1100 c

13 1101 d

14 1110 e

15 1111 f

Page 17: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Easy, just multiply digit by power of 2• Just like a decimal number is represented• Example follows

Converting Binary to Decimal

Page 18: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

1 0 0 1 1 1 0 0

Binary Decimal Example

7 6 5 4 3 2 1 0

27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1

128 + 0 + 0 + 16 + 8 + 4 + 0 + 0 = 156

What is 10011100 in decimal?

Page 19: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• A little more work than binary to decimal• Some examples–3 = 2 + 1 = 11 (that’s 1•21 + 1•20)–5 = 4 + 1 = 101 (that’s 1•22 + 0•21 + 1•20)

Decimal to Binary

Page 20: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

1. Find largest power-of-two smaller than decimal number

2. Make the appropriate binary digit a ‘1’3. Subtract the power of 2 from decimal4. Do the same thing again

Algorithm – Decimal to Binary

Page 21: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Convert 28 decimal to binary

Decimal Binary Example

7 6 5 4 3 2 1 0

27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1

32 is too large, so use 16Binary 10000 Decimal 28 – 16 = 12

Binary 11000 Decimal 12 – 8 = 4Next is 8

Binary 11100 Decimal 4 – 4 = 0Next is 4

Page 22: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Convert decimal 0.6875 to binary

IntegerFraction Coefficient0.6875 X 2= 1 0.3750 a-1=1

0.3750 X 2= 0 0.7500 a-2=0

0.7500 X 2= 1 0.5000 a-3=1

0.5000 X 2= 1 0.0000 a-4=1

(0.6875)10 = (0.1011)2

Decimal Binary (Fraction)

Page 23: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

Similar to decimal binary.1. Find largest power-of-8 smaller than

decimal number2. Divide by power-of-8. The integer result is

Octal digit.3. The remainder is new decimal number.4. Do the same thing again

Decimal to Octal

Page 24: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Convert decimal 153 to Octal

Decimal Octal

153 3 2 1 0

19 1 83 82 81 80

20

32

512 64 8

1

512 is too large, so use 64Octal 200 Decimal 153 – 64X2 = 25

Octal 230Decimal 25 – 8X3= 1Next is 8

Octal 231Decimal 1 – 1X1 = 0Next is 1

Page 25: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Convert decimal 0.513 to Octal

IntegerFraction Coefficient0.513 X 8 = 4 + 0.104 a-1=4

0.104 X 8 = 0 + 0.832 a-2=0

0.832 X 8 = 6 + 0.656 a-3=6

0.656 X 8 = 5 + 0.248 a-4=5

0.248 X 8 = 1 + 0.984 a-5=1

0.984 X 8 = 7 + 0.872 a-5=7

(0.513)10= (0.406517)8

Decimal Octal (Fraction)

Page 26: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Partition Binary number into group of three digits each

• The corresponding octal digit is then assigned to each group

• (10 110 001 101 011 . 111 100 000 100)2

• (10 110 001 101 011 . 111 100 000 100)2 = (26153.7460)8

Binary to Octal

Page 27: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Each Octal digit is converted to its three digit binary equivalent

• (26153.7460)8 = (010 110 001 101 011 . 111 100 000 100)2

Octal to Binary

Page 28: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Convention – write 0x before number• Hex to Binary – just convert digits

Hex to BinaryBin Hex

0000 0

0001 1

0010 2

0011 3

0100 4

0101 5

0110 6

0111 7

1000 8

1001 9

1010 a

1011 b

1100 c

1101 d

1110 e

1111 f

0x2ac

0010 1010 1100

0x2ac = 001010101100

No magic – remember hex digit = 4 bits

Page 29: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Just convert groups of 4 bits

Binary to HexBin Hex

0000 0

0001 1

0010 2

0011 3

0100 4

0101 5

0110 6

0111 7

1000 8

1001 9

1010 a

1011 b

1100 c

1101 d

1110 e

1111 f

101001101111011

1011

5 3 7 b

101001101111011 = 0x537b

0101 0111 0011

Page 30: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

• Just multiply each hex digit by decimal value, and add the results.

Hex to Decimal

163 162 161 160

4096 256 16 1

0x2ac

2 • 256 + 10 • 16 + 12 • 1 = 684

Dec Hex

0 0

1 1

2 2

3 3

4 4

5 5

6 6

7 7

8 8

9 9

10 a

11 b

12 c

13 d

14 e

15 f

Page 31: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

Similar to decimal binary.1. Find largest power-of-16 smaller than

decimal number2. Divide by power-of-16. The integer result is

hex digit.3. The remainder is new decimal number.4. Do the same thing again

Decimal to Hex

Page 32: CPS-304 DIGITAL LOGIC & DESIGN Instructor : Ms. Saba Iqbal.

Decimal to Hex

163 162 161 160

4096 256 16 1

Dec Hex

0 0

1 1

2 2

3 3

4 4

5 5

6 6

7 7

8 8

9 9

10 a

11 b

12 c

13 d

14 e

15 f

684

684/256 = 2 0x2__684%256 = 172

172/16 = 10 = a 0x2a_172%16 = 12 = c 0x2ac