ComputerArchitecture_Notes
ComputerArchitecture_Notes
Number Systems
Decimal Number System (Base-10): Uses digits 0–9. It is the standard system for
human-centric arithmetic operations. Each digit has a place value that is a power of 10.
Binary Number System (Base-2): Uses only 0 and 1. Used internally by digital
computers and devices due to its compatibility with binary logic (transistors).
Octal Number System (Base-8): Uses digits 0 to 7. Often used in computing as a
shorthand for binary (3 bits = 1 octal digit).
Hexadecimal Number System (Base-16): Uses 0–9 and A–F. Widely used in
programming and digital systems to represent binary data more compactly (4 bits = 1
hex digit).
Alphanumeric Representation: Used for text processing and communication. Includes
letters, digits, and symbols encoded using standards like ASCII or Unicode.
Complements
1’s Complement: Represents negative numbers by inverting all bits of the number. For
example, 1’s complement of 1010 is 0101.
2’s Complement: Adds 1 to the 1’s complement. It simplifies arithmetic logic because
subtraction can be implemented as addition of a negative number.
9’s Complement: Found by subtracting each digit of a decimal number from 9. Used in
manual decimal subtraction.
10’s Complement: Found by adding 1 to the 9’s complement. It is the decimal analog of
2’s complement.
[r-1]’s and r’s Complement: Generalization of complements for any base r. Used for
error detection and subtraction in non-decimal systems.
Arithmetic Operations
Sign Magnitude Addition: Both numbers have sign bits. If signs are the same, add
magnitudes; if different, subtract the smaller magnitude from the larger and keep the
sign of the larger.
2’s Complement Addition: Handles positive and negative numbers uniformly. Add both
binary numbers and discard any final carry out.
2’s Complement Subtraction: Convert the subtrahend to its 2’s complement and perform
binary addition.
Example: 5 - 3 = 5 + (-3) = 0101 + 1101 = 0010 (2 in decimal)
Multiplication Algorithms
Binary Multiplication: Similar to decimal long multiplication. Shift multiplicand and add
to partial products based on the bits of multiplier.
Booth’s Algorithm: Optimizes multiplication of signed binary numbers by encoding
strings of 1s in the multiplier to reduce the number of additions/subtractions.
Division Algorithms
Restoring Division: Subtract divisor from partial dividend, restore if result is negative.
Non-Restoring Division: Continues without restoring the dividend even if result is
negative, simplifies logic.
Overflow Detection
Occurs when the result of an arithmetic operation exceeds the range that can be
represented with the given number of bits.
In 2’s complement: Overflow when adding two positives yields a negative, or two
negatives yield a positive.
Memory Transfers
Memory Read: Data is fetched from memory and placed into a register (e.g., MDR).
Memory Write: Data in a register is written to a memory location.
Micro-Operations
Arithmetic: ADD, SUB, INCREMENT, DECREMENT, etc.
Logic: AND, OR, NOT, XOR for performing bitwise logical operations.
Shift: Logical (fills with 0), Arithmetic (maintains sign), Circular (rotates bits).
Register Transfer: Simple move of data from one register to another.
Other Circuits
Binary Adder/Subtractor: A single circuit capable of both addition and subtraction
based on a control input.
Incrementer: Adds 1 to its input binary number.
Masking: Logical operation to isolate or zero out specific bits.
Selective Operations: Used to set, clear or complement specific bits using control logic.
Instruction Codes
Binary representations of operations supported by the computer. Each instruction
includes an opcode and possibly operand addresses.
Example: ADD 1000 might mean 'add the contents of memory location 1000 to the
accumulator'.
Basic Registers
AC (Accumulator): Temporary storage for arithmetic and logic results.
DR (Data Register): Holds memory operands.
AR (Address Register): Holds memory addresses.
IR (Instruction Register): Stores the current instruction.
PC (Program Counter): Points to the next instruction to be executed.
Addressing Modes
Direct: Address field contains the effective address of operand.
Indirect: Address field contains the location of memory that holds the address of the
operand.
Effective Address: The final address where data is located or needs to be stored.
Instruction Types
Memory Reference: Operate on memory data (e.g., LDA, STA).
Register Reference: Operate on CPU registers (e.g., CLA, CMA).
Input/Output: Control external devices (e.g., INP, OUT).
Instruction Cycle
Fetch: Get instruction from memory.
Decode: Determine operation and addressing mode.
Execute: Perform the specified operation.
Store: Save results back if necessary.
Control Memory
Microprogrammed control uses a control memory to store microinstructions that define
the control signals for each machine instruction.
Each instruction in the control memory triggers a sequence of control signals required
to execute machine-level instructions.
Address Sequencing
Defines how the address of the next microinstruction is determined.
Can be linear (incrementing) or based on branching (conditional/unconditional).
Stack Organization
LIFO structure useful for evaluating expressions and managing subroutine calls.
PUSH inserts data into the top of the stack, and POP removes it.
Implemented using a register called Stack Pointer (SP).
Instruction Formats
Specifies the layout of bits in an instruction, typically including operation code (opcode),
addressing mode bits, and operand fields.
Formats vary depending on CPU architecture.
Instruction Types
Three-address: Specifies two sources and one destination.
Two-address: One source is overwritten.
One-address: Uses accumulator implicitly.
Zero-address: Uses stack-based operations (e.g., postfix expressions).
Instruction Classification
Data Transfer: MOV, LOAD, STORE.
Data Manipulation: ADD, SUB, AND, OR.
Program Control: JMP, CALL, RETURN.
Interrupts
External: I/O operations or user actions.
Internal: Errors like division by zero or overflow.
Software: Generated by instructions such as system calls.
RISC vs CISC
RISC (Reduced Instruction Set Computing): Simple instructions, uniform instruction
format, faster execution.
CISC (Complex Instruction Set Computing): Rich set of instructions, fewer instructions
per program, complex decoding.
Unit 7: Pipeline and Vector Processing (Expanded)
Flynn’s Classification
SISD: Single instruction, single data stream.
SIMD: Single instruction, multiple data streams. Suitable for parallel tasks.
MISD: Rare in practice. Multiple instructions on single data stream.
MIMD: Multiple instruction and data streams. Used in multiprocessor systems.
Pipelining
Breaks instruction execution into discrete stages that operate in parallel.
Improves instruction throughput. Ideal speedup = number of stages.
Space-Time Diagram
Shows the overlap of instruction execution over time across pipeline stages.
Speedup
Speedup = Time without pipelining / Time with pipelining.
Not linear due to overheads and pipeline hazards.
Arithmetic Pipeline
Used to implement arithmetic operations like floating-point addition, multiplication.
Divides operation into smaller sub-operations performed in pipeline stages.
Peripheral Devices
Include keyboards, mice, printers, scanners, disk drives, etc.
Interface with CPU through I/O ports and controllers.
I/O Techniques
Isolated I/O: Separate I/O address space.
Memory Mapped I/O: Devices are addressed as if they are memory locations.
Memory Hierarchy
Organized by access speed and cost. Registers > Cache > Main Memory > Secondary
Storage.
Higher levels are faster and more expensive; lower levels are slower and cheaper.
Main Memory
RAM: Volatile memory used for active processes.
SRAM: Faster and expensive, used in cache.
DRAM: Slower and cheaper, used in main memory.
ROM: Non-volatile memory for permanent storage.
Cache Memory
Small, fast memory placed between CPU and RAM.
Mapping Techniques:
Direct Mapping: Each block maps to exactly one cache line.
Associative Mapping: Any block can go into any cache line.
Set-Associative Mapping: A combination of both.
Virtual Memory
Provides illusion of large memory using disk space.
Divides memory into pages or segments.
Handles page faults and uses TLB for address translation.
Auxiliary Memory
Non-volatile memory such as hard disks, SSDs, CDs, magnetic tapes.
Used for long-term data storage.
Timing Terminologies
Seek Time: Time to move the read/write head to desired track.
Rotational Delay: Time waiting for desired sector to rotate under head.
Access Time: Sum of seek time and rotational delay.
Transfer Time: Time taken to actually read/write the data.
Latency: Overall delay in data retrieval.