Unformatted text preview:

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyFluency with Information TechnologyThird Editionby Lawrence SnyderChapter 9: Following Instructions: Principles of Computer Operation9-21-2Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyInstruction Execution Engines• What computers can do– Deterministically perform or execute instructions to process information– The computer must have instructions to follow• What computers can't do– Have no imagination or creativity– Have no intuition– Have no sense of irony, subtlety, proportion, decorum, or humor– Are not vindictive or cruel– Are not purposeful– Have no free will– Recent movies: Terminator, Matrix, AI9-31-3Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyThe Fetch/Execute Cycle• A five-step cycle:1. Instruction Fetch (IF)2. Instruction Decode (ID)3. Data Fetch (DF) / Operand Fetch (OF)4. Instruction Execution (EX)5. Result Return (RR) / Store (ST)9-41-4Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyAnatomy of a Computer• Computers have five basic parts or subsystems– Memory, control unit, arithmetic/logic unit (ALU), input unit, output unit9-51-5Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyMemory• Memory stores the program running and the data on which the program operates• Properties of memory:– Discrete locations. Each location consists of 1 byte.– Addresses. Every memory location (byte) has an address (whole numbers starting with zero).– Values. Memory locations record or store values.– Finite capacity. Limited size—programmers must remember that the data may not "fit" in the memory location.9-61-6Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyByte-Size Memory Location• A commonly used diagram of computer memory represents the discrete locations as boxes (1 byte each). • Address of location is displayed above the box. • Value or contents of location is shown in the box.9-71-7Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley9-81-8Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyMemory (cont'd)• 1-byte memory locations can store one ASCII character, or a number less than 256 (0 - 255)• Programmers use a sequence of memory locations together, ignoring the fact that they all have different addresses– Blocks of four bytes are used as a unit so frequently that they are called memory "words"9-91-9Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyRandom Access Memory (RAM)• "Random access" means the computer can refer to (access) the memory locations in any order• Often measured inmegabytes (MB) – millions of bytes or gigabytes (GB) – billions of bytes• Large memory is preferable because there is more space for programs and data (which usually equates to less I/O)9-101-10Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyControl Unit• Hardware implementation of the Fetch/Execute Cycle• Its circuitry fetches an instruction from memory, decodes the instruction, and fetches the operands used in it– A typical instruction might have the formADD 4000, 2000, 2080 op dest, src1, src2– This instruction asks that the numbers stored in locations 2000 and 2080 be added together, and the result stored in location 4000 [4000] = [2000] + [2080]– Data/Operand Fetch step must get these two values and after they are added, Result Return/Store step will store the answer in location 40009-111-11Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley9-121-12Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyArithmetic/Logic Unit (ALU)• Performs the math• Generally does the work during the Instruction Execute step of the Cycle• A circuit in the ALU can add two number• There are also circuits for multiplying, comparing, etc.• Instructions that just transfer data usually don't use the ALU• Data/Operand Fetch step of the Cycle gets the values that the ALU needs to work on (operands)• When the ALU completes the operation, Return Result/Store step moves the answer from the ALU to the destination memory address specified in the instruction9-131-13Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyInput Unit and Output Unit (I/O)• The wires and circuits through which information moves into and out of a computer• The peripherals: Connect to the computer input/output ports. They are not considered part of the computer, but specialized gadgets that encode or decode information between the computer and the physical world.9-141-14Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyThe Peripherals• Keyboard encodes keystrokes we type into binary form for the computer• Monitor decodes information from the computer's memory and displays it on a lighted, colored screen• Disks drives are used for both input and output—storage devices where the computer puts away information when it is not needed, and can retrieve from when it is needed again9-151-15Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyA Device Driver for Every Peripheral• "Dumb" devices provide basic physical translation to or from binary signals.• Additional information from the computer is needed to make it operate intelligently.• e.g., computer receives information that user typed shift and w at the same time. It converts to a capital W. The software that converts is called the device driver.9-161-16Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyThe Program Counter: The Pc's PC• How does the computer determine which step to execute next?• Address of the next instruction is stored in the control part of the computer. It is called the program counter (PC).• Because instructions use 4 bytes of memory, the next instruction must be at PC + 4, 4 bytes further along in the sequence (in general).• Computer adds four to the PC, so when the F/E Cycle gets back to Instruction Fetch step, the PC is "pointing at" the next instruction.9-171-17Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyBranch and Jump Instructions• The instruction may include an address to go to next. This changes the PC, so instead of going to PC +4


View Full Document
Download Principles of Computer Operation
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Principles of Computer Operation and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Principles of Computer Operation 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?