4. Special purpose registers (2)

CPU contains a set of registers

The diagram above shows that the CPU contains a number of registers in order to process data and to follow program instructions.

Some specialist ones include

Instruction Register

This holds the current instruction to be executed, having been fetched from memory.

Program Status Word (PSW)

The PSW has a number of duties all rolled into one.

  • The Arithmetic Logic Unit compares two data items together, and it arranges for the result of that comparison to appear in this register i.e. the result of 'greater than' etc.
  • The PSW also indicates if program conditions have been met that would lead to a jump to a different part of the program. In programming terms this means the result of an IF statement. An IF statement is important in any programming language as it allows execution to jump from one set of instructions to another.
  • The PSW also holds error flags that indicate a number of problems that may have happened as a result of an instruction, such as 'overflow' which means a calculation has exceeded it allowed number range.

A commonly used term is 'flag'. This denotes a single binary bit within a register. They are often used to indicate a true or false condition.

Memory Address Register

Remember that data and program instructions have to fetched from memory? The memory address register, or MAR, holds the location in memory (address) of the next piece of data or program to be fetched (or stored).

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: CPU registers

 

 

Copyright © www.teach-ict.com