(This is the older material - click here - for current specification content)

4. Registers

The last page about the Von Neumann architecture made a passing reference to registers. But what are these registers?

A register is a discrete memory location within the CPU designed to hold temporary data and instructions

.A modern CPU will hold a number of registers. There are a number of general purpose registers that the programmer can use to hold intermediate results whilst working through a calculation or algorithm.

Then there are special-purpose registers designed to carry out a specific role. Each of these registers are given a name so that the programmer can write their software code to access them. Different manufacturers of CPU chips call them by different names (which makes life interesting for a professional programmer!)

But generically these include

Program Counter (PC)

This holds the address in memory of the next instruction.

For example if the program counter has the address 305 then the next instruction will be at location 305 in main memory (RAM). When a program is running, the program counter will often just be incrementing as it addresses one instruction after the other, e.g. 305, 306, 307. However, the instructions will often modify the next address, for example, 305 becomes 39. What has happened is called a 'jump instruction'. This is how the software programmer will cause different parts of his code to run depending on some condition e.g. a conditional IF statement. It is also how an interrupt routine is serviced. The program counter will be loaded with the starting address of the interrupt routine.

 

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

Click on this link: Program Counter

 

Current Instruction Register (CIR)

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 (MAR)

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: Memory Address Register

 

Memory Buffer Register or Memory Data Register

When the data or program instruction is fetched from memory, it is temporarily held in the 'Memory Buffer Register' or MBR for short sometimes also called the Memory Data Register or MDR

A 'buffer' is a commonly used computer term to describe memory designed to hold data that is on its way to somewhere else.

A memory buffer is a bit like the buffers on a train carriage, as the carriages connect with each other, the buffers will soak up the force. In memory, a bunch of data is absorbed quickly, then released at a controlled rate.

Registers in a CPU

 

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

Click on this link: Buffer memory

 

 

Copyright © www.teach-ict.com