Now that we’ve described the CPU, primary memory, and registers, let’s see how these elements work together to process an instruction. The processing of a single instruction is called a machine cycle.
A machine cycle has two parts: an instruction cycle (I-cycle) and an execution cycle (E-cycle). During the I-cycle, the control unit fetches a program instruction from primary memory and prepares for subsequent processing.
During the E-cycle, the data are located and the instruction is executed. Let’s see how this works in a little more detail, using a simple addition as an example.
ADVERTISEMENTS:
1. I-cycle :
1. The control unit fetches from primary memory the next instruction to be executed.
2. The control unit decodes the instruction.
ADVERTISEMENTS:
3. The control unit puts the part of the instruction that shows what to do into the instruction register.
4. The control unit puts the part of the instruction that shows where the associated data are located into the address register.
2. E-cycle :
5. Using the information in the address register, the control unit retrieves data from primary memory and places them into the storage register
ADVERTISEMENTS:
6. Using the information in the instruction register, the control unit commands the ALU to perform the required operation.
7. The ALU performs the specified operation, adding together the values found in the storage register and in the accumulator.
8. The result of the operation is placed back into the accumulator destroying the value of that was there previously.
All this may seem like an extremely tedious process, especially when a computer must go through thousands, millions, or even billions of machine cycles to process a single program fully. But computers are very fast.
In the slowest of them, cycle times are measured in milliseconds (thousandths of a second). In others, they are measured in microseconds (millionths of a second). In the fastest computers, they are measured in nanoseconds (billionths of a second (or in picoseconds (trillionths of a second).