chapter 1 introduction to the microprocessor and computer prof. u v thete (dept. of computer...
TRANSCRIPT
Chapter 1
Introduction to the Microprocessor and Computer
Prof. U V THETE(Dept. of Computer Science)
Chapter 1 Introduction to the Microprocessor and Computer 2
Introduction
Overview of the Intel family MicroprocessorsHistory of computersFunction of the microprocessorTerms and Jargon – computerese
Microprocessor-based Personal Computer systemBlock diagram and description of function of each blockHow the memory and I/O system of PC functionThe way that data are stored in the memory
Numeric data : integers, floating-point, BCDAlphanumeric : ASCII
Chapter 1 Introduction to the Microprocessor and Computer 3
1-1 A historical BackgroundThe mechanical age
abacus : 500 B.C.
calculator(with gears and wheels) : Pascal
The Electrical ageHollerith machine(1889):12-bit code on punched card
ENIAC(Electronics Numerical Integrator and Calculator) :
1946, Moore school of EE at Univ. of Pennsylvaniafirst general-purpose, programmable electronic computer17,000 vacuum tube, 500 miles of wire, 6000 switchesabout 100,000 operations per second, 30 tonshardware programmable : rewiring, switchinglife of vacuum tube(3000 hours) : maintenance
Chapter 1 Introduction to the Microprocessor and Computer 4
Stored Program concept(machines): Dr. John von Neumann
program instruction should be stored in memory unit, just like the data
EDVAC(Electronic Discrete Variable Automatic Computer):1952
UNIVAC(Universal Automatic Computer) :delivered to Bureau of Census(1951), CBS(1952)
Bipolar Transistor : 1948 by William Shockley, John Bardeen, Walter H. Brattain at Bell labs(1956, Novel physics award)
2nd-Generation Computer : TRIBM : 7070/7090(1958), 1401(1959)
mainframe : describe CPU portion of computer
mainframe computer : designed to handle large volumes of data while serving hundreds of users simultaneously
built on circuit boards mounted into rack panels(frame)
Chapter 1 Introduction to the Microprocessor and Computer 5
Integrated Circuit : 1958 by Jack Kilby of Texas Instruments and Dr. Robert Noyce of Fairchild Semiconductor
digital IC(RTL, register-to-transistor logic) : in the 1960s
3rd-Generation Computer : ICIBM : 32-bit 360 series(1964)
minicomputer : low-cost, scaled-down mainframeDEC : PDP-8(Programmed Data Processor)
INTEL(Integrated Electronics) : 1968Robert Noyce and Gorden Moore
4000 family : 1971.11.154001 : 2K ROM with 4-bit I/O port
4002 : 320-bit RAM with 4-bit output port
4003 : 10-bit serial-in parallel-out shift register
4004 : 4-bit processor
Chapter 1 Introduction to the Microprocessor and Computer 6
Programming Advancementsmachine language – binary code
assembly language – mnemonic code : UNIVAC
high-level programming language
FLOW-MATIC : 1957 by Grace Hopper
FORTRAN(FORMular TRANslator) : 1957, IBM
COBOL(Computer Business Oriented Language)
RPG(Report Program Generator)
BASIC, C/C++, PASCAL, ADA
Visual BASIC
Chapter 1 Introduction to the Microprocessor and Computer 7
The microprocessor age4004(1971, world’s 1st) : 4-bit, P-channel MOSFET technology
4096 4-bit(nibble) wide memory, 45 instructions, 50KIPs
8008(1972, extended 8-bit version of 4004, 16Kbytes)
8080(1973, 1st modern 8-bit) :
2.010-6sec, TTL-compatible, 64K bytes memory
one of 1st Microcomputer : MITS Altair 8800, Kit, 1975
8085(1977, 1.3s, internal clock generator & system controller)
The modern microprocessor16-bit : 8086(1978), 8088(1979)
IBM sold the idea of a Personal Computer : 1981.8, 8088
32-bit : 80386, 80486
64-bit : pentium ~
Chapter 1 Introduction to the Microprocessor and Computer 8
Microcontroller : hidden computer, one chip microcomputera microprocessor with on-chip memory and I/O
Supercomputer :most powerful computer available at any given time
Cray-1 : ECL, 130 MFLOPS(millions of floating-point operations per second)
Parallel Processor : Gigaflops(GFLOPS)
hypercube : arrangement of processors in the form of an n-dimensional cube
DSP(Digital Signal Processor) : perform complex mathematical computations on converted analog data
Chapter 1 Introduction to the Microprocessor and Computer 9
RISC(Reduced Instruction Set Computer)a small(<128) no. of instructions
CISC(Complex Instruction Set Computer) a large no. of variable length instructions
multiple addressing modes
a small no. of internal processor registers
instructions that require multiple no. of clock cycle to execute
Intel’s i860 RISC processor(Cray on a chip)82 instructions, each 32 bits in length
four addressing modes
32 general-purpose registers
all instructions execute in one clock cycle
10
||||||
11
Chapter 1 Introduction to the Microprocessor and Computer 12
8086 (1978)20-bit address bus : 1M byte(1024Kbytes) memoryinstruction : over 20,000 variation
4004 : 45, 8085 : 246
A separate BIU and EU Fetch and Execute instruction simultaneously
16-bit Internal processor registerswith the ability to access the high and low 8 bits separately if desired
hardware multiply and divide built insupport for an external math coprocessor
perform floating-point math operations as much as 100 times faster than the processor alone via software emulation
13
8086 Architecture8 8
AH AL
BH BL
CH CL
DH DL
Segment registers
CS
DS
ES
SS
IP Instruction Pointer
FLAGS Flags
SP Stack Pointer
BP Base Pointer
DI Destination Index
SI Source Index
CXCount
DXData
16
AXAccumulator
BXBase
80386 Architecture8 8
AH AL
BH BL
CH CL
DH DL
FS
GS
3216
CS
DS
ES
SS
BX
16
EFLAGS FLAGS Flags
EIP IP Instruction Pointer
EBP BP Base Pointer
Source Index
ESP Stack Pointer
SI
SP
ESI
EDI Destination IndexDI
EDXDX
Data
ECXCX
Count
Segment Registers
EAXAX
Accumulator
EBX Base
Effective, Segment and Physical Addresses
Effective address (EA).Selects an address within a paragraph (64kb memory segment). Also called offset.
Segment address (SA).Defines the beginning of a 64Kb memory segment. Also called segment selectors.
Physical address (PA).Location in memory.PA = SA * 16 + EA
Default SegmentsSegment Offset DescriptionCS EIP Instruction addressSS ESP and EBP Stack addressDS EBX, EDI, ESI, 8 bit and 16 bit numbers Data addressES DI for string instructions String destination addressFS NONE General addressGS NONE General address
RegistersGeneral purpose registers.
There are eight 16/32 bits registers.They are used to hold operands for logical and arithmetic operations and to hold addresses.Access may be done in 8, 16 or 32 bits.
RegistersThere is no direct access to the upper 16 bits of the 32 bits registers.
Some instructions incorporate dedicated registers in their operations which allows for decreased code size, but it also restricts the use of the register set.
RegistersAX/EAX – Accumulator is used as a dedicated register by some arithmetic operation, and adjustment instructions.BX/EBX – Base index.CX/ECX – Count register used by the LOOP, REP, shift and rotate type instructions.
RegistersDX/EDX – Data register used to hold results of multiplication and part of the dividend before for a division instruction.BP/EBP – Base pointer.DI/EDI – Destination index, used by string instructions.SI/ESI – Source index used by string instructions.
RegistersIP/EIP – Instruction pointer which holds the address of the next instruction to be executed.SP/ESP – Stack pointer addresses the stack.
RegistersSegment registers.
There are six 16 bits registers (CS, DS,ES,FS,GS, and SS).They are used to hold the segment selector.Each segment register is associated with a particular kind of memory access.
RegistersOther registers.
EFLAGS controls certain operations and indicates the status of the 80836 (carry, sign, etc).Flags:
C – Carry.P – Parity. Count of ones in a number expressed as even or odd. It finds little use in today’s microprocessors.A – Auxiliary carry. Carry or borrow between bits 3 and 4. Used by instructions like DAA and DAS.
RegistersZ – Zero. If Z = 1 the result of a computation is zero.S – Sign. If S = 1 sign is negative.T – Trap. If T = 1 debugging is enabled. In this state the microprocessor interrupts the flow of the program to allow the user to check registers, memory, etc.I – Interrupt. If I = 1, the INTR pin is enabled. STI and CLI controls the state of the I flag.D – The direction flag selects if the DI or SI registers are incremented or decremented when an string instruction is used.O – Overflow.
Memory OrganizationSequence of bytes each with a unique physical address.Data types:
Byte.Word.Double word.
Memory Organization
Memory Organization
Chapter 1 Introduction to the Microprocessor and Computer 29
Chapter 1 Introduction to the Microprocessor and Computer 30
1-2 The microprocessor-based personal computer system
Bus : set of common connection that carry the same type of information(address, data, control)
Chapter 1 Introduction to the Microprocessor and Computer 31
Memory and I/O systemFig. 1-5 The memory map of the personal computer
Expanded Memory (EMS)XMS( 100000H~)High Memory Area(HMA, 100000~10FFEFH)Upper Memory Block (UMB,A0000~100000H )Transient Program Area (basic memory)
Chapter 1 Introduction to the Microprocessor and Computer 32
I/O space
I/O space : allows computer to access up to 64K different 8-bit I/O devices
I/O port address: addresses an I/O device
I/O devices : allow microprocessor to communicate between itself and outside world
Two major section~03FFH : reserved for system devices
~00FFH : components on main board
0100~03FFH : devices located on plug-in cards
0400F~FFFFH : for user
Fig. 1-9 I/O map of a PC
Chapter 1 Introduction to the Microprocessor and Computer 33
The Microprocessorµ(Central Processing Unit) : controls memory and I/O through a series of connections called busses
buses : select an I/O and memory device, transfer data between an I/O device or memory and microprocessor, and control the I/O and memory system
memory and I/O : controlled through instructions that are stored in the memory and executed by the microprocessor
performs three main tasks for computer system ;data transfer between itself and memory or I/O
simple arithmetic and logic operations
program flow via simple decisions
stored program concept(Von Neumann): has made microprocessor and computer system very powerful devices
Chapter 1 Introduction to the Microprocessor and Computer 34
Table 1-3 Simple arithmetic and logic operations
data : are operated upon from memory system or internal registers
data width : byte, word, doubleword
µ : contains numeric coprocessor(from 80486, floating point arithmetic)
Chapter 1 Introduction to the Microprocessor and Computer 35
Table 1-4 Decisions
Chapter 1 Introduction to the Microprocessor and Computer 36
Busbus : A common group of wires that interconnect components in a computer system (Fig. 1-10)
Address, Data , Control bus
Chapter 1 Introduction to the Microprocessor and Computer 37
Busaddress bus : requests a memory location from memory or an I/O location from I/O devices (Fig. 1-10, Table 1-5)
16-bit I/O address(port address, port no.) : 0000~FFFFH
data bus : transfer information between microprocessor and its memory and I/O address space (Fig. 1-10)
advantage(wider data bus) : speed in application that use wide data (Fig. 1-11)
control bus : contains lines thatselect the memory and I/O
cause them to perform a read or write operation
MRDC. MWTC, IORC, IOWC
memory read : send memory an address through address bus, send MRDC, read data through data bus
Chapter 1 Introduction to the Microprocessor and Computer 38
Chapter 1 Introduction to the Microprocessor and Computer 39
Chapter 1 Introduction to the Microprocessor and Computer 40
Chapter 1 Introduction to the Microprocessor and Computer 41
1-4 Computer Data Formats
ASCII, BCD, signed and unsigned integer, real
ASCII(American Standard Code for Information Interchange)Alphanumeric character, 7-bit code
Chapter 1 Introduction to the Microprocessor and Computer 42
8-bit ASCII code = parity bit + 7-bit ASCIIextended ASCII character set
some foreign letters and punctuation, Greek characters, mathematical characters, box-drawing characters, and other special characters
Chapter 1 Introduction to the Microprocessor and Computer 43
unicode(16-bit) : windows-based application0000H~00FFH : standard ASCII code
0100H~FFFFH : all world-wide character sets
ASCII data : by using special directiveDefine Byte(s):DB, BYTE – surrounded by apostrophes(‘)
Chapter 1 Introduction to the Microprocessor and Computer 44
Binary-Coded Decimal(BCD) Datapacked BCD data : stored as two digits per byte
unpacked BCD : stored as one digit per byte
Chapter 1 Introduction to the Microprocessor and Computer 45
Byte-Sized Dataunsigned and signed integersunsigned no. : 0 ~ 255(00H ~ FFH)signed no. : -128 ~ +127(80H ~ 7FH)
Chapter 1 Introduction to the Microprocessor and Computer 46
Byte-Sized Data
Chapter 1 Introduction to the Microprocessor and Computer 47
Byte-Sized Data
Chapter 1 Introduction to the Microprocessor and Computer 48
Word-Sized Datalittle endian : least significant byte – lowest-no. memory
big endian
Chapter 1 Introduction to the Microprocessor and Computer 49
Word-Sized Datasigned and unsigned word-sized data define word(s) directive : DW, WORD
1000H : displayed by 1000, actually stored as 00 10
Chapter 1 Introduction to the Microprocessor and Computer 50
Double Word-Sized Data32 bit(4 byte) no.
Chapter 1 Introduction to the Microprocessor and Computer 51
Double Word-Sized Datadefine doubleword(s) directive : DD, DWORD
Chapter 1 Introduction to the Microprocessor and Computer 52
Real Number(Floating-point Number)single-precision : 4 byte(32 bit)
double-precision : 8 byte(64 bit)
Chapter 1 Introduction to the Microprocessor and Computer 53
Single Precision
sign-bit, 8-bit exponent, 24-bit fraction(mantissa)
Mantissa : implied(hidden) one-bit + 23-bit
1st bit of normalized real no.
Biased exponent127(7FH) : -126 ~ +127 → 1 ~ 254
Exceptione=255, m=0 : infinity
e=0, m=0 : zero
e=255, m≠0 : not a no.
e=0, m≠0 : denormalized
Chapter 1 Introduction to the Microprocessor and Computer 54
Single Precision
Chapter 1 Introduction to the Microprocessor and Computer 55
Real Numbersingle precision : DD, REAL4
double precision : DQ(define quadword), REAL8
Chapter 1 Introduction to the Microprocessor and Computer 56
1–4 COMPUTER DATA FORMATS
Successful programming requires a precise understanding of data formats.Commonly, data appear as ASCII, Unicode, BCD, signed and unsigned integers, and floating-point numbers (real numbers).Other forms are available but are not commonly found.
ASCII and Unicode Data ASCII (American Standard Code for Information Interchange) data represent alphanumeric characters in computer memory. Standard ASCII code is a 7-bit code.
eighth and most significant bit used to hold parity
If used with a printer, most significant bits are 0 for alphanumeric printing; 1 for graphics. In PC, an extended ASCII character set is selected by placing 1 in the leftmost bit.
Extended ASCII characters store: some foreign letters and punctuation Greek & mathematical charactersbox-drawing & other special characters
Extended characters can vary from one printer to another.ASCII control characters perform control functions in a computer system.
clear screen, backspace, line feed, etc.
Enter control codes through the keyboard.hold the Control key while typing a letter
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. For complete information on Unicode, visit: http://www.unicode.org
BCD (Binary-Coded Decimal) Data
The range of a BCD digit extends from 00002 to 10012, or 0–9 decimal, stored in two forms:Stored in packed form:
packed BCD data stored as two digits per byte;used for BCD addition and subtraction in the instruction set of the microprocessor
Stored in unpacked form:unpacked BCD data stored as one digit per bytereturned from a keypad or keyboard
Applications requiring BCD data are point-of-sales terminals.
also devices that perform a minimal amount of simple arithmetic
If a system requires complex arithmetic, BCD data are seldom used.
there is no simple and efficient method of performing complex BCD arithmetic
Byte-Sized Data Stored as unsigned and signed integers.Difference in these forms is the weight of the leftmost bit position.
value 128 for the unsigned integerminus 128 for the signed integer
In signed integer format, the leftmost bit represents the sign bit of the number.
also a weight of minus 128
Figure 1–14 The unsigned and signed bytes illustrating the weights of each binary-bit position.
Unsigned integers range 00H to FFH (0–255)Signed integers from 128 to 0 to + 127.Negative signed numbers represented in this way are stored in the two’s complement form.Evaluating a signed number by using weights of each bit position is much easier than the act of two’s complementing a number to find its value.
especially true in the world of calculators designed for programmers
Word-Sized Data 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.
Figure 1–15 The storage format for a 16-bit word in (a) a register and (b) two bytes of memory.
Figure 1–16 The storage format for a 32-bit word in (a) a register and (b) 4 bytes of memory.
Alternate method is called the big endian format.Numbers are stored with the lowest location containing the most significant data.Not used with Intel microprocessors.The big endian format is used with the Motorola family of microprocessors.
Doubleword-Sized Data Doubleword-sized data requires four bytesof memory because it is a 32-bit number.
appears as a product after a multiplicationalso as a dividend before a division
Define using the assembler directive define doubleword(s), or DD.
also use the DWORD directive in place of DD
Real Numbers Since many high-level languages use Intel microprocessors, real numbers are often encountered.A real, or a floating-point number contains two parts:
a mantissa, significant, or fractionan exponent.
A 4-byte number is called single-precision.The 8-byte form is called double-precision.
Figure 1–17 The floating-point numbers in (a) single-precision using a bias of 7FH and (b) double-precision using a bias of 3FFH.
The assembler can be used to define real numbers in single- & double-precision forms:
use the DD directive for single-precision 32-bit numbers use define quadword(s), or DQ to define 64-bit double-precision real numbers
Optional directives (導引 ) are REAL4, REAL8, and REAL10.
for defining single-, double-, and extended precision real numbers