Top Banner
Microprocesso rs Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University
94

Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Dec 27, 2015

Download

Documents

Aleesha Ellis
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: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

MicroprocessorsTuesday, Mar. 11

Dr. Asmaa FaroukFaculty of Engineering, Electrical Department,

Assiut University

Page 2: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Instructors

• Dr. Asmaa Farouk ([email protected]).

• Office hours: – Sundays & Tuesdays 10:00 – 11.00 am.– Mondays 1:00 – 2.00 pm. – or by appointment.

• TA: Eng. Mostafa Abdallah.

Page 3: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Material• Textbooks:

1. Barry B. Brey: The Intel Microprocessors 8086/8088, 80186/80188, 80286,

80386, 80486, Pentium, Pentium Pro Processor, Pentium II, Pentium III, Pentium 4, and Core2 with 64-Bit Extensions

Architecture, Programming, and Interfacing

Page 4: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Material• Textbooks:

2. M. A. Mazidi & J. G. Mazidi: The 80x86 IBM PC and Compatible Computers.

Assembly Language, Design, and Interfacing

Page 5: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Course Grades

• Final Exam (60 marks).• Midterm Exam (15 marks).– End of April.

• Section activities, quizzes, small projects,…etc (20+5 marks).

Page 6: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Course Grades

• Final Exam (100 marks).• Midterm Exam (30 marks).– End of April.

• Section activities, quizzes, small projects,…etc (20 marks).

Page 7: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Course Overview

• History of Microprocessors.• The Architecture of the 80x86 μP.• 80x86 Instruction Set.• 80x86 Memory Addressing Modes.• 80x86 Assembly Language.• Other Intel Microprocessors Instruction Sets.

Page 8: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Topics of Today

• Reading:Reading:– Brey:• Chapter 1.0:

Introduction to the microprocessor and the computer.

Page 9: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Topics of Today

• A Historical Background.• The Microprocessor-Based Computer System.• Number Systems.• Computer Data Formats.

Page 10: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Important Definitions & Concepts• What is What is the Microprocessor the Microprocessor ((µPµP)?)?– It is the integrated circuit (IC) that represents the

heart of a computer system.– Also called the CPU (Central Processing Unit).– It is the controlling element in a computer system. – Controls the memory and I/O devoces through

connections called buses, using instructions stored in the memory.

Page 11: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Important Definitions & Concepts• What is What is the Microprocessor the Microprocessor ((µPµP)? (Cont.))? (Cont.)– Performs three main tasks:• Data transfer between itself and the memory or I/O

systems.• Simple arithmetic and logic operations.• Program flow via simple decisions.

Page 12: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Important Definitions & Concepts• What is What is the Microprocessor the Microprocessor ((µPµP)? (Cont.))? (Cont.)– Three basic characteristics differentiate

microprocessors:• Instruction set: The set of instructions that the

microprocessor can execute.• Bandwidth: The number of bits processed in a single

instruction.• Clock speed: defines how many instructions per second

the processor can execute.

Page 13: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Important Definitions & Concepts• What are the What are the busesbuses??– A common group of wires that interconnect

components in a computer system.– Transfer address, data, & control information

between microprocessor, memory and I/O. – Three buses exist for this transfer of information:

address, data, and control.

Page 14: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Topics of Today

• A Historical Background.• The Microprocessor-Based Computer System.• Number Systems.• Computer Data Formats.

Page 15: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age:The Microprocessor Age:– World’s first microprocessor is the Intel 4004.• A 4-bit microprocessor-programmable controller on a

chip. – A bit is a binary digit with a value of one or zero.– 4-bit wide memory location often called a nibble.

• The 4004 instruction set contained 45 instructions.• Fabricated with P-channel MOSFET technology

(state-of-the-art at that time).

Page 16: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– World’s first microprocessor is the Intel 4004.• Executed instructions at 50 KIPs (kilo-instructions per

second). • Slow compared to 100,000 instructions per second

by 30-ton ENIAC computer in 1946.• The difference was that 4004 weighed less than an

ounce.• Debuted in early game systems and small control

systems.

Page 17: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– Main problems with early microprocessor were

speed, word width, and memory size. – Evolution of 4-bit microprocessor ended when Intel

released the 4040, an updated version of 4004. • Operated at a higher speed; lacked improvements in word

width and memory size.

Page 18: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– Texas Instruments and others also produced 4-bit

microprocessors. • Still survives in low-end applications such as microwave ovens

and small control systems.• Calculators still based on 4-bit BCD (binary-coded-decimal)

codes.

Page 19: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The 8008 microprocessor (Intel 1971).• Extended 8-bit version of 4004 microprocessor.• Expanded memory of 16K bytes.

– A byte is generally an 8-bit-wide binary number and a K is 1024.

• Memory size often specified in K bytes.• Contained additional instructions, 48 total.• Provided opportunity for application in more advanced

systems.– Engineers developed demanding uses for 8008.

• Somewhat small memory size, slow speed, and instruction set limited 8008 usefulness.

Page 20: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The 8008 microprocessor (Intel 1971).– Motorola Corporation introduced MC6800

microprocessor about six months later.– Other companies soon introduced their own

versions of the 8-bit microprocessor.

Page 21: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The 8080 microprocessor (Intel 1973).• 8080 addressed four times more memory.– 64K bytes vs. l6K bytes for 8008.

• Executed additional instructions; 10x faster. – Addition takes 20 µs on an 8008-based system,

required only 2.0 µs on an 8080-based system.• TTL (transistor-transistor logic) compatible.– The 8008 was not directly compatible.

• Interfacing made easier and less expensive.

Page 22: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The 8085 microprocessor (Intel 1977):• Last 8-bit, general-purpose microprocessor .• Slightly more advanced than 8080; executed software at

an even higher speed. • 769,230 instructions per second vs. 500,000 per second

on the 8080.• Main advantages of 8085 were its internal clock

generator and system controller, and higher clock frequency.• Higher level of component integration reduced

the 8085’s cost and increased its usefulness.

Page 23: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Modern microprocessor, 8086 (Intel 1978),

8088 (Intel 1979):• Both devices are 16-bit microprocessors.• Executed instructions in as little as 400 ns (2.5 millions of

instructions per second).• Major improvement over execution speed of 8085.• Addressed 1M byte of memory.

– 1M-byte memory contains 1024K byte-sized memory locations or 1,048,576 bytes.

– 16 times more memory than the 8085.

Page 24: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Modern microprocessor, 8086 (Intel 1978),

8088 (Intel 1979):• Higher speed and larger memory size allowed 8086 &

8088 to replace smaller minicomputers in many applications.• Another feature was a 4- or 6-byte instruction cache or

queue that pre-fetched instructions before they were executed. – Queue sped operation of many sequences of instruction.

• Basis for the much larger instruction caches found in modem microprocessors.

Page 25: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Modern microprocessor, 8086 (Intel 1978),

8088 (Intel 1979):• Increased memory size and additional instructions led to

many efficient and sophisticated applications.• Improvements to the instruction set included multiply

and divide instructions.– Missing on earlier microprocessors.

• Number of instructions increased.– From 45 on the 4004, to 246 on the 8085.

• Over 20,000 variations on the 8086 & 8088.

Page 26: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Modern microprocessor, 8086 (Intel 1978),

8088 (Intel 1979):• These microprocessors are called CISC (complex

instruction set computers).• Also provided more internal register storage space.

– Additional registers allowed software to bewritten more efficiently.

• Evolved to meet need for larger memory systems.

Page 27: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The 80286 microprocessor (Intel 1983):• Almost identical to the 8086/8088.• Addressed 16M-byte memory system instead

of a 1M-byte system.• Instruction set almost identical except for a few

additional instructions.• Clock speed increased in 8.0 MHZ version. • Executed some instructions in as little as 250 ns (4.0

MIPs).

Page 28: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The 32-bit microprocessor, 80386 (Intel 1986):• Applications demanded faster microprocessor speeds,

more memory, and wider data paths.– Led to the 80386.

• Intel’s first practical microprocessor to contain a 32-bit data bus and 32-bit memory address.• Addressed up to 4G bytes of memory.

– 1G memory = 1024M, or 1,073,741,824 locations.

Page 29: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The 32-bit microprocessor, 80386 (Intel 1986):• Other Versions:

– 80386SX addressed 16M bytes of memory through a 16-bit data and 24-bit address bus.

– 80386SL/80386SLC addressed 32M bytes memory via 16-bit data, 25-bit address bus.» 80386SLC contained an internal cache to process data at

even higher rates.

Page 30: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The 32-bit microprocessor, 80386 (Intel 1986):• Other Versions:

– 80386EX (1995) which called an embedded PC (contains all components of the AT class computer on a single integrated circuit).» 24 lines for input/output data.» 26-bit address bus; 16-bit data bus.» DRAM refresh controller.» Programmable chip selection logic.

Page 31: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The 80486 microprocessor (Intel 1989):• Highly integrated package.• 80386 like microprocessor‐• 80387 like numeric coprocessor.‐• 8K byte cache ‐ memory system.• Half of its instructions executed in one clock instead of

two clocks as in 80386.• Other versions 80486DX2, 80486DX4, 80486SX.

Page 32: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium microprocessor (Intel 1993):• Intel decided not to use a number (in the naming)

because it appeared to be impossible to copyright a number.• Originally named the P5 or 80586.• First versions were working at 60 MHz & 66 MHz, and a

speed of 110 MIPs, while fastest version produced 233 MHZ Pentium (a three and one-half the first version).• Cache size was increased to 16KB vs. 8KB in 80486.• Memory system up to 4G bytes, data bus width 64 bits.

Page 33: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium microprocessor (Intel 1993):• Included additional instructions multimedia extensions

MMX , no high level language support for instructions.‐• Contains two independent internal integer processors

called superscaler technology.• Jump prediction speeds execution of program loops;

internal floating-point coprocessor handles floating-point data.• Replaced some RISC (Reduced Instruction Set Computer)

machines which execute more than one instruction per clock.

Page 34: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium microprocessor (Intel 1993):– Motorola, Apple, and IBM produced PowerPC, a

RISC microprocessor with two integer units and a floating point unit.‐• Boosts Macintosh performance, but slow to efficiently

emulate Intel microprocessors.

Page 35: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium Pro microprocessor (Intel 1996):• A recent release of Intel, named P6.• 3 integer units, floating point unit, clock frequency of ‐

150 and 166 MHZ.• 16K level one cache (‐ L1), 256K level two cache (‐ L2).• Executes up to three instructions at a time, execute in

parallel.• Efficiently execute 32 bit code. ‐• Can address 4G-byte or a 64G-byte memory system.

Page 36: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium II microprocessor (Intel 1997):• Represents new direction for Intel.• On a small circuit board, instead of being an integrated

circuit.• The microprocessor on the Pentium II module actually

Pentium Pro with MMX extensions.

Page 37: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium Xeon microprocessor (Intel 1998):• Intel announced Xeon in mid 1998.‐• Specifically designed for high end workstation and server ‐

applications.• Available with 32K L1 cache and L2 cache size of 512K,

1M, or 2M bytes.• Designed to function with four Xeons in the same system,

similar to Pentium Pro.

Page 38: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium III microprocessor (Intel 1999):• Faster core than Pentium II.• 32-bit microprocessor, 64-bit data bus and 36-bit

address bus.• 64GB main memory.• 800MHZ and above.• On-chip 256KB L2 cache (at-speed).• Memory transfers 100MHz to 133MHz.• Dual Independent Bus (simultaneous L2 and system

memory access).

Page 39: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium 4 microprocessor (Intel 2000):• Uses Intel P6 architecture.• Up to 3.2 GHz and faster.• Supporting chip sets that use RAMBUS or DDR memory

instead of SDRAM technology.

Page 40: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium Core2 microprocessor:• Available at speeds of up to 3 GHz.• Improvement in internal integration, at 45 nm

technology.• The main change is a shift from aluminum to copper

interconnections inside the microprocessor.– Copper is a better conductor, should allow increased clock

frequencies .

Page 41: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– The Pentium 4 and Core2 64-bit & Multiple core

microprocessors:• 64-bit modification allows address of over 4G bytes of

memory through a 64-bit address. • 40 address pins in these newer versions allow

up to 1T (terabytes) of memory to be accessed.• Also allows 64-bit integer arithmetic.

Page 42: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background• The Microprocessor Age (Cont.):The Microprocessor Age (Cont.):– Biggest advancement is the inclusion of multiple

cores i3, i5, i7:• Each core executes a separate task in a program.• Increases the speed of execution if program is written to

take advantage of multiple cores which is called “multithreaded applications”.• Intel manufactures dual and quad core versions; number

of cores will likely increase to eight or even sixteen.

Page 43: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

A Historical Background

• Conceptual views of the 80486, Pentium Pro, Pentium II, Pentium III, Pentium 4, and Core2 microprocessors.

Page 44: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Topics of Today

• A Historical Background.• The Microprocessor-Based Computer System.• Number Systems.• Computer Data Formats.

Page 45: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

The Microprocessor-Based Computer System

• The block diagram of a computer system:The block diagram of a computer system:

Page 46: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Topics of Today

• A Historical Background.• The Microprocessor-Based Computer System.• Number Systems.• Computer Data Formats.

Page 47: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Humans use decimal arithmetic (base 10) while

computers use the binary (base 2) system.• Using of a microprocessor requires working

knowledge of numbering systems. – Decimal.– Binary.– Hexadecimal.

Page 48: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Digits:Digits:– In base 10 (decimal) there are 10 digits:• 0, 1, 2, 3, 4, 5, 6, 7, 8 & 9.

– In base 2 (binary) there are only two digits:• 0 & 1.• Commonly referred to as bits.• The binary system is used in computers because the two

digits represent the two voltage levels off & on.

– In base 16 (hexadecimal) there are 10 digits and 6 letters:• 0, 1, 2, 3, 4, 5, 6, 7, 8 , 9, A, B, C, D, E & F.

Page 49: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Positional Notation:Positional Notation:– The radix of any numbering system is its base:• Decimal => radix = 10.• Binary => radix = 2.• Hexadecimal => radix = 16.

– The exponential value of each digit is equivalent to its position in the original number.• Put +ve (increasing from right to left) exponential for the

digits that are lying on the left of the point.• Put -ve (increasing from left to right) exponential for the

digits that are lying on the right of the point.

Page 50: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Positional Notation (Cont.):Positional Notation (Cont.):– The power of each digit is equivalent to the radix

raised to the corresponding exponential for each digit.

– The weight of each digit is equivalent to the value of its power.

Page 51: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Conversion to Decimal:Conversion to Decimal:– To convert from any system to decimal:

a) Multiply each digit in the original number by its corresponding weight.

b) Sum the numeric values in a) to form the decimal equivalent.

Page 52: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Conversion to Decimal (Cont.):Conversion to Decimal (Cont.):– Example (1): convert the binary number 110.101 to

decimal.

– Example (2): convert the hexadecimal number 6A.C to decimal.

Page 53: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Conversion from Decimal:Conversion from Decimal:– To convert from decimal (whole number) to any

numbering system:1. Divide the decimal number by the radix of the system

you want to convert to. 2. Save the remainder (first remainder is the least

significant digit).3. Repeat steps 1 and 2 until the quotient is zero.4. Remainders are written in reverse order to obtain the

converted number.

Page 54: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Conversion from Decimal (Cont.):Conversion from Decimal (Cont.):– Example (1): convert the decimal number 10 to

binary.

– Example (2): convert the decimal number 109 to hexadecimal.

Page 55: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Conversion from Decimal (Cont.):Conversion from Decimal (Cont.):– Example (1): convert the decimal number 10 to

binary.

– Example (2): convert the decimal number 109 to hexadecimal.

Fro

m r

igh

t to

lef

t

Fro

m l

eft

to r

igh

t

Page 56: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Conversion from Decimal (Cont.):Conversion from Decimal (Cont.):– To convert from decimal (fraction) to any

numbering system:1. Multiply the decimal fraction by the radix of the system

you want to convert to.2. Save the whole number portion of the result (even if

zero) as a digit. The first result is written immediately to the right of the radix point.

3. Repeat steps 1 and 2, using the fractional part of step 2 until the fractional part of step 2 is zero.

Page 57: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Conversion from Decimal (Cont.):Conversion from Decimal (Cont.):– Example (1): convert the decimal fraction number

0.125 to binary.

Page 58: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Conversion from Decimal (Cont.):Conversion from Decimal (Cont.):– Example (2): convert the decimal fraction number

0.046875 to hexadecimal.

Page 59: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Binary-Coded Hexadecimal (Binary-Coded Hexadecimal (BCHBCH):):

• Used to represent hexadecimal data in binary code.• Is a hexadecimal number with each digit is represented

by a 4-bit binary number.– 16 hexadecimal numbers can be represented by at least 4-bits.

Page 60: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Binary-Coded Hexadecimal (Binary-Coded Hexadecimal (BCHBCH)) (Cont.): (Cont.):

Page 61: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Binary-Coded Hexadecimal (Binary-Coded Hexadecimal (BCHBCH)) (Cont.): (Cont.):

• Used to represent hexadecimal data in binary code.• Is a hexadecimal number with each digit is represented

by a 4-bit binary number.– 16 hexadecimal numbers can be represented by at least 4-bits.

• Hexadecimal is represented by converting digits to BCH code with a space between each digit.

Page 62: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Binary-Coded Hexadecimal (Binary-Coded Hexadecimal (BCHBCH)) (Cont.): (Cont.):– To represent a binary number as its equivalent BCH

number:• For whole numbers, start from the right & group 4-bits at

a time, replacing each 4-bit binary number with its hex equivalent. • For fractions, start from left to right.

– Example:

Page 63: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Binary-Coded Hexadecimal (Binary-Coded Hexadecimal (BCHBCH)) (Cont.): (Cont.):– To convert from hexadecimal to binary:• Each hexadecimal digit is replaced with its corresponding

4-bit binary equivalent.

– Example:

Page 64: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• Complements:Complements:– Sometimes, data are stored in complement form to

represent negative numbers.– Two types: radix and radix – 1 complements:• radix -1 complement: each digit of the number is

subtracted from the radix -1 to represent a negative number.• In binary system it is called one’s (1’s) complement (since

radix – 1 = 2 -1 = 1).

Page 65: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• ComplementsComplements (Cont.): (Cont.):– Example (1): compute the radix – 1 (one’s)

complement of the binary number 0100 1000.

• Equivalent to inverting the binary number (NOT operation).

– Example (2): compute the radix – 1 complement of the hexadecimal number 5CD.

Page 66: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• ComplementsComplements (Cont.): (Cont.):– Sometimes, data are stored in complement form to

represent negative numbers.– Two types: radix and radix – 1 complements:• radix complement: first compute the radix -1

complement, and then add a one to the result.• In binary system it is called two’s (2’s) complement (since

the radix = 2).

Page 67: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• ComplementsComplements (Cont.): (Cont.):– Example (1): compute the radix (two’s)

complement of the binary number 0100 1000.

• Equivalent to inverting the binary number (NOT operation) then adding 1.

Page 68: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Number Systems• ComplementsComplements (Cont.): (Cont.):– Example (2): compute the radix complement of the

hexadecimal number 345.

Page 69: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Topics of Today

• A Historical Background.• The Microprocessor-Based Computer System.• Number Systems.• Computer Data Formats.

Page 70: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Because all information in the computer must

be represented by 0s & 1s, binary patterns must be assigned to letters and other characters.

• Common data formats:– ASCII.– Unicode.– BCD.– Signed and unsigned integers.– Floating point numbers (real numbers).‐

• Other forms are available but are not commonly used.

Page 71: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• ASCII data format:ASCII data format:– (American Standard Code for Information

Interchange) data format, represents alphanumeric characters in computer memory.

– Standard ASCII code is a 7-bit code.– Assigns binary patterns for:• Numbers 0 to 9.• All English alphabet letters, upper- and lower-case.• Also many control codes & punctuation marks.

Page 72: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• ASCII data format:ASCII data format:

Page 73: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• ASCII data format:ASCII data format:– (American Standard Code for Information

Interchange) data format, represents alphanumeric characters in computer memory.

– Standard ASCII code is a 7-bit code. – The 8th bit (MSB) in printing:• If 0, for alphanumeric printing.• If 1, for graphics printing.

Page 74: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• ASCII data format:ASCII data format:– (American Standard Code for Information

Interchange) data format, represents alphanumeric characters in computer memory.

– Standard ASCII code is a 7-bit code. – The 8th bit (MSB) in personal computer:– If 1, store some foreign letters and punctuation,

Greek & mathematical characters, box-drawing & other special characters.

– Called Extended ASCII characters.

Page 75: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• ASCII data format:ASCII data format:

Page 76: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Unicode data format:Unicode data format:– Many Windows based applications use the ‐ Unicode

system to store alphanumeric data.– Stores each character as 16 bit ‐ data.– Codes 0000H–00FFH are the same as standard ASCII

code.– Remaining codes, 0100H–FFFFH, store all special

characters from many character sets.– Allows software for Windows to be used in many

countries around the world.

Page 77: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• BCD data format:BCD data format:– (Binary‐Coded Decimal): digit from 00002 to 10012,

(0 to 9 decimal).– Stored in two forms:• Packed form: stored as two digits per byte.

– Used for BCD addition and subtraction in the instruction set of the microprocessor.

• Unpacked form: stored as one digit per byte.– Returned from a keypad or keyboard (devices that perform a

minimal amount of simple arithmetic).

Page 78: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• BCD data format:BCD data format:– (Binary‐Coded Decimal): digit from 00002 to 10012,

(0 to 9 decimal).– Stored in two forms:

Page 79: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Byte-Sized data format:Byte-Sized data format:– Used to represent signed and unsigned integers.– Difference in these forms is the weight of the MSB.• Value 128 for the unsigned integer.• Minus 128 for the signed integer.

1

1

Page 80: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Byte-Sized data format:Byte-Sized data format:– Used to represent signed and unsigned integers.– Difference in these forms is the weight of the MSB.• Value 128 for the unsigned integer.• Minus 128 for the signed integer.

1

1

0 0 0 0 0 0 0

0 0 0 0 0 0 0

Example: 80H

27 = 128

1 = (-) = -128

Page 81: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Byte-Sized data format:Byte-Sized data format:– Used to represent signed and unsigned integers.– Difference in these forms is the weight of the MSB.• Value 128 for the unsigned integer.• Minus 128 for the signed integer.

– Unsigned integers range from 0 – 255 (00H to FFH ).– Signed integers from 128 to 0 to + 127.‐

Page 82: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Word-Sized data format:Word-Sized data format:– A word (16-bits) is formed with two bytes of data.– The least significant byte always stored in the

lowest numbered memory location‐ . Most significant byte is stored in the highest.

– This method of storing a number is called the little endian format.

Page 83: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Word-Sized data format:Word-Sized data format:– Example: figure 1-15:

The only difference between a signed and an unsigned word in the leftmost bit position.

Page 84: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Doubleword-Sized data format:Doubleword-Sized data format:– A doubleword (32-bits) is formed with four bytes of

data.– The least significant byte always stored in the

lowest numbered memory location‐ . Most significant byte is stored in the highest (little endian format).

Page 85: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Doubleword-Sized data format:Doubleword-Sized data format:– Example: figure 1-16:

The only difference between a signed and an unsigned doubleword in the leftmost bit position.

Page 86: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Real Numbers data format:Real Numbers data format:– Used to represent floating-point numbers.– Contains two parts: • A mantissa, significand or fraction.• And an exponent.

– More 1 bit‐ representing the sign.– A 4 byte (32-bit) ‐ number is called single precision.‐– An 8 byte (64-bit)‐ number is called double‐

precision.

Page 87: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Real Numbers data format:Real Numbers data format:– Figure 1-17 (single and double precision numbers):

Page 88: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Real Numbers data format:Real Numbers data format:– Figure 1-17 (single precision numbers):

1-bit for sign.

24-bit for significand (mantissa or fraction).8-bit for exponent.

Page 89: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Real Numbers data format:Real Numbers data format:– Figure 1-17 (single precision numbers):

The 24-bit mantissa contains an implied (hidden) one-bit that allows the mantissa to represent24 bits while being stored in only 23-bits. The hidden bit is the first bit of the normalized realnumber.

Page 90: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Real Numbers data format:Real Numbers data format:

Divide the original number by the nearest biggest number makes it > 1 & < 2.

12 / 8 = 1.5 = 1.1 x 23

The whole number 1 is not stored in the 23-bit mantissa portion of the number; the 1 is the hidden one-bit.

Page 91: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Real Numbers data format:Real Numbers data format:

Divide the original number by the nearest biggest number makes it > 1 & < 2.

100 / 64 = 1.5625 = 1.1001 x 26

The whole number 1 is not stored in the 23-bit mantissa portion of the number; the 1 is the hidden one-bit.

Page 92: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Real Numbers data format:Real Numbers data format:

The exponent is stored as a biased exponent. With the single-precision form of the real number, the bias is 127 (7FH).

The exponent of 23, represented as a biased exponent of 127 + 3 or 130 (82H).

Page 93: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Computer Data Formats• Real Numbers data format:Real Numbers data format:

The number 0.0 is stored as all zeros. The number infinity is stored as all ones in the exponent and all zeros in the mantissa.

Page 94: Microprocessors Tuesday, Mar. 11 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.

Questions?Questions?