Computer Architecture: Digital Logic
& System Organization
Introduction to Digital
Logic
What is Digital Logic?
• Foundation of all digital systems and computers
• Works with discrete values (0 and 1)
representing OFF and ON states
• Uses Boolean algebra for logical operations
• Building blocks for complex digital circuits
Key Concepts:
• Binary number system (Base-2)
• Logic levels: Logic 0 (LOW) and Logic 1 (HIGH)
• Boolean variables and functions
Basic Logic Gates
• AND Gate
• Output is 1 only when ALL inputs
are 1
• Symbol: D-shaped with flat input
side
• Truth Table: A·B or A∧B
OR Gate
• Output is 1 when ANY input is 1
• Symbol: Curved input side
• Truth Table: A+B or A∨B
NOT Gate (Inverter)
• Output is opposite of input
• Symbol: Triangle with small circle
• Truth Table: Ā or ¬A
Derived
Logic Gates
• NOR Gate
• NOT-OR combination
• Output is 1 only when
ALL inputs are 0
• Can implement any
logic function
NAND Gate
• NOT-AND combination
• Output is 0 only when ALL
inputs are 1
• Can implement any logic
function
Other Gates:
• XOR (Exclusive OR): Output is 1 when inputs are different
• XNOR (Exclusive NOR): Output is 1 when inputs are same
Combinational vs
Sequential Circuits
Combinational Circuits:
• Output depends only on current inputs
• No memory element
• Examples: Adders, Multiplexers, Decoders,
Encoders
Sequential Circuits:
• Output depends on current inputs AND
previous state
• Contains memory elements (flip-flops, latches)
• Examples: Counters, Registers, State
machines
Block Structure of Computers
Von Neumann Architecture
Basic Computer Organization:
• Central Processing Unit (CPU)
• Memory Unit
• Input/Output (I/O) Units
• System Bus
Key Principle:
• Stored program concept
• Instructions and data stored in same memory
• Sequential execution of instructions
Central Processing Unit (CPU)
Major Components:
• Arithmetic Logic Unit (ALU)
• Performs arithmetic operations (+, -, ×, ÷)
• Performs logical operations (AND, OR, NOT,
XOR)
• Generates status flags (Zero, Carry, Overflow,
Sign)
• Control Unit (CU)
• Fetches instructions from memory
• Decodes instructions
• Generates control signals
• Coordinates CPU operations
• Registers
• High-speed storage locations
• Store temporary data and addresses
General Purpose Registers :
• Store data temporarily during operations
• Examples: AX, BX, CX, DX (in x86)
• Accumulator: Stores ALU results
Special Purpose Registers :
Program Counter (PC): Stores address of
next instruction
Instruction Register (IR): Holds current
instruction
Memory Address Register (MAR): Holds
memory address
Memory Data Register (MDR): Holds data
from/to memory
Status Register: Contains condition flags
CPU Registers
• Bus Types:
• Address Bus
• Carries memory addresses
• Unidirectional (CPU to Memory/I/O)
• Width determines addressable memory
• Data Bus
• Carries data between components
• Bidirectional
• Width affects data transfer rate
• Control Bus
• Carries control signals
• Examples: Read, Write, Clock, Reset
System Bus Architecture
communication between
Processor and I/O Devices
I/O Organization
I/O Device Categories:
• Input Devices: Keyboard, Mouse, Scanner
• Output Devices: Monitor, Printer, Speaker
• Storage Devices: Hard Disk, USB Drive
• Communication Devices: Network Interface,
Modem
I/O Characteristics:
• Much slower than CPU and memory
• Different data formats and protocols
• Varying data transfer rates
Programmed I/O (Polling)
• CPU directly controls I/O operations
• CPU continuously checks device status
• Simple but inefficient (CPU wastage)
Interrupt-Driven I/O
I/O Interfacing • Device signals CPU when ready
• CPU can perform other tasks while waiting
Methods • More efficient than polling
Direct Memory Access (DMA)
• I/O device directly accesses memory
• CPU involvement minimal
• Highest efficiency for large data transfers
What is an Interrupt?
• A signal that temporarily suspends
normal program execution
• Allows CPU to respond to urgent events
• Mechanism for asynchronous event
handling
Why Interrupts?
• Efficient I/O handling
Interrupts • Real-time event processing
• System error handling
• Multitasking support
Interrupt vs Polling:
• Interrupt: Event-driven, efficient
• Polling: Continuous checking, wasteful
• Hardware Interrupts
• Generated by external devices
• Examples: Timer, keyboard, disk drive
• Asynchronous (unpredictable timing)
Software Interrupts
• Generated by executing special instructions
• Examples: System calls, trap instructions
Types of • Synchronous (predictable timing)
Interrupts Internal Interrupts (Exceptions)
• Generated by CPU itself
• Examples: Division by zero, page fault
• Error conditions and special situations
Priority Levels:
• Multiple interrupt sources need priority
• Higher priority interrupts can preempt lower ones