Top Banner
CSC212 – Computer CSC212 – Computer Organization and Design Organization and Design Digital Electronics – William Kleitz, 9 Digital Electronics – William Kleitz, 9 th th Ed. Ed. 1. 1. Chapter 01: Number Systems and Codes Chapter 01: Number Systems and Codes 2. 2. Chapter 03: Basic Logic Gates Chapter 03: Basic Logic Gates 3. 3. Chapter 05: Boolean Algebra Chapter 05: Boolean Algebra 4. 4. Chapter 06: Exclusive-OR and NOR Gates Chapter 06: Exclusive-OR and NOR Gates 5. 5. Chapter 07: Arithmetic Operations & Chapter 07: Arithmetic Operations & Circuits Circuits 6. 6. Code Converters, Muxers and Demuxers Code Converters, Muxers and Demuxers
41

CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Dec 27, 2015

Download

Documents

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: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

CSC212 – Computer CSC212 – Computer Organization and DesignOrganization and DesignDigital Electronics – William Kleitz, 9Digital Electronics – William Kleitz, 9thth Ed. Ed.

1.1.Chapter 01: Number Systems and CodesChapter 01: Number Systems and Codes

2.2.Chapter 03: Basic Logic GatesChapter 03: Basic Logic Gates

3.3.Chapter 05: Boolean AlgebraChapter 05: Boolean Algebra

4.4.Chapter 06: Exclusive-OR and NOR Chapter 06: Exclusive-OR and NOR GatesGates

5.5.Chapter 07: Arithmetic Operations & Chapter 07: Arithmetic Operations & CircuitsCircuits

6.6.Code Converters, Muxers and DemuxersCode Converters, Muxers and Demuxers

Page 2: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Chapter 1Chapter 1

Number Systems and CodesNumber Systems and Codes

1

Page 3: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Chapter ObjectivesChapter Objectives You should be able to:You should be able to:

Determine the weighting factor of each digit Determine the weighting factor of each digit position in the decimal, binary, octal, and position in the decimal, binary, octal, and hexadecimal numbering systems.hexadecimal numbering systems.

Convert any number among the four number Convert any number among the four number systems, and its equivalent value in any of systems, and its equivalent value in any of the remaining three numbering systems.the remaining three numbering systems.

Describe binary coded decimal (BCD) Describe binary coded decimal (BCD) numbers.numbers.

Translate alphanumeric data to and from Translate alphanumeric data to and from ASCII using the ASCII code translation table.ASCII using the ASCII code translation table.

2

Page 4: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Digital versus AnalogDigital versus Analog

DigitalDigital OFF and ON states that can be OFF and ON states that can be

represented usingrepresented using

0s and 1s (respectively).0s and 1s (respectively). AnalogAnalog

Continuously varyingContinuously varying Examples: temperature, pressure, Examples: temperature, pressure,

velocityvelocity

4

Page 5: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Discussion PointsDiscussion Points

Explain the difference between Explain the difference between analog and digital signals.analog and digital signals.

Describe some applications for Describe some applications for digital technology.digital technology.

What are the benefits of using What are the benefits of using digital systems?digital systems?

Are there any problems associated Are there any problems associated with digital systems?with digital systems?

6

Page 6: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Digital vs. Digital vs. AnalogAnalog

5

Page 7: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Digital Representations Digital Representations of Analog Quantitiesof Analog Quantities

Audio RecordingAudio Recording Audio CD and MP3 players/recordersAudio CD and MP3 players/recorders

Video RecordingVideo Recording DVDs store digital representations of DVDs store digital representations of

analog video and audio signalsanalog video and audio signals

7

Page 8: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Analog Signal Voltages Analog Signal Voltages and Their Digital and Their Digital

EquivalentsEquivalents

Page 9: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Digital-to-Analog and Digital-to-Analog and Back AgainBack Again

8

Page 10: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Why Digital Why Digital Systems AreSystems AreImmune to Analog Immune to Analog NoiseNoise

9

Page 11: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Digital Representations of Digital Representations of Alternative Energy SourcesAlternative Energy Sources Energy technicians must keep track Energy technicians must keep track

of the efficiency of their energy of the efficiency of their energy collection systems.collection systems.

Naturally occurring quantities like Naturally occurring quantities like solar, wind, and temperature are solar, wind, and temperature are analog quantities and must be analog quantities and must be digitized before a computer can digitized before a computer can understand them.understand them.

Page 12: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

A Solar Radiation Data-A Solar Radiation Data-logger Systemlogger System

Page 13: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Decimal Numbering Decimal Numbering System System

(Base 10)(Base 10)

10 possible digits: 0, 1, 2, 3, 4, 5, 6, 10 possible digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 97, 8, and 9

Least-significant position is on the Least-significant position is on the right endright end

Most-significant position is on the Most-significant position is on the left endleft end

Weighting factor of 10Weighting factor of 10

10

Page 14: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Binary Numbering SystemBinary Numbering System (Base 2) (Base 2)

Only two possible digits: 0 and 1Only two possible digits: 0 and 1 Weighting factor of 2Weighting factor of 2 Conversion techniquesConversion techniques

Digit times weighting factorDigit times weighting factor Successive divisionSuccessive division

11

Page 15: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Decimal-to-Binary Decimal-to-Binary ConversionConversion

Subtracting weighting factors Subtracting weighting factors (Example 1-4)(Example 1-4)

Successive division (Example 1-5)Successive division (Example 1-5) First remainder is the Least-Significant First remainder is the Least-Significant

Bit (LSB)Bit (LSB) Last remainder is the Most-Significant Last remainder is the Most-Significant

Bit (MSB)Bit (MSB)

12

Page 16: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Octal Numbering System Octal Numbering System (Base 8)(Base 8)

Eight allowable digits: 0, 1, 2, 3, 4, Eight allowable digits: 0, 1, 2, 3, 4, 5, 6, and 75, 6, and 7

Weighting factor of 8Weighting factor of 8

13

Page 17: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Octal ConversionsOctal Conversions Binary to octalBinary to octal

Group binary positions in groups of Group binary positions in groups of threethree

Write the octal equivalentWrite the octal equivalent Octal to binaryOctal to binary

Reverse the processReverse the process Octal to decimalOctal to decimal

Multiply by weighting factorsMultiply by weighting factors Decimal to octalDecimal to octal

Successive divisionSuccessive division14

Page 18: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Hexadecimal Numbering Hexadecimal Numbering SystemSystem

(Base 16)(Base 16) 16 allowable digits.16 allowable digits.

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and FF

Each hex digit represents a 4-bit groupEach hex digit represents a 4-bit group See Table 1-3See Table 1-3

Two hex digits are used to represent 8 Two hex digits are used to represent 8 bitsbits 8 bits are called a 8 bits are called a bytebyte 4 bits are called a 4 bits are called a nibblenibble

15

Page 19: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Hexadecimal Numbering Hexadecimal Numbering SystemSystem

Page 20: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Hexadecimal ConversionsHexadecimal Conversions

Binary-to-hexadecimal conversionBinary-to-hexadecimal conversion Group the binary in groups of fourGroup the binary in groups of four Write the equivalent hex digitWrite the equivalent hex digit

Hexadecimal-to-binary conversionHexadecimal-to-binary conversion Reverse the processReverse the process

16

Page 21: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Hexadecimal ConversionsHexadecimal Conversions

Hexadecimal-to-decimal Hexadecimal-to-decimal conversionconversion Multiply by weighting factorsMultiply by weighting factors

Decimal-to-hexadecimal Decimal-to-hexadecimal conversionconversion Successive divisionSuccessive division

17

Page 22: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Binary-Coded-Decimal Binary-Coded-Decimal SystemSystem(BCD)(BCD)

Each of the 10 decimal digits is Each of the 10 decimal digits is represented by its 4-bit binary represented by its 4-bit binary equivalent.equivalent.

Decimal-to-BCD conversionDecimal-to-BCD conversion Convert each decimal digit to its 4-bit Convert each decimal digit to its 4-bit

binary codebinary code BCD-to-Decimal conversionBCD-to-Decimal conversion

Reverse the processReverse the process18

Page 23: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.
Page 24: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

The ASCII CodeThe ASCII Code American Standard Code for American Standard Code for

Information Interchange (ASCII)Information Interchange (ASCII) Represents alphanumeric dataRepresents alphanumeric data Uses 7 bitsUses 7 bits

128 different code combinations 128 different code combinations (see Table 1-5)(see Table 1-5) 3-bit group is most significant3-bit group is most significant 4-bit group is least significant4-bit group is least significant

20

Page 25: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

21

Page 26: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Numbering System Numbering System ApplicationsApplications

Because digital systems must work Because digital systems must work with 1s and 0s, learning the different with 1s and 0s, learning the different numbering systems is important.numbering systems is important.

Which system is used is determined Which system is used is determined by how the data were developed and by how the data were developed and how they are to be used.how they are to be used.

Several numbering system Several numbering system applications follow.applications follow.

22

Page 27: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-1Application 1-1

22

The four chemical storage tanks shown are monitored for temperature (T) and pressure (P).

Page 28: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-1 Application 1-1 (continued)(continued)

Using the table shown below, Using the table shown below, interpret the following:interpret the following: If the computerIf the computer reads a binary

string of 0010 1000 what problems exist?

This indicates that the pressure in tanks C and B are too high.

22

Page 29: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-1 Application 1-1 (continued)(continued)

Using the table shown below, Using the table shown below, interpret the following:interpret the following: If the computerIf the computer reads a hex value of

55H what problems exist? Since 55H =0101 0101 This

indicates that all tank temperatures are too high.

22

Page 30: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-1 Application 1-1 (continued)(continued)

Using the table shown below, Using the table shown below, interpret the following:interpret the following: If the temperature and pressure in If the temperature and pressure in

tanks B and D are too high, what tanks B and D are too high, what hex value is read by the computerhex value is read by the computer?

This condition would produce a digital output of 1100 1100 = CCH.

22

Page 31: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-1 Application 1-1 (continued)(continued)

Using the table shown below, interpret Using the table shown below, interpret the following:the following: Assume that tanks A and B are shut

down and all sensors are tied high (1s). What is the lowest decimal value that indicates a problem in the other two tanks?

With the four low-order bits tied high, the lowest value that indicates a problem is 0001 111 or 3110.

22

Page 32: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-1 Application 1-1 (continued)(continued)

Using the table shown below, Using the table shown below, interpret the following:interpret the following: If only tanks A, B, and C are monitored,

what octal value indicates tank B has both temperature and pressure problems?

The binary output would be 001 1002 = 148.

22

Page 33: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-2 Application 1-2 A CD player converts 12-bit signals

from a CD into equivalent analog values.

What are the largest and smallest hex What are the largest and smallest hex values that can be used in this system?values that can be used in this system? The largest is FFFThe largest is FFF1616 and the smallest is and the smallest is

0000001616..

How many different analog values can How many different analog values can be representedbe represented? FFF16 = 409510, so including 0 the total is

4096 unique values.

22

Page 34: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-3Application 1-3 Typically, digital thermometers Typically, digital thermometers

use BCD to drive their displaysuse BCD to drive their displays. How many BCD bits are How many BCD bits are

required to drive a 3-digit required to drive a 3-digit display?display? 12 bits are required; four for each 12 bits are required; four for each

digit.digit. What 12 bits represent 147°F?

0001 (1), 0100 (4), and 0111 (7).

22

Page 35: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-4Application 1-4

Most PC-compatible computer Most PC-compatible computer systems use a 20-bit address code systems use a 20-bit address code to identify each of over 1 million to identify each of over 1 million memory locationsmemory locations.

How many hex characters are How many hex characters are required to identify the address of required to identify the address of each memory location?each memory location? Five hex characters are required Five hex characters are required

since each hex character represents since each hex character represents 4 bits.4 bits.

22

Page 36: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-4 Application 1-4 (continued)(continued)

What is the hex address of the 200What is the hex address of the 200thth memory location?memory location? 000C8H = 200000C8H = 2001010, but 00000H is the , but 00000H is the

first memory location, so we must first memory location, so we must subtract 1. The answer is C8 – 1 = C7.subtract 1. The answer is C8 – 1 = C7.

If 50 memory locations are used for If 50 memory locations are used for data storage starting at location data storage starting at location 000C8H, what is the location of the last 000C8H, what is the location of the last data item?data item? C8H gets the first data item, so the answer C8H gets the first data item, so the answer

is 249is 2491010 = F9H. = F9H.

22

Page 37: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-5Application 1-5 The part number 651-M is stored in ASCII in a The part number 651-M is stored in ASCII in a

computer memory. List the binary contents of its computer memory. List the binary contents of its memory locations?memory locations? 6 = 011 01106 = 011 0110

5 = 011 01015 = 011 01011 = 011 00011 = 011 0001- = 010 1101- = 010 1101M = 100 1101M = 100 1101

Grouping the binary bits in eights, this string Grouping the binary bits in eights, this string represents 5 hex memory locations: represents 5 hex memory locations:

011 0110 011 0101 011 0001 010 1101 100 011 0110 011 0101 011 0001 010 1101 100 11011101 36 35 31 2D 4D 36 35 31 2D 4D

22

Page 38: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

Application 1-6Application 1-6 A programmer uses a debugging A programmer uses a debugging

utility to find an error in a BASIC utility to find an error in a BASIC program. The utility shows the program. The utility shows the ASCII code as hex 474F5430203930. ASCII code as hex 474F5430203930. Assume that the leftmost bit of each Assume that the leftmost bit of each ASCII string is padded with a zero. ASCII string is padded with a zero.

The program segment is translated The program segment is translated as as GOT0 90.GOT0 90. The error is that a zero (0) was The error is that a zero (0) was

typed instead of the letter O.typed instead of the letter O.22

Page 39: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

SummarySummary

Numerical quantities occur Numerical quantities occur naturally in analog form but must be naturally in analog form but must be converted to digital form to be used converted to digital form to be used by computers or digital circuitry.by computers or digital circuitry.

The binary numbering system is The binary numbering system is used in digital systems because the used in digital systems because the 1s and 0s are easily represented by 1s and 0s are easily represented by ON or OFF transistors, which output ON or OFF transistors, which output 0 V for 0 and +5 V for 1.0 V for 0 and +5 V for 1.

28

Page 40: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

SummarySummary

Any number system can be converted to Any number system can be converted to decimal by multiplying each digit by its decimal by multiplying each digit by its weighting factor.weighting factor.

The weighting factor for the least The weighting factor for the least significant digit in any number system is significant digit in any number system is always 1.always 1.

Binary numbers can be converted to Binary numbers can be converted to octal by forming groups of 3 bits and to octal by forming groups of 3 bits and to hexadecimal by forming groups of 4 hexadecimal by forming groups of 4 bits.bits.

29

Page 41: CSC212 – Computer Organization and Design Digital Electronics – William Kleitz, 9 th Ed. 1. Chapter 01: Number Systems and Codes 2. Chapter 03: Basic Logic.

SummarySummary

The successive division procedure The successive division procedure can be used to convert from decimal can be used to convert from decimal to binary, octal, or hexadecimalto binary, octal, or hexadecimal

The binary-coded-decimal system The binary-coded-decimal system uses groups of 4 bits to drive decimal uses groups of 4 bits to drive decimal displays such as those in a calculator.displays such as those in a calculator.

ASCII is used by computers to ASCII is used by computers to represent all letters, numbers and represent all letters, numbers and symbols in digital form.symbols in digital form.

30