Skip to main content
@shmVirus

Computer Organization

Distinguish architecture from organization, identify the functional units of a stored-program computer, and trace instructions through fetch, decode, and execution.

Updated

Learning objectives

  • Distinguish computer architecture, organization, hardware, software, and firmware
  • Explain the roles and connections of the processor, memory, and input-output units
  • Trace a stored-program instruction through fetch, decode, execute, and write-back
  • Separate data flow, address flow, and control flow
  • Calculate CPU execution time from instruction count, CPI, and clock rate

Prerequisites

  • Binary numbers and elementary digital logic

Computer architecture explains the contract visible to a programmer and the structures that make that contract run. The subject therefore connects two views:

```text program and data → instruction-set contract → processor organization → digital hardware ```

Central idea: architecture specifies what a machine does; organization explains how a particular machine does it.

Architecture, Organization, and Implementation

The terms are related but not interchangeable.

TermMeaningRepresentative examples
Computer architectureAttributes that directly affect the logical execution of programsInstruction set, data widths, addressing modes, visible registers, I/O mechanisms
Computer organizationOperational units and interconnections that realize the architectureControl signals, buses, cache structure, memory technology, pipeline depth
HardwarePhysical electronic and electromechanical componentsProcessor chip, RAM, disk, keyboard, wires
SoftwareInstructions and data manipulated by the machineOperating system, compiler, application, input dataset
FirmwarePersistent programs stored in non-volatile electronic storageBoot code, device-controller code, embedded-system control program

Two processors may implement the same architecture while using different organizations. A program sees the same instructions, but one processor might use a five-stage pipeline and another a deeper pipeline with larger caches. Conversely, changing an instruction encoding changes the architecture because machine-code programs can observe it.

Firmware sits between ordinary software and hardware. It is program logic retained when power is removed and is normally changed less often than application software. Modern firmware can be updated, but its persistence and close relationship with a device distinguish it from ordinary programs.

Functional Units

Computer functional-unit diagram showing input and output interfaces, memory, control unit, registers, and arithmetic logic unit connected by address, data, and control paths
A computer moves instructions and data through the same cooperating units. The arrows distinguish information paths from the control signals that coordinate them.

Input and output

Input units translate information from the external world into the binary representation used internally. Output units perform the reverse translation. Peripherals differ greatly in speed and representation, so an interface unit supplies data registers, status information, and timing control between a peripheral and the processor.

Memory

Memory stores both instructions and data. Each location has an address, and a read or write operation selects one location at a time. If a memory contains 2n2^n addressable locations, it needs nn address bits. A `64 KiB` byte-addressable memory therefore has 2162^{16} locations and a 16-bit address.

Processor

The processor contains:

  • a control unit, which fetches and decodes instructions and generates enabling signals;
  • an arithmetic logic unit (ALU), which performs arithmetic, logical, and comparison operations;
  • registers, which hold operands, addresses, instructions, status, and intermediate results close to the ALU.

The control unit is not normally the source of operand data. It selects routes and operations. The datapath—registers, buses, ALU, and shifter—carries and transforms the values.

Three Kinds of Information Flow

FlowTypical contentsExample
DataOperand or instruction bitsMemory word transferred into the instruction register
AddressIdentity of a memory or I/O locationProgram counter copied to the memory address register
ControlMeaning and timing of a transfer`MemoryRead`, `LoadIR`, `ALU=ADD`, `WriteR1`

Treating every line as “data” hides the design problem. For a load instruction, an address must first become valid, a read command must be asserted, memory must return data, and only then may the destination register load.

The Stored-Program Operational Concept

Instructions and ordinary data reside in memory as binary words. The program counter (PCPC) identifies the next instruction. The instruction register (IRIR) holds the current instruction while it is decoded and executed.

Instruction execution cycle showing fetch, decode, operand access, execute, write-back, and interrupt check with representative register transfers
The cycle is logical rather than necessarily one clock per box. A multicycle processor divides the phases into several timed register transfers; a pipeline overlaps phases from different instructions.

Fetch

A representative fetch uses temporary memory registers:

MARPC,MDRM[MAR],IRMDR,PCPC+1.MAR\leftarrow PC,\qquad MDR\leftarrow M[MAR],\qquad IR\leftarrow MDR,\qquad PC\leftarrow PC+1.

The transfers cannot all be assumed instantaneous. MARMAR must hold a stable address while memory is read; MDRMDR captures the returned word; IRIR then preserves the instruction for decoding.

Decode and operand access

The opcode field selects the operation. Addressing-mode and operand fields identify registers, constants, or memory locations. An effective address may require an additional ALU calculation before the operand can be fetched.

Execute and write-back

For an arithmetic instruction, the control unit selects operands, chooses an ALU function, and enables the destination register. For an I/O instruction, it enables the appropriate interface. A branch may replace PCPC rather than writing an arithmetic result.

Interrupt check

After an instruction reaches a safe completion point, the processor may test pending enabled interrupts. If one is accepted, it saves enough state to resume later and transfers control to an interrupt-service routine.

A Complete Numeric Trace

Suppose memory contains:

AddressInstruction or data
`0x020``LOAD R1, [0x180]`
`0x021``ADD R1, [0x181]`
`0x022``STORE R1, [0x182]`
`0x180``7`
`0x181``5`

Initially PC=0x020PC=\texttt{0x020}. The visible effects are:

InstructionOperand activityResultNext PCPC
`LOAD`Read M[0x180]M[\texttt{0x180}]R1=7R1=7`0x021`
`ADD`Read M[0x181]M[\texttt{0x181}]; ALU computes 7+57+5R1=12R1=12`0x022`
`STORE`Send R1R1 to memoryM[0x182]=12M[\texttt{0x182}]=12`0x023`

The architecture describes these effects. The organization determines whether the operand comes through a shared bus, how many clock cycles each instruction needs, and whether the memory reference hits in a cache.

Measuring Execution Time

A useful first processor-performance equation is

TCPU=instruction count×CPI×Tclock=instruction count×CPIclock rate.T_{CPU}=\text{instruction count}\times\text{CPI}\times T_{clock} =\frac{\text{instruction count}\times\text{CPI}}{\text{clock rate}}.

If a program executes 2.0×1092.0\times10^9 instructions at an average CPI of 1.51.5 on a 3.0 GHz3.0\text{ GHz} processor,

TCPU=2.0×109×1.53.0×109=1.0 s.T_{CPU}=\frac{2.0\times10^9\times1.5}{3.0\times10^9}=1.0\text{ s}.

A higher clock rate alone does not guarantee a faster program: instruction count and CPI may change with the architecture, compiler, caches, and pipeline. Throughput—the amount of work completed per unit time—is also different from the latency of one task.

Comparing processors correctly

For one fixed workload, performance is the reciprocal of execution time. If machine A completes it in TAT_A and machine B in TBT_B, then

PerformanceAPerformanceB=TBTA.\frac{\operatorname{Performance}_A}{\operatorname{Performance}_B}=\frac{T_B}{T_A}.

Suppose the same compiled program executes 1.2×1091.2\times10^9 instructions on two processors:

ProcessorClock rateAverage CPICPU time
A2.42.4 GHz1.21.2(1.2×109)(1.2)/(2.4×109)=0.60(1.2\times10^9)(1.2)/(2.4\times10^9)=0.60 s
B3.23.2 GHz2.02.0(1.2×109)(2.0)/(3.2×109)=0.75(1.2\times10^9)(2.0)/(3.2\times10^9)=0.75 s

Although B has the higher clock rate, A is 0.75/0.60=1.250.75/0.60=1.25 times as fast for this program. A fair comparison must hold the workload constant and account for instruction count, CPI, and clock period together. Wall-clock time may additionally include operating-system delay and I/O; the CPU-time equation models time spent executing on the processor.

Abstraction Without Mystery

Each level depends on the one below it:

  1. Applications express algorithms.
  2. Compilers translate them into an instruction set.
  3. The processor organizes register transfers to implement each instruction.
  4. Digital circuits implement the registers, ALU, memory, and control.

An abstraction hides detail, but it does not remove causality. A cache miss, branch hazard, or slow I/O transfer becomes visible when lower-level timing changes program performance.

Design Checklist

When reading any architecture diagram, ask:

  1. Which elements store state?
  2. Which elements compute combinational results?
  3. Where do addresses travel?
  4. Where do operands and instructions travel?
  5. Which control signal makes each transfer permanent?
  6. On which clock edge does the new state become visible?

If those six questions have concrete answers, the diagram describes an executable machine rather than a collection of boxes.

Self-Check

  1. Classify “the instruction has a 12-bit address” and “the memory uses DRAM chips” as architecture or organization.
  2. How many address bits are required for a byte-addressable `4 MiB` memory?
  3. Why must the instruction register retain the fetched instruction after memory begins servicing another address?
  4. A program has 8×1088\times10^8 instructions, CPI =2.25=2.25, and clock rate =1.8=1.8 GHz. Find its CPU time.
  5. If one processor finishes a workload in 12 s and another in 8 s, what is the second processor’s speedup?
Answers
  1. The 12-bit instruction address is architectural; DRAM technology is organizational.
  2. 4 MiB=2224\text{ MiB}=2^{22} bytes, so 22 address bits are required.
  3. Decode and execution still need stable instruction bits after the memory data path is reused.
  4. (8×108×2.25)/(1.8×109)=1(8\times10^8\times2.25)/(1.8\times10^9)=1 second.
  5. 12/8=1.512/8=1.5 times.