CH02

Chapter 2: Data Representation in Computer Systems

Objectives

  • Understand the fundamentals of numerical data representation and manipulation in digital computers.

  • Master the skill of converting between various radix systems.

  • Understand how errors can occur in computations due to overflow and truncation.

  • Comprehend fundamental concepts of floating-point representation.

  • Familiarize with popular character codes.

  • Understand concepts of error detecting and correcting codes.

2.1 Introduction

Basic Units

  • Bit: The most basic unit of information. Represents a state of "on" or "off" or "high" or "low" voltage in digital circuits.

  • Byte: Comprising eight bits, it's the smallest addressable unit of computer storage, retrievable by location.

  • Word: A contiguous group of bytes, typically 16, 32, or 64 bits. In a word-addressable system, it's the smallest addressable unit.

  • Nibble: Comprised of four bits, making a byte consist of two nibbles (high-order and low-order).

2.2 Positional Numbering Systems

  • Binary System: Base-2 system; utilizes powers of 2, essential for data representation in digital systems.

  • Decimal System: Base-10 system; employs powers of 10 for digit position.

  • Any integer can be exactly represented using any base (radix).

2.3 Converting Between Bases

Importance of Binary

  • Proficiency in binary numbering is crucial for understanding computer operations and instruction set design.

Methods for Radix Conversion

  • Subtraction Method: Intuitive but cumbersome; reinforces radix mathematics.

  • Division Remainder Method: A more mechanical method used for certain conversions.

  • Example: Converting decimal 538 to base 8 via the division method:

    • Divide by 8, noting quotients and remainders until the quotient is zero.

Fractional Base Conversion

  • Fractional numbers can be approximated in various bases, though not all fractions can be represented exactly.

  • Methods include subtraction and multiplication methods, starting from the largest negative or positive powers of the radix.

2.4 Signed Integer Representation

Positive and Negative Values

  • High-order bit indicates sign: 0 for positive, 1 for negative.

  • Representations:

    • Signed Magnitude: Stores magnitude in bits, high-order bit for sign.

    • One’s Complement: Flips bits for negative representation.

    • Two’s Complement: Adds 1 to one’s complement representation, allowing seamless arithmetic.

Addition of Signed Numbers

  • Simple binary addition rules apply, with carry handling for signed magnitude.

  • Example operations illustrate how to manage signs in calculations.

Challenges with Signed Magnitude and One’s Complement

  • Both representations complicate arithmetic; two’s complement is preferred for simplicity.

2.5 Floating-Point Representation

Importance

  • Necessary for accurately representing real numbers in scientific and business applications.

Components of Floating-Point Numbers

  • Composed of sign bit, exponent, and significand.

  • Normalization enforces a unique representation for floating-point values.

IEEE Floating-Point Standards

  • IEEE-754 standards define structures for single and double-precision representations, ensuring consistency across systems.

Floating-Point Arithmetic

  • Addition and multiplication require alignment of exponents and adjustments of significands.

  • Errors arise due to limitations in precision; careful handling of calculations is necessary.

2.6 Character Codes

  • Essential for displaying numerical results and data input.

Early Character Codes

  • 6-bit systems like BCD were foundational; evolved to 8-bit EBCDIC and 7-bit ASCII.

  • ASCII dominated outside IBM systems but has been largely replaced by 16-bit Unicode, accommodating all global characters.

2.7 Error Detection and Correction

Overview

  • Given the imperfection of data storage/transmission, error detection/correction is vital.

  • Check Digits: Simple forms used in barcodes; more complex mechanisms like CRC codes for larger data blocks.

Error Correcting Codes

  • Hamming Codes: Allow for error detection and correction through redundancy in parity bits.

  • Determining the minimum necessary parity bits allows for specific error correction capabilities.

Conclusion

  • Data representation encompasses binary systems, hexadecimal notation, signed integers, floating-point standards, and character codes, laying foundational knowledge for computer science.

  • Error detecting and correction mechanisms, including CRC and Hamming codes, are pivotal to ensure data integrity.

robot