UNIT 4: COMPUTER SYSTEM ORGANIZATION - EXAM-FOCUSED NOTES
(Aligned with RGPV past papers for EC-504(C) / Computer System Organization)
** I. VON NEUMANN ARCHITECTURE**
Definition: A stored-program digital computer architecture where instruction memory and data memory share the same memory space and bus.
Key Components:
-
Memory: Stores both instructions and data.
-
Control Unit (CU): Fetches, decodes, and controls instruction execution.
-
Arithmetic Logic Unit (ALU): Performs arithmetic and logical operations.
-
Input/Output (I/O) Units: For external communication.
-
Registers: Fast storage inside CPU (PC, IR, MAR, MDR, Accumulator).
Stored-Program Concept:
Instructions are stored in memory as binary data and are fetched sequentially by the CU for execution.
Processing Flow:
Fetch → Decode → Execute → Store Result (Repeats in Instruction Cycle)
[!TIP] Exam Focus: Von Neumann bottleneck refers to the limited bandwidth between CPU and memory due to shared bus. Contrast with Harvard architecture (separate buses).
** II. INSTRUCTION EXECUTION CYCLE & RTL**
Phases:
-
Fetch (F):
PC → MAR → Memory → MDR → IR;PC ← PC + 1 -
Decode (D): Control unit decodes opcode in IR, identifies operands.
-
Execute (E): ALU performs operation (e.g., ADD, SHIFT). May involve memory access.
-
Write-back (W): Result written to destination register/memory.
Micro-operations: Elementary operations on data stored in registers (e.g., transfer, arithmetic, logic).
Register Transfer Language (RTL): Symbolic notation to describe micro-operations.
Example: R1 ← R2 + R3 (Arithmetic), MAR ← PC (Transfer)
Instruction Format Design:
-
Fields:
[Opcode | Address/Mode | Address/Mode] -
Addressing Bits: For
naddress fields ofkbits each → Address space = $$\displaystyle 2^k $$ locations. -
Opcode Bits: For
minstructions → Opcode bits ≥ $$\displaystyle \log_2 m $$.
[!TIP] Common Pitfall: In 2-address format, one operand is often implied (accumulator). Calculate total instruction length by summing bits for all fields.
** III. ADDRESSING MODES**
| Mode | Description | Example (ADD) | Use Case |
|---|---|---|---|
| Immediate | Operand is in instruction itself | ADD #5 |
Loading constants |
| Direct | Address field gives operand's memory address | ADD A (A=address) |
Simple variable access |
| Indirect | Address field points to a memory location that contains operand's address | ADD @A |
Pointers, arrays |
| Register | Operand is in a CPU register | ADD R1 |
Fast access to local variables |
| Register Indirect | Register contains address of operand in memory | ADD (R1) |
Array traversal, pointer deref |
| Indexed/Base | Effective address = Address field + Index/Base register | ADD 1000(R1) |
Array access (base + offset) |
| Relative | Effective address = PC + Offset | ADD +10 |
Position-independent code, branches |
[!TIP] Exam Tip: Immediate mode has no memory access. Indirect modes require two memory accesses (fetch address, then fetch operand).
** IV. CONTROL UNIT DESIGN**
A. Hardwired Control
-
Design: Combinational logic (gates) + Sequential logic (state machine). Control signals generated directly from instruction decoder and timing signals.
-
Advantages: High speed (no memory access for microcode).
-
Disadvantages: Inflexible, complex to design/modify, instruction set is fixed.
-
Application: Simple, high-performance processors (RISC often uses hardwired).
B. Microprogrammed Control
-
Design: Control signals stored as microinstructions in Control Memory (CM). A microprogram sequencer fetches and executes microinstructions.
-
Microinstruction Formats:
-
Horizontal: One bit per control signal → high parallelism, large CM size.
-
Vertical: Encoded fields → smaller CM, less parallelism, slower.
-
-
Microprogram Sequencer: Generates address of next microinstruction (incremental, conditional branches, subroutine calls).
-
Advantages: Flexible (easy to modify/debug), simpler design.
-
Disadvantages: Slower (extra CM access step).
Comparison Table:
| Feature | Hardwired | Microprogrammed |
|---|---|---|
| Speed | Faster | Slower (CM access) |
| Flexibility | Inflexible | Highly flexible |
| Design Complexity | High (logic design) | Lower (write microcode) |
| Cost/Area | Larger logic gates | Smaller (CM + simple logic) |
| Debugging | Difficult | Easier (modify microcode) |
[!TIP] Hybrid Approach: Use hardwired for frequently used instructions, microprogrammed for complex/rare ones.
** V. ARITHMETIC AND LOGIC UNIT (ALU)**
A. Integer Arithmetic Circuits
-
Half Adder: 1-bit addition.
Sum = A ⊕ B,Carry = A·B -
Full Adder: 1-bit addition with carry-in.
Sum = A ⊕ B ⊕ Cin,Cout = (A·B) + (Cin·(A⊕B)) -
Multi-bit Adder: Ripple-carry (slow), Carry-lookahead (fast, complex).
-
Multiplication (Shift-and-Add): Repeated addition and shifting. For
M × N:-
Initialize product = 0.
-
If LSB of multiplier = 1, add multiplicand to product.
-
Shift multiplicand left, multiplier right.
-
Repeat for all bits.
-
-
Challenges: Carry propagation delay, large area for fast multipliers (array/parallel multipliers).
B. Floating-Point Arithmetic (IEEE 754)
-
Format:
(-1)^S × (1.M) × 2^(E-Bias)-
Single (32-bit): 1 sign, 8 exponent, 23 mantissa (Bias=127)
-
Double (64-bit): 1 sign, 11 exponent, 52 mantissa (Bias=1023)
-
-
Addition/Subtraction Steps:
-
Align Exponents: Shift smaller operand's mantissa right until exponents equal.
-
Add/Subtract Mantissas: Perform operation on aligned mantissas.
-
Normalize Result: Shift result left/right to get
1.xxxxform; adjust exponent. -
Round: Apply rounding mode (e.g., round to nearest even).
-
Check for Underflow/Overflow.
-
-
Key Difference from Integer: Needs exponent alignment and normalization; more complex hardware.
[!TIP] Exam Problem: Given two FP numbers, trace alignment and normalization steps. Remember: Exponents must match before mantissa addition.
** VI. DATA TRANSFER AND I/O ORGANIZATION**
| Mode | CPU Involvement | How it Works | Speed | Complexity |
|---|---|---|---|---|
| Program-Controlled (Polling) | High (CPU waits in loop) | CPU repeatedly checks device status register. | Slowest | Simplest |
| Interrupt-Driven | Medium (CPU interrupted) | Device signals interrupt; CPU saves state, executes ISR, returns. | Medium | Medium (needs interrupt controller) |
| DMA (Direct Memory Access) | Low (CPU only init/complete) | DMA controller takes bus control, transfers data directly between I/O and memory. | Fastest | Complex (DMA controller, bus arbitration) |
DMA Operation Modes:
-
Burst Mode: DMA takes complete control of bus for entire block transfer.
-
Cycle Stealing: DMA transfers one word, then releases bus (minimizes CPU stall).
I/O Interface Functions:
- Buffering, signal conversion (serial↔parallel), protocol handling, device addressing.
Duplex Modes:
-
Half-Duplex: Communication in one direction at a time (e.g., walkie-talkie).
-
Full-Duplex: Simultaneous two-way communication (e.g., telephone).
Asynchronous vs. Synchronous Transfer:
-
Asynchronous: Uses handshaking (REQ/ACK). No common clock. Flexible for variable-speed devices.
-
Synchronous: Uses a common clock. Faster, but all devices must operate at same speed.
[!TIP] DMA Calculation: CPU time fraction =
(Cycles for DMA init + Cycles for interrupt per transfer) / Total cycles for data transfer. Given data size and transfer rate, compute total cycles.
** VII. MEMORY HIERARCHY & CACHE MEMORY**
Principle of Locality:
-
Temporal: Recently accessed data likely to be accessed again soon.
-
Spatial: Data near recently accessed data likely to be accessed soon.
Cache Memory Parameters:
-
Cache Size (C), Block Size (B), Number of Blocks (C/B), Hit (H) / Miss (M).
-
Hit Ratio (h) = Hits / (Hits + Misses)
Mapping Techniques:
| Technique | How Address is Split | Pros | Cons |
|---|---|---|---|
| Direct Mapped | `[Tag | Index | Offset]` |
| Fully Associative | `[Tag | Offset]` (Tag compared to ALL tags) | Lowest miss rate |
| Set-Associative (n-way) | `[Tag | Set Index | Offset]` (n tags per set) |
Cache Performance - Average Memory Access Time (AMAT):
$$ \boxed{\text{AMAT} = \text{Hit Time} + \text{Miss Rate} \times \text{Miss Penalty}} $$
Where:
-
Hit Time = Time to access cache.
-
Miss Penalty = Time to fetch block from main memory + possibly deliver to CPU (often ≈ Main Memory Access Time).
[!TIP] AMAT Calculation: Given
Cache access = 100ns,Main memory = 1000ns,Hit ratio = 0.9:
AMAT = 100ns + (1-0.9) × 1000ns = 100ns + 100ns = 200ns.
** VIII. ADVANCED CPU DESIGN**
A. Instruction Pipelining
-
Idea: Overlap execution of multiple instructions.
-
Typical 5-Stage Pipeline:
-
IF (Instruction Fetch):
IR ← Mem[PC],PC ← PC+1 -
ID (Instruction Decode): Decode opcode, read registers.
-
EX (Execute): ALU operation (address calc, arithmetic).
-
MEM (Memory Access): Read/write data memory.
-
WB (Write Back): Write result to destination register.
-
-
Speedup (Ideal): ≈ Number of stages (n). Efficiency = Speedup / n.
-
Hazards:
-
Structural: Resource conflict (e.g., two instructions need memory in same cycle). Solution: Duplicate resources.
-
Data: Dependency between instructions (RAW, WAR, WAW). Solution: Forwarding/bypassing, stalls.
-
Control: Branch/jump instructions change PC. Solution: Branch prediction, delayed branch.
-
B. Parallel Processing & Flynn's Taxonomy
-
SISD: Single Instruction, Single Data (Uniprocessor).
-
SIMD: Single Instruction, Multiple Data (Vector processors, GPUs). Same operation on multiple data elements.
-
MISD: Multiple Instruction, Single Data (Rare, fault tolerance).
-
MIMD: Multiple Instruction, Multiple Data (Multiprocessors, multicores). Independent threads.
Vector Processors:
-
Have vector registers and vector functional units.
-
Execute a single vector instruction on an entire array (e.g.,
VADD V1, V2, V3adds corresponding elements of two vectors). -
Applications: Scientific computing, graphics, signal processing (highly data-parallel).
Inter-Processor Communication (MIMD):
-
Shared Memory: Processors communicate via common memory (requires synchronization: locks, semaphores).
-
Message Passing: Processors communicate via network (send/receive messages).
[!TIP] Pipeline Throughput: Max throughput = 1 instruction/cycle (if no hazards). Speedup ≤ n (number of stages) due to pipeline fill/drain overhead and hazards.
** IX. SPECIALIZED TOPICS & PRACTICAL PROBLEMS**
A. Virtual Memory & Paging
-
Goal: Give each process illusion of large, contiguous private memory.
-
Paging: Divide virtual & physical memory into fixed-size pages/frames.
-
Page Table: Maps virtual page number → physical frame number.
-
Page Fault: Required page not in memory → OS loads from disk (high penalty).
-
Replacement Algorithms: FIFO, LRU (Least Recently Used), Optimal.
-
Fragmentation:
-
Internal: Wasted space within allocated block (due to fixed block size).
-
External: Wasted space between allocated blocks (in variable partitioning, not in paging).
-
B. Common Calculation Problems
-
Cache Mapping (Direct-Mapped):
-
Index bits = $$\displaystyle \log_2 $$(Number of sets). For direct-mapped, sets = number of blocks.
-
Offset bits = $$\displaystyle \log_2 $$(Block size in bytes).
-
Tag bits = Address bits - Index bits - Offset bits.
-
Hit/Miss: Calculate
Index = (Address / BlockSize) % NumBlocks. Compare Tag.
-
-
AMAT: Use formula above.
-
Instruction Format:
-
For
k-bit instruction, withopcode(x bits),address(y bits),mode(z bits):x + y + z = k. -
Max instructions = $$\displaystyle 2^x $$, Max addressable locations = $$\displaystyle 2^y $$.
-
-
Hardwired Control Logic (Boolean Expressions):
-
From truth table (Instructions × Time Steps), derive expression for each control signal.
-
Example:
S5 = I1·T1 + I2·T1 + I3·T1 + I4·T1(if S5 active in T1 for all I1-I4).
-
-
Microinstruction Encoding (Minimize Bits):
-
Group mutually exclusive control signals into fields.
-
Use binary encoding within each field.
-
Preserve parallelism: signals in same field cannot be active simultaneously.
-
-
DMA Bandwidth & CPU Overhead:
-
Total DMA transfer time =
Data Size / Transfer Rate. -
CPU cycles for init/interrupt =
(Init cycles + Interrupt cycles) * Number of transfers. -
Fraction CPU time =
CPU cycles for DMA / (CPU cycles for DMA + Total DMA transfer cycles * CPU clock rate).
-
[!TIP] Cache Problem Strategy: Always convert addresses to binary/hex, clearly mark Tag/Index/Offset bits. For set-associative,
Set Index = (Address / BlockSize) % Number of Sets.
** X. FREQUENTLY ASKED SHORT NOTES (7-Mark Questions)**
-
Von Neumann Model: Emphasize stored-program and shared bus for data/instructions. Mention bottleneck.
-
Cache Memory: Define purpose. Explain direct, associative, set-associative mapping with diagrams. State AMAT formula.
-
Pipelining: Draw 5-stage pipeline. Explain speedup and three hazards with examples.
-
DMA: Draw block diagram (CPU, DMA controller, memory, I/O). Explain cycle stealing vs burst mode. Contrast with programmed I/O and interrupt-driven.
-
Virtual Memory: Explain paging. Define page fault, page table, replacement algorithms. Benefits: larger address space, isolation.
-
Microprogrammed Control: Draw organization (Control Memory, Sequencer, Register). Compare horizontal vs vertical microinstructions. Role of sequencer.
-
I/O Processor: Offloads I/O tasks from CPU. Acts as a specialized processor for I/O channels. Enables asynchronous operation.
-
Floating-Point Representation: IEEE 754 format. Steps for addition (align, add, normalize, round). Contrast with integer.
-
Addressing Modes: List all 7 modes with one-line example and primary use case.
-
Inter-Processor Communication: In MIMD, explain shared memory (synchronization needed) and message passing.
[!TIP] For 7-mark questions: Always start with a clear definition, explain with a simple diagram/example, list advantages/disadvantages or steps, and conclude with significance/application.
Final Exam Strategy:
-
High Weightage: Cache Memory, Pipelining, DMA, Control Unit (Hardwired vs Micro), Virtual Memory.
-
Numericals: Practice AMAT, cache mapping (direct/set-associative), DMA time fraction, instruction format bit allocation.
-
Diagrams: Von Neumann, Common Bus, 5-stage Pipeline, Cache Mapping, DMA Controller, Microprogrammed Control.
-
Comparisons: Hardwired/Microprogrammed, Synchronous/Asynchronous, Half/Full Duplex, Direct/Set/Associative Cache.