Structure of Computers and Machine Instructions

Computer Classification and Evolutionary Trends

  • The Computer Revolution and Moore's Law

    • The progress in computer technology is underpinned by Moore's Law, which observes that microprocessor transistor counts double approximately every 2 years.
    • This exponential growth makes novel applications feasible across various sectors, including:
    • Automobiles: Integration of computers for control and safety systems.
    • Cell Phones: Advanced mobile computing.
    • Human Genome Project: Large-scale biological data processing.
    • World Wide Web and Search Engines: Managing and searching global information.
    • Computers are characterized as universal machines capable of performing diverse tasks.
    • The trajectory of microprocessor transistor counts has moved from thousands in the 1970s and 1980s (Motorola, IBM, Intel) to billions in the 2020s (e.g., Apple M2 Ultra).
  • Different Types of Computers

    1. Personal Computers (PC): The most common type found in homes, schools, and business offices. It typically consists of a desktop computer with processing units, storage units, and various input/output devices.
    2. Notebook Computers: Compact and portable versions of a Personal Computer.
    3. Workstations: These possess high-resolution input/output (I/O) graphics capabilities while maintaining physical dimensions similar to a desktop computer. They are primarily used in engineering applications for interactive design work.
    4. Enterprise Systems: Used for business data processing in medium to large corporations. They require significantly more computing power and storage capacity than workstations. Internet-associated servers are now a dominant source of worldwide information.
    5. Supercomputers: Used for large-scale numerical calculations required in applications such as weather forecasting, healthcare, and Artificial Intelligence (AI) applications.

Functional Units of a Computer

  • Definition of a Computer

    • A sophisticated electronic calculating machine that:
    • Accepts input information.
    • Processes the information according to a list of internally stored instructions.
    • Produces the resulting output information.
    • Key functions include accepting input, storing instructions, processing according to those instructions, and providing output results.
  • Core Functional Units

    • Central Processing Unit (CPU): Comprised of the Arithmetic-Logic Unit (ALU) and the Control Unit.
    • Input Unit: Accepts information from human operators, electromechanical devices (like keyboards), or other computers.
    • Output Unit: Sends processed results to a monitor display, printer, or other devices.
    • Arithmetic and Logic Unit (ALU): Also known as the datapath, it performs the desired operations on input information as determined by instructions in the memory.
    • Memory: Stores both instructions and data.
    • Control Unit: Coordinates the actions of input, output, processing, and memory units.
  • Information Characterization

    • Instructions: Commands that specify transfers of information (within the computer or to I/O devices) and arithmetic/logic operations (e.g. Add, AND). A sequence of instructions stored in memory is called a program.
    • Data: The "operands" upon which instructions operate. This includes numbers and encoded characters. Data is encoded as strings of binary digits called bits.

Detailed Memory and CPU Operations

  • Memory Unit Properties

    • Word: A group of bits stored or retrieved as a single unit.
    • Word Length: The number of bits in a single word.
    • Address: A unique identifier associated with each word location in memory for reading and writing.
    • RAM (Random Access Memory): Provides a fixed memory access time regardless of the word's location.
    • Memory Hierarchy:
    • Cache Memory: A small amount of RAM tightly coupled with the processor to reduce communication time. It is the fastest and smallest level.
    • Main Memory: Larger and slower than cache.
    • Primary Storage: Consists of RAM units (Cache and Main Memory). It is expensive and often insufficient for long-term storage.
    • Secondary Storage: Used for large amounts of data (Magnetic disks/tapes, CD-ROMs). Access is slower but cheaper.
  • ALU and Registers

    • Operations are executed within the ALU.
    • General Purpose Registers: Faster than cache, these are located within the processor to store operands during computation.
    • Results can be stored back in memory or retained in registers for immediate use.
  • Control Unit Functionality

    • Instructions control what happens (data transfer, processing).
    • The Control Unit generates timing signals that determine when operations occur, coordinating all other functional units.
  • Input and Output Unit Logic

    • Input Unit: Interfaces with devices, accepts binary information, and formats it for the computer to transfer to memory/processor.
    • Output Unit: Interfaces with output devices, taking binary results from the computer and converting them into a form understood by the device.

Basic Operational Concepts

  • Bus Structures

    • A Bus is a group of parallel wires serving as a connecting path for several devices. Each wire transfers one bit of information. The number of wires is usually equal to the computer's word length.
    • Single Bus Structure: Low cost and flexible for peripherals, but only one transfer can happen at a time (only two units can communicate simultaneously).
    • Multiple Bus Structure: Allows two or more transfers simultaneously, achieving higher concurrency and performance at a higher cost.
    • Bus Types:
    • Data Bus: Bidirectional; transfers actual data/instructions between CPU, memory, and I/O.
    • Address & Control Bus: Unidirectional.
    • Buffer Registers: Included with devices to manage the speed mismatch between fast processors and slow components like keyboards.
  • Processor Registers and Communication

    • Instruction Register (IR): Holds the current instruction being executed; its output goes to control circuits.
    • Program Counter (PC): Specialized register holding the memory address of the next instruction to be fetched.
    • Memory Address Register (MAR): Holds the address of the location to be accessed.
    • Memory Data Register (MDR): Holds the data to be written into or read out of the addressed location.
    • Accumulator (AC): Stores intermediate arithmetic and logic results.
  • Typical Operating Steps (The Fetch-Decode-Execute Cycle)

    1. Programs are loaded into memory via input devices.
    2. The PC is set to the first instruction address.
    3. The PC content is transferred to the MAR.
    4. A Read signal is sent to memory.
    5. The instruction is loaded into the MDR, then transferred to the IR.
    6. The instruction is decoded.
    7. Operands are fetched (from registers or via memory address to MARReadMDRALU).
    8. The ALU performs the operation.
    9. The result is stored in a register or memory (via MAR and MDRWrite).
    10. The PC is incremented to the next instruction.

System Software and Performance

  • System Software Roles

    • Interprets user commands and runs application programs (word processors, games).
    • Manages storage and file retrieval in secondary storage.
    • Translates source programs into machine instructions (Object form).
    • Operating System (OS): A collection of routines that manages computer resources (memory, disk space, I/O) and controls interaction between units. It manages concurrent execution (multiprogramming/multitasking) by handling transfers while processors or printers are busy.
  • Instruction Set Architectures

    • RISC (Reduced Instruction Set Computer): Simple instructions (one cycle), hardwired control, few instructions, fixed format, few addressing modes, multiple register sets, highly pipelined.
    • CISC (Complex Instruction Set Computer): Complex instructions (multiple cycles), microprogrammed control, many instructions, variable format, many addressing modes, single register set, less pipelined.
  • Performance Metrics and Equations

    • Clock Cycle (P): A single fundamental unit of time ("tick").
    • Clock Rate (R): Frequency of cycles, measured in Hertz (HzHz). R=1PR = \frac{1}{P}.
    • CPI (S): Average number of clock cycles required per instruction. CPI=Clock cyclesInstructionCPI = \frac{\text{Clock cycles}}{\text{Instruction}}.
    • MIPS: Millions of Instructions Per Second. MIPS=RS×106MIPS = \frac{R}{S \times 10^6}.
    • Basic Performance Equation: T=N×SRT = \frac{N \times S}{R}, where TT is processor time and NN is the actual number of instruction executions (Instruction Count).

Worked Problem Examples

  • Problem 1: Execution Time Calculation

    • Given: N=1000N = 1000 instructions. 25%25\% need 44 cycles (250×4250 \times 4), 40%40\% need 55 cycles (400×5400 \times 5), 35%35\% need 33 cycles (350×3350 \times 3). R=1GHzR = 1\,GHz.
    • Total cycles = 1000+2000+1050=40501000 + 2000 + 1050 = 4050.
    • T=40501×109Hz=4.05×106s=4.05μsT = \frac{4050}{1 \times 10^9\,Hz} = 4.05 \times 10^{-6}\,s = 4.05\,\mu s.
  • Problem 2: Clock Rate and MIPS

    • Given: 2GHz2\,GHz clock.
    • a) Clock cycle P=12×109Hz=0.5nsP = \frac{1}{2 \times 10^9\,Hz} = 0.5\,ns.
    • b) Average instruction takes 44 cycles (S=4S=4). Performance in MIPS? MIPS=2×1094=500×106=500MIPSMIPS = \frac{2 \times 10^9}{4} = 500 \times 10^6 = 500\,MIPS.
    • c) Program of 400400 million instructions (N=400×106N = 400 \times 10^6) takes 22 seconds (T=2T=2). Find average cycles per instruction (SS).
    • S=T×RN=2s×2×109Hz400×106=4000400=10cycles per instructionS = \frac{T \times R}{N} = \frac{2\,s \times 2 \times 10^9\,Hz}{400 \times 10^6} = \frac{4000}{400} = 10\,\text{cycles per instruction}.
  • Problem 3: Weighted Program Execution

    • Given: 3.2GHz3.2\,GHz CPU (R=3.2×109R = 3.2 \times 10^9). Data processing (60%60\%, S=4S=4). Data transfer (40%40\%, S=10S=10). N=1×106N = 1 \times 10^6.
    • Average S=(0.6×4)+(0.4×10)=2.4+4=6.4S = (0.6 \times 4) + (0.4 \times 10) = 2.4 + 4 = 6.4.
    • T=106×6.43.2×109=2×103s=2msT = \frac{10^6 \times 6.4}{3.2 \times 10^9} = 2 \times 10^{-3}\,s = 2\,ms.