touque.ca > Education Commons > IB > Topics > 2

Inside the CPU

The CPU contains an arithmetic-logic unit (ALU), where arithmetic functions are carried out, a control unit, which sends control signals to the memory and peripherals, the system clock, which keeps the various components in correct time with each other, and several registers, which are special memory locations that each have a specific purpose.

Registers

The registers inside a typical processor are:

The Fetch-Execute Cycle

When the processor fetches and executes an instruction, it makes use of the registers. The steps that the CPU follows for the assembly language instruction LDA A3 (Load the number at address A3 into the accumulator) are:

  1. First, the program counter is read for the address of the next instruction to be executed.
  2. The contents of the program counter are copied to the memory address register.
  3. The required address in main memory is found, and the contents of that are copied to the memory data register.
  4. The program counter is incremented by one, since the old value has already been fetched.
  5. The contents of the memory data register are copied to the current instruction register.
  6. The instruction in the current instruction register is decoded. The instruction is "load the contents of memory location A3 into the accumulator".
  7. A3 is copied into the memory address register, and the correct memory location is found. The contents of A3 are copied to the memory data register, and then into the accumulator. The instruction has been executed.
  8. The program counter is read for the next instruction to be executed …

This process may seem very slow and cumbersome, but a modern computer can do this cycle millions of times per second.

Source: Machine Level Structure, retrieved 2013-08-08. Licensed under the Creative Commons Attribution/Share-Alike Licence.

touque.ca > Education Commons > IB > Topics > 2

[This page last updated 2020-12-23 at 13h10 Toronto local time.]