Skip to content

Computer Architecture

Computer architecture describes the programmer-visible organization of a computer: its instruction set, data representation, registers, addressing modes, memory system and input/output mechanism. Computer organization is the hardware implementation of that architecture, including data paths, control signals, buses and memory technology.

A stored-program computer keeps instructions and data in addressable memory. The processor repeatedly fetches, decodes and executes instructions while I/O controllers exchange information with external devices.

Basic microcomputer organization. The shared system bus comprises a normally CPU-driven address group, a bidirectional data group and a mixed-direction control group.

Basic microcomputer organization. The shared system bus comprises a normally CPU-driven address group, a bidirectional data group and a mixed-direction control group.

In a von Neumann architecture, instructions and data share one memory and one transfer path. The design is simple and flexible, but instruction fetches and data transfers compete for the same path, producing the von Neumann bottleneck. A Harvard architecture uses separate instruction and data memories and buses, permitting both accesses at once. Many modern processors use a modified Harvard organization: separate L1 instruction and data caches feed a unified main-memory address space.

FeatureVon NeumannHarvard
MemoryInstructions and data share one spaceSeparate instruction and data spaces
BusesCommon transfer pathIndependent instruction and data paths
Parallel accessNormally one memory transfer at a timeInstruction and data may be fetched together
Main advantageSimpler hardware and flexible storageHigher sustained bandwidth
Typical useGeneral-purpose systemsDSPs, microcontrollers and split caches

Stored-program architecture comparison.

The central processing unit (CPU) coordinates the computer and executes machine instructions. Its principal units are:

  • Arithmetic logic unit (ALU): performs arithmetic, Boolean, comparison and shift operations.

  • Control unit: decodes the instruction and issues timed register, ALU, memory and I/O control signals.

  • Register set: holds current addresses, instructions, operands, results and processor state at CPU speed.

  • Clock and internal data path: sequence micro-operations and move values among registers and execution units.

RegisterPurpose
Program counter (PC)Address of the next instruction to fetch
Instruction register (IR)Instruction currently being decoded or executed
Memory address register (MAR)Address presented for a memory transaction
Memory data register (MDR/MBR)Word read from or written to memory
Accumulator/general registersOperands and intermediate or final results
Stack pointer (SP)Address of the current top of the runtime stack
Status/flags registerZero, carry, sign, overflow, interrupt-enable and other state bits

Common processor registers.

The basic instruction cycle is

fetch→decode→operand fetch→execute→write back→interrupt check.\boxed{\text{fetch}\rightarrow\text{decode}\rightarrow \text{operand fetch}\rightarrow\text{execute}\rightarrow \text{write back}\rightarrow\text{interrupt check}}.

For a fixed-length instruction, representative fetch micro-operations are

T0:MAR←PC,T1:MDR←M[MAR],PC←PC+instruction length,T2:IR←MDR,T3:decode opcode, addressing mode and operand fields.\begin{aligned} T_0 &: \mathrm{MAR}\leftarrow\mathrm{PC},\\ T_1 &: \mathrm{MDR}\leftarrow M[\mathrm{MAR}],\qquad \mathrm{PC}\leftarrow\mathrm{PC}+\text{instruction length},\\ T_2 &: \mathrm{IR}\leftarrow\mathrm{MDR},\\ T_3 &: \text{decode opcode, addressing mode and operand fields}. \end{aligned}

The control unit then computes any effective address, fetches operands, selects the execution unit and enables the destination register or memory write.

One representative logical instruction layout is

opcodeaddressing modedestination registersource/register/address field

The opcode selects the operation, the mode controls effective-address formation, and the remaining fields identify operands and destinations. The actual field widths and even the number of instruction words are properties of the processor’s instruction-set architecture.

Instruction cycle with explicit CPU register transfers, memory controls, write-back alternatives and interrupt service.

Instruction cycle with explicit CPU register transfers, memory controls, write-back alternatives and interrupt service.

PhaseMain control actionPossible delay or exception
FetchRead the instruction addressed by PCInstruction-cache miss
DecodeInterpret fields and generate controlsIllegal-opcode trap
Operand accessRead registers or calculate and access an effective addressData-cache/TLB miss or alignment fault
ExecutePerform the ALU, branch, memory or I/O operationDivide fault or branch penalty
Write-backEnable the destination register, memory path and flagsStore buffer or memory wait
Interrupt checkSave context and vector to a handler when a request is acceptedA disabled or masked request remains pending

Instruction phases and representative delay or exception sources.

An interrupt requests service for an asynchronous event. If accepted, the CPU completes or precisely records the current instruction, saves the PC and status, loads an interrupt-service address from a vector, services the event, and restores the saved context on return. Interrupts avoid continuous polling, but priority, masking and interrupt latency must be controlled.

Pipelining overlaps stages of successive instructions to increase throughput. It does not necessarily reduce one instruction’s latency. A structural hazard occurs when stages need the same resource, a data hazard when an instruction needs an unavailable earlier result, and a control hazard after a branch or jump. Stalling, forwarding, resource duplication and branch prediction reduce these penalties.