DMA 
 ALU

Operations

After the computer is started, it automatically performs the various operations (instructions) described in the program. Each type of CPU has its own repertoire of instructions that can be executed, the instruction set, defined by the manufacturer of that particular central processor.

In general, an instruction consists of two parts, an opcode and zero or more operands. The types of operations include arithmetic and logical operations, data copying, program control, and special instructions (such as CPUID and others).

For running a program the system uses a so-called Von-Neumann cycle, also often referred to as the instruction cycle:

  • Fetch (and Decode): The CPU must first read an instruction from memory. The instruction is a binary encrypted word that defines which operation is to be performed.
  • Increment PC: Find next instruction.
  • Execute: Control signals (read, write, in, out) are activated and the necessary operations are performed within the CPU (for example, an arithmetic operation).

Retrieval of an instruction, decoding and execution is provided by the control unit in the CPU. Timing here refers to the fact that the control unit has to take the various actions at the right time. For example, decoding can not begin before an instruction from memory is read.

The connection to the data bus is via the databus buffer (DBB). The buffer is included to give the signals sufficient power to reach the other system parts (memory, input, output). The same goes for the address bus buffer. Via a special type register, the address bus buffer (ABB), address information is placed on the address bus of the system.

The instructions are placed in the memory part reserved for programs in the order in which they are to be executed. Once the first instruction is known, the following instruction can always be found with a simple counter. This counter is usually called the Program Counter (PC). The PC always contains the address of the following instruction to be performed. During the running instruction cycle, the controller must increase the PC by 1 to ensure that the next instruction is read at the beginning of the next cycle.

To avoid bus conflicts, the PC is held in a separate special type register in the CPU.

Registers consist of a number of D type flip flops. A D flip flop can be set by means of a clock signal that corresponds to the state of the D line when the clock line becomes active.

A two-part instruction with an operation code and operands is very common. The first part, the opcode (OC), determines what action the CPU will perform, the second part, the operand, specifies the data on which the operation is performed.

Data is located in a different part in memory than the program. Hence the operand of an instruction is often an address that refers to where the data is to be found.

The opcode of an instruction is clocked into a special type register, the instruction register (IR), the address of the operand is clocked into a operand address register (OAR) in the CPU.

Suppose an 8-bit computer (memory locations are 8-bit words and the data bus is 8 bit wide) with a 16 bit address bus. Then, up to 64K different memory locations can be addressed by the CPU.

The opcode and the address of the operand can be accommodated in the instruction by using multiple memory locations. In this case three: an 8-bit location (1 byte) for the 8-bit opcode and and two 8-bit locations (2 bytes) for the 16-bit address. This means the CPU must read three locations from memory to retrieve the entire instruction. And after each reading cycle, the PC must be incremented by 1. After the last byte is read and the PC is incremented, the PC points to the opcode of the following instruction.

For most 8-bit computers there are 1, 2, and 3-byte instructions. A single 8 bitter even has 4-byte instructions. With 16-bit, 32-bit and 64-bit microprocessors, longer instructional formats exist.

In the example of an 8-bit computer with 16-bit addresses, the operand address (OA) is split in two parts: the least significant byte of the OA (LSB OA) and the most significant byte of the OA (MSB OA).

Execution can not start unless the entire instruction has been read. That knows the control unit by decoding the opcode. Indeed, the opcode has a record of which instruction it takes and thus how many bytes the complete instruction is. It is therefore logical that the first byte of the instruction is always the opcode. Then follow any additional bytes.