Saturday, February 23, 2013

The Machine Cycle

The Machine Cycle

You have probably heard of computer programming languages such as COBOL, BASIC, and RPG. There are dozens of programming languages in common usage. However, in the end, COBOL. BASIC, RPG. and the other languages are translated into the only language that a computer under­stands-its own machine language. Machine-language instructions arc represented inside the computer as strings of binary digits. up to 64 digits in length. An overview of machine languages and of some of the more popular higher-level programming languages is provided in new topics , "Programming Concepts and Languages .

Every machine language has a predefined format for each type of in­struction. The relative position within the instruction designates whether a sequence of characters is an- operation code, an operand, or irrelevant The typical machine language will have from 50 to 200 separate operation (odes. The operation code, or op-code, is that portion of the fundamental computer instruction that designates the operation to be performed (add, compare, retrieve data from RAM, and so on). The operand is that portion of the instruction that designates data or refers to one or more addresses in RAM in which data can be found or placed. The op-code determines whether the operand contains data. addresses, or both. The following ex­ample illustrates the format of typical machine-language instructions. In this example, the AC op-code tells the computer to add the amount stored 31 memory address 11011101 to whatever is in the accumulator.



(add to accumulator)


(a RAM address)

Every computer has a machine cycle. The following actions take place during the machine cycle (see Figure 5):

Fetch instruction. The next machine-language instruction to be executed too-code and operand) is retrieved, or 'fetched." from RAM or cache memory and loaded to the instruction register in the control unit (see Figure 4).

• Decode instruction. The instruction b decoded and interpreted .

• execute instruction. Using whatever processor resources are needed (primarily the arithmetic and logic unit), the instruction b executed.

• Place result ill memory. The results arc placed in the appropriate memory position (usually RAM or a register in the arithmetic and logic unit called the accumulator). (See Figure 4)

Inside the computer-14_03

The speed of a processor is sometimes measured by how long it takes to complete a machine cycle. The timed interval that comprises the machine cycle is the total of the instruction time, or I-time, and the execution time, or E-time (see Figure 5). The I-time is made up of the first two activities of the machine cycle-fetch and decode the instruction. The E-time comprises the last two activities of the machine cycle-execute the instruction and store the results.