💾Intro to Computer Architecture Unit 2 – Digital Logic and Data Representation

Digital logic and data representation form the foundation of computer architecture. These concepts cover binary systems, Boolean algebra, logic gates, and various number systems used in computing. Understanding these fundamentals is crucial for grasping how computers process and store information. This unit explores digital circuits, data representation methods, memory concepts, and arithmetic operations. It covers topics like ALU design, I/O systems, and practical applications of these principles in modern computing devices. Mastering these concepts is essential for designing and understanding computer systems.

Binary and Number Systems

  • Binary number system uses only two digits (0 and 1) to represent numbers and perform arithmetic operations
  • Decimal number system (base-10) is the most common number system used in everyday life and consists of digits 0 through 9
  • Hexadecimal number system (base-16) uses digits 0 through 9 and letters A through F to represent values
    • Commonly used in computer programming and memory addressing
  • Octal number system (base-8) employs digits 0 through 7 and is less frequently used in modern computing
  • Binary-coded decimal (BCD) represents each decimal digit with a fixed number of binary bits (usually four)
    • Used in financial calculations to avoid rounding errors
  • Converting between number systems is an essential skill in computer architecture
    • Examples include binary to decimal, hexadecimal to binary, and decimal to hexadecimal conversions

Boolean Algebra and Logic Gates

  • Boolean algebra is a mathematical system that operates on logical values (true or false) using logical operators (AND, OR, NOT)
  • AND gate produces a true output only when all inputs are true
    • Represented by the logical expression: ABA \cdot B or ABA \land B
  • OR gate produces a true output when at least one input is true
    • Represented by the logical expression: A+BA + B or ABA \lor B
  • NOT gate (inverter) produces the opposite logical value of its input
    • Represented by the logical expression: A\overline{A} or ¬A\lnot A
  • Exclusive OR (XOR) gate produces a true output when exactly one input is true
    • Represented by the logical expression: ABA \oplus B
  • NAND and NOR gates are universal gates that can be used to create any other logic gate
  • De Morgan's laws describe the relationship between logical operators and their negations
    • AB=A+B\overline{A \cdot B} = \overline{A} + \overline{B} and A+B=AB\overline{A + B} = \overline{A} \cdot \overline{B}

Digital Logic Circuits

  • Combinational logic circuits produce outputs that depend solely on the current inputs
    • Examples include adders, decoders, and multiplexers
  • Sequential logic circuits produce outputs that depend on both the current inputs and the previous state of the circuit
    • Examples include flip-flops, counters, and shift registers
  • Half adder is a combinational circuit that adds two single-bit numbers and produces a sum and a carry output
  • Full adder is a combinational circuit that adds three single-bit numbers (two operands and a carry-in) and produces a sum and a carry output
  • Multiplexer (MUX) is a combinational circuit that selects one of several input signals and forwards it to a single output based on a select signal
  • Demultiplexer (DEMUX) is a combinational circuit that takes a single input signal and directs it to one of several outputs based on a select signal
  • Flip-flops (e.g., D, JK, and T flip-flops) are basic sequential circuits used for storing state information

Data Representation in Computers

  • Unsigned integers are represented using a fixed number of bits, with the leftmost bit representing the most significant bit (MSB) and the rightmost bit representing the least significant bit (LSB)
  • Signed integers can be represented using various methods, such as sign-magnitude, one's complement, and two's complement
    • Two's complement is the most common representation for signed integers in modern computers
  • Floating-point numbers are represented using a format that includes a sign bit, exponent, and mantissa (significand)
    • IEEE 754 standard defines the most widely used floating-point formats (single-precision and double-precision)
  • Characters are typically represented using ASCII (American Standard Code for Information Interchange) or Unicode (e.g., UTF-8) encoding
  • Images are represented using formats such as bitmap (BMP), JPEG, and PNG, which store pixel information and metadata
  • Audio is represented using formats like WAV and MP3, which store sound wave information and compression data
  • Video is represented using formats such as AVI, MP4, and WebM, which store a sequence of images and audio data

Memory and Storage Concepts

  • Memory hierarchy organizes storage devices based on their speed, capacity, and cost
    • Registers, cache, main memory (RAM), and secondary storage (e.g., hard drives, SSDs)
  • Random Access Memory (RAM) is volatile memory that provides fast read and write access to stored data
    • Static RAM (SRAM) uses flip-flops to store data and is faster but more expensive than Dynamic RAM (DRAM)
    • Dynamic RAM (DRAM) uses capacitors to store data and requires periodic refreshing to maintain data integrity
  • Read-Only Memory (ROM) is non-volatile memory that stores permanent data and instructions
    • Examples include PROM, EPROM, and EEPROM
  • Cache memory is a high-speed memory located close to the processor that stores frequently accessed data and instructions
    • Levels of cache (L1, L2, L3) with increasing size and latency
  • Virtual memory is a technique that allows the operating system to use secondary storage as an extension of main memory
    • Paging and segmentation are common virtual memory management techniques
  • Endianness refers to the order in which bytes are arranged in a multi-byte data type
    • Little-endian (least significant byte first) and big-endian (most significant byte first) are the two main endianness formats

Arithmetic and Logic Unit (ALU)

  • ALU is a critical component of the processor that performs arithmetic and logical operations on data
  • Arithmetic operations include addition, subtraction, multiplication, and division
    • Adders (e.g., ripple carry adder, carry lookahead adder) are used to perform addition and subtraction
    • Multipliers (e.g., array multiplier, Booth's algorithm) are used to perform multiplication
    • Dividers (e.g., restoring divider, non-restoring divider) are used to perform division
  • Logical operations include AND, OR, NOT, XOR, and bit shifting
    • Bit shifting operations (e.g., logical shift, arithmetic shift, rotate) are used to move bits left or right within a data word
  • ALU also performs comparison operations (e.g., equal to, greater than, less than) for conditional branching and control flow
  • Floating-point arithmetic is performed using specialized floating-point units (FPUs) that adhere to the IEEE 754 standard
  • SIMD (Single Instruction, Multiple Data) extensions (e.g., SSE, AVX) allow the ALU to perform parallel operations on multiple data elements

Input/Output Systems

  • I/O systems enable communication between the computer and external devices
    • Examples include keyboards, mice, displays, printers, and network interfaces
  • Memory-mapped I/O treats I/O devices as memory locations, allowing the processor to access them using regular memory read and write instructions
  • Port-mapped I/O uses dedicated I/O instructions (e.g., IN, OUT) to access I/O devices through specific ports
  • Interrupts are signals generated by I/O devices to notify the processor of events that require attention
    • Interrupt handlers are software routines that process interrupts and perform the necessary actions
  • Direct Memory Access (DMA) allows I/O devices to access main memory directly, without the intervention of the processor
    • DMA controllers manage the transfer of data between I/O devices and memory
  • Buses (e.g., address bus, data bus, control bus) are communication pathways that connect the processor, memory, and I/O devices
    • Examples include PCI, PCIe, USB, and SATA
  • Protocols (e.g., TCP/IP, HTTP, USB) define the rules and formats for data exchange between devices

Practical Applications and Examples

  • Digital logic circuits are used in the design of processors, memory systems, and I/O controllers
    • Example: A 4-bit ripple carry adder can be constructed using four full adders connected in series
  • Boolean algebra and logic gates are used to optimize and simplify digital circuits
    • Example: A complex logic function can be minimized using Karnaugh maps or Boolean algebra identities
  • Data representation is crucial for storing and processing various types of information in computers
    • Example: A 32-bit signed integer using two's complement can represent values from -2^31 to 2^31-1
  • Memory hierarchy and storage concepts are essential for designing efficient and cost-effective computer systems
    • Example: A computer with a 64-bit address space, 16 GB of RAM, and a 512 GB SSD can efficiently manage memory and storage resources
  • ALU design is critical for the performance and functionality of processors
    • Example: A pipelined ALU can execute multiple instructions simultaneously, improving overall processor performance
  • I/O systems enable computers to interact with the external world and perform useful tasks
    • Example: A computer with a USB keyboard, a wireless mouse, and a high-resolution display can provide an effective user interface for various applications


© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.