ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Computer Organization and Assembly Language
    COMP2118
    Progress0 / 35 topics
    Topics
    1. Introduction to Computer Systems2. Information is Bits + Context3. Programs are Translated by Other Programs4. Understanding Compilation Systems5. Processors Read and Interpret Instructions6. Caches Matter7. Storage Devices Form a Hierarchy8. The Operating System Manages the Hardware9. Systems Communicate Using Networks10. Representing and Manipulating Information11. Information Storage12. Integer Representations13. Integer Arithmetic14. Floating Point15. Machine-Level Representation of Programs16. A Historical Perspective17. Program Encodings18. Data Formats19. Accessing Information20. Arithmetic and Logical Operations21. Control22. Procedures23. Array Allocation and Access24. Heterogeneous Data Structures25. Understanding Pointers26. Using the GDB Debugger27. Out-of-Bounds Memory References and Buffer Overflow28. x86-64: Extending IA-32 to 64 Bits29. Machine-Level Representations of Floating-Point Programs30. Processor Architecture31. The Y86 Instruction Set Architecture32. Logic Design and the Hardware Control Language (HCL)33. Sequential Y86 Implementations34. General Principles of Pipelining35. Pipelined Y86 Implementations
    COMP2118›Representing and Manipulating Information
    Computer Organization and Assembly LanguageTopic 10 of 35

    Representing and Manipulating Information

    5 minread
    929words
    Intermediatelevel

    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 load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time5 min
      Word count929
      Code examples0
      DifficultyIntermediate