Saturday, March 9, 2013

Registers

A register is a special-purpose storage location. The computer uses registers for temporary storage of instructions, data and addresses.

REGISTERS IN THE CONTROL UNIT

1 Program counter-also known as the sequence control register (SCR)

The program counter holds the address of the next instruction to be fetched. As soon as the instruction (or part instruction-see note above) has been fetched the value in the program counter is increased by 1, as the control unit normally fetches instructions one after another in the order in which they are stored (see Fig 2).

If the instruction executed causes a branch to an instruction in another part of the program, the value in the program counter is altered to the address of the new instruction.

2 Current instruction register

The current instruction register holds the instruction fetched from the store while it is being decoded and executed (see Fig 2).

Fig 2 The role of the current instruction register and the program counter

REGISTERS IN THE ARITHMETIC AND LOGIC UNIT

The registers in the arithmetic and logic unit are involved in the execution of instructions:

Accumulator

An accumulator is a register used to store values which are the subject of arithmetic or logical operations or of data transfers.

Examples of the use of an accumulator

1 If two numbers in locations A and B are to be added and stored in location C, instructions with the following functions will usually be fetched and executed:

(a) Load contents of location A into the accumulator.

(b) Add contents of location B to contents of the accumulator.

(c) Store contents of accumulator in location C.

2 If a character is to be printed out:

(a) A code for the character is loaded into the accumulator.

(b) The contents of the accumulator are transferred to a buffer ready for printing.