Lecture 7

Data and Instructions

Schematic diagram of a simple computer

The CPU communicates with the memory using buses. A bus is just a number of connections that can carry binary numbers in parallel.

The Data Bus carries Instructions and Data to and from the memory.

The Address Bus carries information about where in memory the data is coming from or going to.

The Control Bus is used to tell the memory which way data is going (read/write).

If A is the size (in bits) of the Address bus and W is the size of the data bus, then the memory can be thought of as a large array of locations. Each location holds W bits and there are 2A locations numbered from 0....2A-1.

Execution Cycle


Instruction Add the contents of memory location 1 to location 2 and put the result in location 0.

Execution Sequence

  1. Address of the instruction is sent to memory with a READ control signal
  2. Instruction is fetched into control unit
  3. Instruction is decoded.
  4. Address 1 sent to memory with READ signal
  5. Data fetched from memory location 1 into the datapath
  6. Address 2 sent to memory with READ signal
  7. Data fetched from memory location 2 into the datapath
  8. ADD operation is sent to ALU in datapath
  9. Address 0 sent to memory with WRITE signal
  10. Result sent from datapath to memory and written to location 0.

Instruction Sets

What is an instruction set

Each CPU will have a certain repertoire of instructions that it can decode and execute. This is called the instruction set of the CPU.

The instructions are coded in binary and a large number of them are required to execute a program. A program in this form is called a machine language or machine code program. All other computer languages must be translated into machine code before they can be run. The program used to perform translation to machine code is called the compiler.