Computer Architecture

From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

(image on right)

Prerequisites[edit]

Introduction[edit]

Computers are amazing devices and play a significant role in nearly everything that we do. While seemingly complex, the basic architecture of a computer is straight-forward. In this experience, we'll take a look at memory, the central processing unit, the arithmetic logic unit, data and address buses, and examine how a computer processes instructions.

Overview[edit]

   Computer Architecture.png

Memory[edit]

DDR RAM-2
Memory Word

Bit Width[edit]

Computer memory, sometimes referred to as primary storage, is divided into units called words. Each word consists of multiple bits (binary digits). Each bit is preserved through the use of a Flip Flop, such as the D-type Flip Flop described in W1018 SR Latch. The bits are ordered into a fixed-size piece of data (a word) and accessed as a single unit. In the image each word consists of eight bits, and we refer to this as the bit-width of the machine. (For example, many of you may have "64-bit machines", the 64 bits refers to the bit-width of the words in memory and the ability of the processor to handle each word as a single unit.)

Addressable Memory[edit]

Accessing memory requires that each and every word has a unique address, which we call the memory address. Addresses are generally linear, beginning at zero, and increase for each available word in memory. In the image the address is shown on the left-hand side as "4010".

Memory Addresses

The image on the left shows how addresses increase sequentially. Three words are shown, with addresses (in hexadecimal) of 4010, 4011, and 4012.

The Address Bus[edit]

Memory Address Bus

The CPU accesses one word of memory at any given time. In order to specify which of the many words should be accessed, the address is specified on the address bus. The bus specifies, in binary, the address in which we are interested. Each "wire" is either high or low. In combination, the high/low values on the bus indicate the address. As usual, the least significant bit is labeled as 0 (A:0).

The Data Bus[edit]

Memory Data Bus

While the address bus specified the address in which we are interested, it is the data bus which actually moves the data from/to primary storage. Note that in the case of our example, there are sixteen bits required on the address bus to specify the word in which we are interested, because this computer can access words. The data bus, however, is only eight bits wide, because each word contains exactly eight bits.

The Read/Write Flag[edit]

The data bus can either transfer data to main memory or from main memory, but not both at the same time. In order to specify the direction, we use a read/write flag. (A flag is a term that generally represents exactly one of two possible states.)

Memory Read/Write Flag


The Arithmetic Logic Unit[edit]

The Arithmetic Logic Unit, often abbreviated as ALU, is responsible for accepting one or two operands, performing either an arithmetic or logical operation, and then providing the result. These calculations are performed using the logic gates which we've previously studied, such as AND, OR, NOT, XOR, and binary addition.

   Arithmetic Logic Unit

A register is a quickly accessible location which can be directly accessed in a process which is much faster than accessing main memory. In the case of the ALU, there are two input registers and one output register. In order to perform an operation the input operands are sent to the input registers (Register A and Register B), and, after a brief propagation delay, the output is made available in the Output Register.

The Central Processing Unit[edit]

Central Processing Unit

The Central Processing Unit, often abbreviated as CPU, is responsible for executing the instructions of a program, including those of the operating system.

The Instruction Cycle[edit]

Digital computers generally follow a standard cycle, called the Fetch-Decode-Execute cycle. It is the basic operational process of a computer. From boot-up until shut down, the CPU (central processing unit) will retrieve a program instruction from memory, determine what the instruction means and how to fulfill that instruction, and then execute the necessary steps before repeating the cycle.

Fetch[edit]

The next instruction is fetched from the memory address that is currently stored in the program counter (PC). The instruction is stored in the instruction register (IR). The PC is then incremented.

Decode[edit]

The instruction is decoded by the instruction decoder. If additional memory accesses are required to read operands, it happens here.

Execute[edit]

The instruction is executed by the control unit which sends a sequence of signals to the relevant function units of the CPU such as reading values from registers, passing them to the ALU to perform mathematical or logical functions, and writing the results back to a register. The control unit may accept input from the ALU and update the program counter to a different address if so indicated before continuing to the next cycle.


Key Concepts[edit]

References[edit]