ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP2118Representing Manipulat…
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP2118

    Computer Organization and Assembly Language

    Progress0 / 35 done
    Topics35
    1Introduction to Computer Systems2Information is Bits + Context3Programs are Translated by Other Programs4Understanding Compilation Systems5Processors Read and Interpret Instructions6Caches Matter7Storage Devices Form a Hierarchy8The Operating System Manages the Hardware9Systems Communicate Using Networks10Representing and Manipulating Information11Information Storage12Integer Representations13Integer Arithmetic14Floating Point15Machine-Level Representation of Programs16A Historical Perspective17Program Encodings18Data Formats19Accessing Information20Arithmetic and Logical Operations21Control22Procedures23Array Allocation and Access24Heterogeneous Data Structures25Understanding Pointers26Using the GDB Debugger27Out-of-Bounds Memory References and Buffer Overflow
    28Extending IA-32 to 64 Bits29Machine-Level Representations of Floating-Point Programs30Processor Architecture31The Y86 Instruction Set Architecture32Logic Design and the Hardware Control Language (HCL)33Sequential Y86 Implementations34General Principles of Pipelining35Pipelined Y86 Implementations
    5 min read
    Topic 10 of 35
    Topic Study Note Illustration
    10

    Representing and Manipulating Information

    In computer systems, information is represented and manipulated using binary numbers, which consist of sequences of bits (0s and 1s). Understanding how information is represented and manipulated...

    Representing and Manipulating Information

    In computer systems, information is represented and manipulated using binary numbers, which consist of sequences of bits (0s and 1s). Understanding how information is represented and manipulated is fundamental to computer science because all data—whether it's text, images, or instructions—must be translated into binary form to be processed by computers.

    1. Binary Representation

    • Bits and Bytes:
      • Bit: The smallest unit of data in a computer, represented as either 0 or 1.
      • Byte: A group of 8 bits, which can represent 256 different values (from 0 to 255).
    • Binary System: Computers use the binary (base-2) number system, where each digit is either 0 or 1. For example, the binary number 1011 represents the decimal number 11.

    2. Representing Different Types of Information

    • Numbers:

      • Unsigned Integers: Represent non-negative whole numbers. For example, the binary number 1010 represents the decimal number 10.
      • Signed Integers: Represent both positive and negative numbers, typically using a method called two's complement. For instance, the binary number 11111101 represents -3 in two's complement.
      • Floating-Point Numbers: Used to represent real numbers (numbers with fractional parts), typically following the IEEE 754 standard. Floating-point representation involves dividing a number into three parts: sign, exponent, and mantissa.
    • Characters:

      • ASCII: The American Standard Code for Information Interchange (ASCII) represents characters (letters, digits, punctuation) as binary numbers. For example, the character 'A' is represented by the binary number 01000001.
      • Unicode: A more comprehensive standard that supports characters from many different languages, with each character represented by one or more bytes.
    • Colors:

      • RGB: Colors are often represented using the RGB model, where each color is a combination of red, green, and blue values. Each of these values is typically an 8-bit number, so a full color can be represented by 24 bits (8 bits per color).

    3. Manipulating Information

    • Logical Operations:

      • AND: Takes two binary inputs and returns 1 if both are 1, otherwise returns 0. For example, 1101 AND 1011 yields 1001.
      • OR: Returns 1 if at least one of the inputs is 1. For example, 1101 OR 1011 yields 1111.
      • NOT: Inverts the bits (0 becomes 1, and 1 becomes 0). For example, NOT 1101 yields 0010.
      • XOR (Exclusive OR): Returns 1 if the inputs are different. For example, 1101 XOR 1011 yields 0110.
    • Arithmetic Operations:

      • Addition: Binary addition is similar to decimal addition but follows the rules of the binary system. For example, 1011 + 0110 yields 10001.
      • Subtraction: Binary subtraction can be performed using two's complement. For example, to subtract 0110 from 1011, convert 0110 to its two's complement and add: 1011 + 1010 yields 0101.
      • Multiplication: Binary multiplication involves shifting and adding. For example, multiplying 101 by 11 involves shifting 101 by one place to the left and adding the original number: 101 * 11 yields 1111.

    4. Data Types and Their Representation

    • Integers: Represented using a fixed number of bits. The number of bits determines the range of values that can be represented. For example, an 8-bit unsigned integer can represent values from 0 to 255.
    • Floating-Point Numbers: Represented using a sign bit, an exponent, and a mantissa. The IEEE 754 standard defines how these components are used to represent real numbers.
    • Characters: Represented using character encoding standards like ASCII or Unicode.

    5. Bitwise Operations

    • Bitwise Shift Operations:

      • Left Shift (<<): Shifts the bits of a number to the left, effectively multiplying the number by a power of two. For example, 0010 << 1 yields 0100.
      • Right Shift (>>): Shifts the bits of a number to the right, effectively dividing the number by a power of two. For example, 0100 >> 1 yields 0010.
    • Masking:

      • Bit Masking: A technique used to extract or modify specific bits in a number. For example, applying a mask of 00001111 to a number using the AND operation will zero out all but the last four bits.

    6. Representation of Negative Numbers

    • Two's Complement: The most common method for representing negative numbers in binary. To find the two's complement of a number:

      1. Invert all the bits (change 0s to 1s and 1s to 0s).
      2. Add 1 to the inverted number.

      For example, the two's complement of 00000011 (which is 3) is 11111101, which represents -3.

    7. Overflow and Underflow

    • Overflow: Occurs when a calculation produces a result that is too large to be represented within the allotted number of bits. For example, adding 11111111 (255 in 8-bit) and 00000001 (1) results in 00000000 due to overflow.
    • Underflow: Occurs when a calculation produces a result that is too small (or too close to zero) to be represented within the allotted number of bits for floating-point numbers.

    8. Example: Representing and Manipulating Text

    • Text Representation: Suppose you want to store the word "HELLO". Each letter is represented by its ASCII code:

      • H: 01001000
      • E: 01000101
      • L: 01001100
      • L: 01001100
      • O: 01001111

      These binary numbers are stored in memory and manipulated as needed (e.g., for searching, editing).

    Conclusion

    Representing and manipulating information in binary form is at the heart of how computers operate. Whether it's processing numbers, text, images, or any other type of data, understanding binary representation and the associated operations is crucial for working with computers at a fundamental level. This knowledge allows you to appreciate how computers perform complex tasks, from simple calculations to running sophisticated software applications.

    ← Previous topic 9
    Systems Communicate Using Networks
    Next topic 11 →
    Information Storage

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    5mremaining
    929words
    Intermediatelevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Computer Organization and Assembly Language