440 likes | 634 Views
CPU. The Central Processing Unit. Computer Diagram. CPU. Cache. Peripheral Storage Disk Tape CD/DVD Network. HCI Keyboard Display Pointers. Bus. Memory. How the Pieces Connect. The CPU connects to all other pieces of the computer through the Bus Memory is short term storage
E N D
CPU The Central Processing Unit
Computer Diagram CPU Cache Peripheral StorageDiskTape CD/DVD Network HCIKeyboardDisplay Pointers Bus Memory
How the Pieces Connect • The CPU connects to all other pieces of the computer through the Bus • Memory is short term storage • Peripherals (such as disk) are used for long term storage • The bus is a group of communication lines between the CPU and other pieces
CPU and Cache • The CPU has increased in speed much faster than anything else • The cache is a short term memory that keeps recently used items • It keeps the CPU busy and off the bus
Two Principal Sections of CPU • Arithmetic/Logic Unit • Performs arithmetic (addition, subtraction, multiplication and division) • Compares two items of data to determine if equal, or which is larger (works on numbers or letters) called a logic operation • Control Unit • Directs the flow of electronic traffic (coordinates computer's operation)
Control Unit • Controls ALU and Memory • Fetches and decodes instructions • Directs data transfers • Has the ALU do operations • Contains two important registers: • Program Counter (PC) • Instruction Register (IR)
Registers • Special temporary storage locations that act as high-speed staging (loading) areas • Part of the CPU, not main memory • Usually under direction of the control unit • Several types are available • Each has a different purpose • Some are accessible to programmer
CPU Control Unit Arithmetic Logic Unit Registers Registers
Register Types • Program Counter • Instruction Register • Status • Accumulator • Address • Segment • Index • General purpose • Stack Pointer • Floating point
The IBM 360/370 • 16 General Purpose 32 bit • All integer arithmetic • Indexing (except R0) • Even/Odd pairs for 64 bit • Program Status Word • Program counter and status register • 8 Floating point registers • Lots of inaccessible registers
Intel 8080 • An 8 bit processor with 16 bit address space (64K) • Itself an extension of 8008 and 4040 • Four 16 bit registers each partitioned into a High and Low 8 bit • AX (AL and AH) does most of arithmetic • BX is the Base register • CX is Count register • DX is Data register • Connects to AX for double length • Stack Pointer
Intel 8086 • Four 16 bit general purpose (AX-DX) • AX evolved from accumulator • Pointer and index • Stack Pointer (SP) • Base Pointer (BP) • Source Index (SI) • Segment • Code Segment • Stack Segment • Data Segment • Extra Segment
8086 Segments Code Segment Code 64K Data Segment Stack Segment Data 1 M 64K Stack Pointer Stack 64K
Intel 80386 through Pentiums • Serious attempt to maintain upward compatibility • Each model adds capabilities • Register sizes increase to 32 bit • AX becomes low order 16 bits of the 32 bit EAX • The maximum addressable memory increases • Virtual memory has hardware support
Memory • Also called "main memory" or Primary (internal) storage • Closely associated with CPU but physically separated • Holds or stores • Data and program instructions awaiting processing • Intermediate results • Processed output (ready to be transmitted to secondary storage or output device
Memory Characteristics • Volatile • Loses value when power is removed • Has no history • Only the last value is retained • Always has a value • May be unknown • Each cell has a numbered address
How can a piece of data be retrieved from memory? • Control Unit finds instructions or data by the use of addresses • Analogy - departmental mail boxes • Two things to note • One item only may be stored • Addresses are always numbers • Tells where stored
Memory Commands • Memory interprets two commands: • Read and Write • Read requires an address • Returns the contents • Write requires an address and a value • Changes the address to contain the value • Unit is one byte (8 bits) • Several units may be ganged together • 2, 4, 8 bytes
Memory Example 05 0 135 1 20 2 42 3 0 4 180 5
Memory • Short term storage of data occurs here • All data must be represented in memory • The organization of memory determines the data representation
Data Representation • Binary - number system with two states • Two states (On or Off) • Bits (BInary digiTS) each 0 or 1 • Organization (small to large) • Bit (individual 1 or 0) • Byte (made up of 7 or 8 bits and represents a character) • Word (how much a computer can handle at one time - multiple bytes)
Byte • Represents a single character of data • 7 or 8 bits (depending on code) • Used to indicate machines' storage capacity • Kilobyte (KB) - equal to 1024 bytes • Megabyte (MB) - equals 10242 bytes = 1,048,576 • Gigabyte (GB) - equals 10243 bytes • Terabyte (TB) - equals 10244 bytes • Petabyte (PB) - equals 10245 bytes
Word • The number of bits that constitutes a common unit of data • Length varies by computer • Common word lengths • 16 bits (micros, 286 and before) • 32 bits (Pentiums, Power PC, mainframes) • 64 bits (newer AMD micros, supercomputers)
Digitization • Nothing can be processed by a computer unless it can be converted to digital representation • Graphics – pixels • Compression • Sounds – sampling • Music - MIDI • Characters – character codes
Character Codes • Mechanism to represent character data numerically • BCD • EBCDIC • ASCII • UNICODE
Machine Cycles • Series of operations involved in the execution of a single machine-level instruction • System clock - timing mechanism that governs transmission of instructions and data • Also known as Fetch-Execute Cycle • Made up of two parts: I-cycle and E-cycle • Microcode - mechanism to tailor the instruction set
Fetch-Execute cycle: I-cycle • Take program counter and fetch next instruction from memory • Decode the particular instruction • Increment program counter to point at next instruction • Fetch operands • This part called I-cycle or I-time
Fetch-Execute Cycle: E-cycle • Execute the instruction • Store results (if needed) • Go back to beginning and do it again • This is called the E-cycle or E-time
Machine Instructions • Arithmetic • Comparison • Input and Output • Jumps
Processing Speeds of cycle times • Milliseconds • Thousandths of a second • Microseconds • Millionths of a second • Nanoseconds • Billionths of a second • Picoseconds • Trillionths of a second
Speed Ratings • Older micros rated in megahertz MHz • One MHz represents a million clock ticks per second • Original Apple ran at 1 MHz • Original IBM PC ran at 4.77 MHz • Today - 2000 to 4500 • 2000 MHz is 2 GHz • In mainframes rated in mips • One mip equals million instructions per second • In supercomputers rates in mflops • One mflop equals million floating-point operations per second
Instruction Format • There are various components in each machine language instruction • Operation code • Defines which instruction • Operands • May be implied • Register • Immediate data • Memory location • Other things • Masks or flags • Lengths
Instructions sizes • Instructions may be multiple sizes or single sizes • Single size • Easier to interpret • Wastes bits • Multiple sizes • More complicated CPU design • Better packing in memory