-->

How the CPU Executes Program Instructions

the CPU Executes Program Instructions
CPU

Program Instructions

Let us examine the way the central processing unit, in association with memory, executes a computer program. We will be looking at how just one instruction in the program is executed. In fact, most computer today can execute only one intruction at a time, though they execute it very quickly. Many personal computers can execute instructions in less than one-millionth of a second, whereas those speed demons known as super computers can execute instruction in less than one-billionth of a second.

Four steps for each instruction

Before an instruction can be executed, program insruction can be executed, program instructions and data must be placed in to memory from an input device or a secondary storage device ( the process is further complicated by the fact that, as we noted earlier, the data will probably make a temporary stop in a register ). once the necessary data and instruction are in memory, the central processing unit performs the following four steps for each instruction ;

  1. The control unit fetches (gets) the instruction from memory.
  2. The control unit decodes the instruction (decides what is means) and directs that the necessary data be moved from memory to the arithmetic/logic unit. These first two steps together are called instruction time, or I-time.
  3. The arithmetic/logic unit executes the arithmetic or logical instruction.That is arithmetic/logic unit is given control and perform the actual operation on the data.
  4. The arithmetic/logic unit stores the result of this operation in memory or in a registes, step 3 and 4 together are called execution time, of E-time.
The control unit eventually directs memory to release the result to an output device or a secondary storage device. The combination of -time and E-time is called the machine cycle. Each central processing unit has an internal clock that  produces pulses at a fixed rate to synchronize all computer operations. A single machine cycle instruction may be made up of a substantial number of subinstructions,each of which must take at least one clock cycle. Each type of central processing unit is designed to understsnd a spesific group of intructions called the instruction set. Just as there are many different languages that people understands, so each different type of CPU has an instruction set it understands.Therefore, one CPU-such as the one for a compacq personal computers-cannot understand the instruction set from another CPU-say, for a Macintosh.

Storage Locations and Addresses : How the Control Unit Finds Instructions and Data


It is one nothing to have instructions and data somrwhere in memory and quite another for the control unit to be able to find them. how does it do this ?

The location in memory for each instruction and each piece of data is identified by an address. That is , each location has an address numbers, like the mailboxes in front of an apartement house. and, like the mailboxes, the address numbers of the location remain the same, but the contents ( instruction sand data) of the location may change. That is, new instruction or new data may be placed in the locations when the old contents no longer need to be stored in memory. Unlike a mailbox, however, a memory location can hold only a fixed amount of data; an address can hold only one number or one word.

Figur below shows how a program manipulates data in memory. A payroll program, for example, may give instructions to put the rate of pay in location 3 and the number of hours worked in location 6. to compute the employee's salary, then, instructions tell the computer to multiply the data in location 3 by the data in location 6 and move the result to location 8. The chioce of locations is arbitrary-any locations that are not already spoken for can be used. Programmers using programming languages,however, do not have to worrry a bout the actual address numbers, because each data address is referred to by a name. The name is called a symbolic addres. In this example, the symbolic address names are Rate, hour, and Salary.

Address like mailboxes
Address like mailboxes




Sources ; computers tools for an information age H.L. Capron

0 Response to "How the CPU Executes Program Instructions"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel