Loading...
Loading...
| System | Base | Digits | Prefix | |---|---|---|---| | Binary | 2 | 0,1 | 0b | | Octal | 8 | 0-7 | 0o | | Decimal | 10 | 0-9 | — | | Hexadecimal | 16 | 0-9, A-F | 0x |
Conversions:
Decimal to Binary: Divide by 2, collect remainders in reverse. 45 → 45/2=22r1, 22/2=11r0, 11/2=5r1, 5/2=2r1, 2/2=1r0, 1/2=0r1 → 101101
Binary to Decimal: Multiply each bit by 2^position. 101101 = 32+0+8+4+0+1 = 45
Binary to Hex: Group 4 bits from right. 1011 0101 → B5 (hex)
Sign-Magnitude: MSB is sign bit (0=positive, 1=negative)
1's Complement: Flip all bits
2's Complement (Most used!): Flip all bits + add 1
Range for n-bit 2's complement: -2^(n-1) to +2^(n-1) - 1
Single Precision (32-bit):
Double Precision (64-bit):
Half Adder: Adds 2 single bits
Full Adder: Adds 3 bits (A, B, Cin)
Ripple Carry Adder: Chain of full adders; carry ripples through — slow for large n.
Carry Lookahead Adder (CLA): Computes carries in parallel — faster O(log n).
Booth's Algorithm: Handles both positive and negative multiplication efficiently.
Array Multiplier: Hardware implementation using AND gates and adders.
┌─────────────────────────────────┐
│ CPU │
│ ┌──────────┐ ┌──────────────┐ │
Input ───┤ │ Control │ │ ALU │ │──→ Output
│ │ Unit │ │ │ │
│ └──────────┘ └──────────────┘ │
│ ┌──────────────────────────────┤
│ │ Register File │ │
│ │ PC, IR, ACC, MAR, MDR, SP │ │
│ └──────────────────────────────┤
└─────────────────────────────────┘
Key Registers: | Register | Full Name | Purpose | |---|---|---| | PC | Program Counter | Address of next instruction | | IR | Instruction Register | Current instruction being executed | | MAR | Memory Address Register | Address to read/write | | MDR | Memory Data Register | Data to/from memory | | ACC | Accumulator | Stores intermediate results | | SP | Stack Pointer | Points to top of stack | | PSW | Program Status Word | Flags (Z, N, C, V) |
3-Address: OP D, S1, S2 → D = S1 OP S2 (more flexibility) 2-Address: OP D, S → D = D OP S (source or destination) 1-Address: OP X → ACC = ACC OP X (accumulator-based) 0-Address: OP → uses stack (stack machine)
| Mode | Effective Address | Example | |---|---|---| | Immediate | Operand is the value | ADD #5 | | Register | Operand in register | ADD R1 | | Direct | EA = address in instruction | ADD 2000H | | Indirect | EA = Memory[address] | ADD (2000H) | | Register Indirect | EA = Memory[Register] | ADD (R1) | | Indexed | EA = address + index register | ADD 100H(R1) | | Base+Offset | EA = base + offset | Used in arrays |
Fastest/Smallest/Most Expensive
┌─────────────────┐
│ Registers │ ~1 ns, bytes
├─────────────────┤
│ Cache (L1/L2/L3)│ ~2-20 ns, KB-MB
├─────────────────┤
│ Main RAM │ ~100 ns, GB
├─────────────────┤
│ SSD/HDD │ ~100μs-10ms, TB
└─────────────────┘
Slowest/Largest/Cheapest
Principle of Locality:
Cache Mapping Techniques:
| Technique | How | Advantage | Disadvantage | |---|---|---|---| | Direct Mapped | Block maps to exactly one cache line | Simple, fast | High miss rate (conflicts) | | Fully Associative | Block can go anywhere | Maximum flexibility | Complex, expensive | | Set Associative | Block maps to one set (2/4/8-way) | Balance of both | Moderate complexity |
Cache Write Policies:
Cache Replacement Policies:
Hit rate and Miss penalty: Average access time = Hit rate × Cache time + Miss rate × (Cache time + Memory time)
Pipelining is an implementation technique where multiple instructions are overlapped in execution.
5-Stage RISC Pipeline:
Ideal Speedup: k-stage pipeline → k× speedup over non-pipelined
Pipeline Hazards (Problems):
Resource conflict — two instructions need same hardware simultaneously. Solution: Stall pipeline (insert bubble) or duplicate hardware.
Instruction depends on result of previous instruction not yet completed.
ADD R1, R2, R3 ; R1 = R2 + R3
SUB R4, R1, R5 ; Needs R1 (not ready yet!) → Hazard
Solutions:
Branch instructions — pipeline doesn't know which instruction to fetch next. Solutions:
I/O Techniques:
| Technique | CPU involvement | Use Case | |---|---|---| | Programmed I/O (Polling) | 100% — busy waits | Simple, slow devices | | Interrupt-driven I/O | On completion only | Most general devices | | DMA (Direct Memory Access) | Only setup + completion | High-speed bulk transfer |
DMA Operation:
Bus Architecture:
Q1 (2023): Convert (0.625)₁₀ to binary. 0.625 × 2 = 1.25 → 1 0.25 × 2 = 0.5 → 0 0.5 × 2 = 1.0 → 1 (0.625)₁₀ = (0.101)₂
Q2 (2022): Show Booth's multiplication: 7 × (-3) in 4-bit. 7 = 0111, -3 = 1101 (2's complement) Apply Booth's algorithm: result = -21 = 101011 (6-bit 2's complement)
Q3 (2024): What is the speedup of a 5-stage pipeline over non-pipelined for 100 instructions? Without pipeline: 5 × 100 = 500 cycles With pipeline: 5 + (100-1) = 104 cycles Speedup = 500/104 ≈ 4.81×
Q4 (2023): Cache has hit time 10ns, main memory 200ns, hit rate 90%. Find average access time. Average = 0.9 × 10 + 0.1 × (10 + 200) = 9 + 21 = 30 ns
Complete COA notes for B.Tech CS Semester 4 — number systems, ALU design, CPU organization, memory hierarchy, cache, pipelining, and I/O systems with solved PYQs.
54 pages · 2.7 MB · Updated 2026-03-11
Architecture refers to attributes visible to the programmer (instruction set, data types, addressing modes). Organization refers to operational units and their interconnections — how the architecture is implemented.
Pipelining overlaps execution of multiple instructions. Hazards are problems that prevent smooth pipeline flow: structural (resource conflict), data (dependency), and control (branch) hazards.
DBMS Complete Notes — B.Tech CS Sem 4
Database Management Systems
Compiler Design — Complete Notes CS Sem 6
Compiler Design
Machine Learning Complete Notes — B.Tech CS Sem 6
Machine Learning
Engineering Mathematics 1 — Calculus, Matrices, Differential Equations
Engineering Mathematics 1
Programming Fundamentals Using C — Complete Notes
Programming Fundamentals (C)
Your feedback helps us improve notes and tutorials.