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
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
An instruction, stored in the memory, is fetched into the control unit
by supplying the memory with the address of the instruction.
The instruction is decoded by the control unit in order to find the
sequence of operation necessary to execute it.
Any data necessary for the instruction is fetched from the memory by the
control unit and stored in the datapath.
The operation is performed within the datapath.
The result of the operation is possibly written to the memory.
Add the contents of memory location 1 to location 2 and put the result
in location 0.
Address of the instruction is sent to memory with a READ control signal
Instruction is fetched into control unit
Instruction is decoded.
Address 1 sent to memory with READ signal
Data fetched from memory location 1 into the datapath
Address 2 sent to memory with READ signal
Data fetched from memory location 2 into the datapath
ADD operation is sent to ALU in datapath
Address 0 sent to memory with WRITE signal
Result sent from datapath to memory and written to location 0.
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.