1.1.1a Components

*The Arithmetic and Logic Unit; ALU, Control Unit and Registers (Program Counter; PC, Accumulator; ACC, Memory Address Register; MAR, Memory Data Register; MDR, Current Instruction Register; CIR). Buses: data, address and control: how this relates to assembly language programs.*

## Arithmetic Logic Unit

An ALU is a digital circuit used to perform arithmetic and logic operations. It is essentially a calculator, as all logical operations are performed using exploitation of numbers. It cannot decide what tasks to do itself, and is simply fed operations to execute by the control unit.

The output is loaded onto the accumulator.

It is used for the last part of the fetch-decode-execute cycle.

The most basic design of an ALU consists of two operand inputs, and one result output, and these buses are parallel. The opcode input is another parallel bus that conveys an operation selection code to the ALU, which is a number that specifies the desired operation, which is to be carried out on the operand inputs, e.g. addition.

Simpler ALUs follow smaller stages within the more complex operation, for example it would follow stages of simpler calculations to give the square root of a number. This is known as a calculation pipeline. Some ALUs also do this but under the direction of the control unit. This is known as iterative calculation.

Very complex ALUs are able to complete whole complex operations in one clock step. These tend to be a lot more expensive.

## Registers

### Memory Address Register

Holds the memory location of data that needs to be accessed. When reading from memory, data addressed by MAR is fed into the MDR (memory data register) and then used by the CPU. When writing to memory, the CPU writes data from MDR to the memory location whose address is stored in MAR.

### Memory Data Register

The register of a computer's control unit that contains the data to be stored in the computer storage (e.g. RAM), or the data after a fetch from the computer storage. It acts like a buffer and holds anything that is copied from the memory ready for the processor to use it. The MDR is a two-way register. When data is fetched from memory and placed into the MDR, it is written to go in one direction. When there is a write instruction, the data to be written is placed into the MDR from another CPU register, which then puts the data into memory.

### Current Instruction Register

The Current Instruction Register (CIR) is the part of the processor that holds the current instruction as it is being decoded or executed. After it is located by the Program Counter (See below), the instruction is sent through the data bus to the CIR.

### Accumulator

The accumulator is a register that is used to contain the results of an arithmetical or logical operation or to store data while it is being transferred.

### Program Counter

A program counter is a register in a processor which holds the address to the instruction, in the memory unit, that is currently being run. As each instruction is finished the program counter increments by 1 (i.e. memory address = 1, to memory address = 2) and the instruction at that address is run.

## Buses

### Address Bus

An address bus is a computer bus (a series of lines connecting two or more devices) that is used to specify a physical address. When a processor or DMA-enabled device needs to read or write to a memory location, it specifies that memory location on the address bus (the value to be read or written is sent on the data bus). The width of the address bus determines the amount of memory a system can address. For example, a system with a 32-bit address bus can address 232 (4,294,967,296) memory locations. If each memory location holds one byte, the addressable memory space is 4 GB.

### Data Bus

A data bus is a system within a computer or device, consisting of a connector or set of wires, that provides transportation for data. Different kinds of data buses have evolved along with personal computers and other pieces of hardware. A data bus can transfer data to and from the memory of a computer, or into or out of the central processing unit (CPU) that acts as the device's "engine." A data bus can also transfer information between two computers.

### Control Bus

The control bus is a physical channel that carries information. The control bus carries commands from the CPU and returns status signals from the devices. E.G. if the data is being read or written to the device the appropriate line will be active.