1. Gyanastra
  2. Computer Organisation and Architecture
  3. Basic Computer Organization
  4. Stored Program Concept and Role of Registers, ALU, and Control Unit
Free lesson, no account needed 7 min read 2 practice questions after it
Asked in past papers3 times
  • GATE CSE1990
  • UGC NET20172009

Computer Organisation and Architecture · Basic Computer Organization

Stored Program Concept and Role of Registers, ALU, and Control Unit

Overview

A general-purpose computer is built on the stored program concept: the program is kept in memory, and program and data are fetched from memory, executed, and the result written back to memory.
Because memory is comparatively slow, fast registers are needed close to the execution units, and a control unit must issue the right signals at the right instants to make data movement and computation happen.

Key concepts

  • Stored program (stored memory) concept: the program is placed in memory; program and data are taken from memory, executed, and the result is put back into memory.
  • Memory: holds the program and data. It is the most important part of a general-purpose computer, but it is comparatively slow compared to registers.
  • Registers: fast storage close to the execution units; they hold operands and intermediate results near the ALU.
  • Arithmetic and Logic Unit (ALU): arithmetic circuits perform addition, subtraction, multiplication and division; logic circuits perform logical operations such as logical AND and logical OR.
  • Control unit: generates the control signals that make data movement and operations happen at the right instants of time.
  • Control signals: signals applied at particular instances of time to make movement and computation happen.
  • Instruction decoding: generating the control signals by looking at the instruction; it is done by the CPU.
  • Computer architecture: the whole design activity — selecting components, connecting them, and generating control signals — done with the programmers who will use the computer in mind.
  • Spilling: the movement of data into and out of registers when few registers exist (mentioned only as an aside; not part of the syllabus).

How it works

  1. Stored program execution: the program is kept in memory; program and data are fetched from memory, executed, and the result is written back to memory.
  2. Why registers exist: memory is slow relative to registers, so registers hold operands and intermediate results close to the ALU.
  3. Register count is a cost trade-off: how many registers a machine has depends on cost — how much money is put into the design; more money means more registers.
    Many registers let the program be small; few registers force most instructions to move data into and out of the registers (spilling), so program size varies with the number of registers because the number of instructions varies.
  4. Data movement path: data must move from memory into registers, from registers into the ALU, and the results must be moved back to registers and back to memory.
  5. Control signals at correct timings: signals must be applied at particular instances of time.
    To move data from register R1 to register R2, a write control signal must be given to R2 and a read control signal must be given to R1 at the same time; only then does the data move from R1 to R2.
  6. Control unit: a special unit supplies the signals to all these components.
  7. Choosing components: components are selected depending on cost and on what is to be achieved — 16 registers need a 4 × 16 decoder; 1 kilobyte of memory needs a10×210a 10 \times 2^{10} decoder; adding two 8-bit numbers needs an 8-bit adder in the ALU. The designer chooses hardware to decrease time.
  8. Connecting the components: the second issue is how to connect all the chosen components together.
  9. Instruction decoding: after connecting them, the designer decides what type of control signals are required and how to generate them by looking at the instruction; the CPU does this decoding.
  10. Computer architecture: selecting components, connecting them, and generating control signals is what the designer looks at.
    The design depends on what the programmer wants to perform: designers set up and connect the hardware while keeping in mind the programmers who will use the computer.

Formulas

  • Decoder size for RR registers: n×2nn \times 2^n decoder, where n=log⁡2(R)n = \log_2(R) input lines and 2n=R2^n = R output lines.
  • Decoder size for memory of size MM bytes (byte-addressable): n=log⁡2(M)n = \log_2(M) address lines, giving an n×2nn \times 2^n decoder.
  • Adder width for adding two ww-bit numbers: a ww-bit adder.

Worked examples

Example 1: Register selection decoder

  • Number of registers = 16.
  • Input lines = log⁡2(16)=4\log_2(16) = 4; output lines = 16.
  • Decoder size = 4 × 16.

Example 2: Memory address decoder

  • Memory size = 1 kilobyte = 1024 bytes = 2102^{10} bytes.
  • Address lines = log⁡2(210)=10\log_2(2^{10}) = 10; output lines = 210=10242^{10} = 1024.
  • Decoder size = ⋅⋅10×210⋅⋅\cdot \cdot 10 \times 2^{10}\cdot \cdot.

Example 3: ALU adder width

  • Operation: add two 8-bit numbers.
  • Adder required = 8-bit adder.

Example 4: Register-to-register transfer control

  • Task: move data from R1 to R2.
  • Control signals: read = 1 on R1 and write = 1 on R2, applied at the same time.
  • Result: data moves from R1 to R2.

Comparison

ComponentSpeedRoleDesign choice depends on
MemorySlow compared to registersHolds program and data (stored program concept)Size (e.g., 1 KB → 10×21010 \times 2^{10} decoder)
RegistersFastHold operands/results close to ALUCost; more registers → smaller program, fewer registers → more move instructions (spilling)
ALU—Arithmetic (add, subtract, multiply, divide) and logic (AND, OR) operationsOperand width (e.g., 8-bit operands → 8-bit adder)
Control unit—Issues control signals at correct times; performs instruction decodingType of control signals needed, derived from the instruction
Registers availableEffect on program
Many registersProgram can be small
Few registersMost instructions move data into and out of registers (spilling); program size changes

Revision summary

  • Stored program concept: the program is placed in memory; program and data are fetched from memory, executed, and results stored back in memory.
  • Memory is the most important part of a general-purpose computer but is slow compared to registers — hence registers.
  • The number of registers is a cost decision; few registers force extra move instructions (spilling), changing program size.
  • ALU = arithmetic circuits (add, subtract, multiply, divide) + logic circuits (AND, OR, etc.).
  • To move R1 → R2, assert read on R1 and write on R2 simultaneously; signals at the wrong time do not move the data.
  • The control unit generates signals for all components; generating them from the instruction is instruction decoding, done by the CPU.
  • Decoder sizing: 16 registers → 4 × 16 decoder; 1 KB memory → 10×21010 \times 2^{10} decoder; 8-bit addition → 8-bit adder.
  • All of this design activity — component selection, interconnection, and control signal generation — is computer architecture.

Previous-year exam insights

  • The CPU consists of the ALU (arithmetic and logic operations), the control unit (timing and control signal generation, instruction decoding) and registers (general-purpose registers for operands/results); memory and I/O form the storage and interface unit.
    Asked inUGC NET 2017
  • A program is a sequence (ordered set) of instructions drawn from the instruction set of the machine; the instruction set is the complete repertoire of instructions the CPU can execute, and a program uses a subset of it.
    Asked inUGC NET 2009
  • The stored program concept (von Neumann) means instructions and data reside in the same memory and are fetched and executed one instruction at a time by the fetch–decode–execute cycle; the program counter holds the address of the next instruction and the instruction register holds the current instruction.
  • The control unit may be hardwired (fixed combinational logic, fast, not changeable) or microprogrammed (control signals generated from a control store/microinstructions, flexible, slower); instruction decoding means interpreting the opcode to select the control-signal sequence.
  • Registers are the fastest storage in the memory hierarchy (access within a clock cycle), followed by cache, main memory and secondary storage; more registers reduce memory traffic and the number of load/store instructions.
  • An n-input decoder has 2n2^{n} output lines and is written n × 2n2^{n}; a k-bit address selects one of 2k2^{k} locations, so a memory of 2k2^{k} words needs ak×2ka k \times 2^{k} decoder (register file selection works the same way).
Pages 1–2 of 2