Add two positive 8-bit binary integers

📚 Data Representation: Adding Two Positive 8‑bit Binary Integers

What is an 8‑bit Binary Integer?

An 8‑bit binary integer uses 8 binary digits (bits) to represent a number. Each bit can be 0 or 1, and the value of the number is calculated as: $$\displaystyle N = b_7\cdot2^7 + b_6\cdot2^6 + \dots + b_1\cdot2^1 + b_0\cdot2^0$$ where $b_7$ is the most significant bit (MSB) and $b_0$ the least significant bit (LSB).

🔢 Example: Adding 01100101 and 01011011

  1. Write the numbers one under the other, aligning the bits:
  2.   01100101
    + 01011011
      --------
      
  3. Start from the rightmost bit (LSB) and add column by column, keeping track of the carry.
  4. Use the binary addition table:
  5. Bit 1 Bit 2 Sum Carry
    0 1 1 0
    1 1 0 1
  6. Continue until all bits are processed. The final binary result is 11000000.
  7. Convert to decimal to check: $11000000_2 = 128 + 64 = 192$.

🧮 Quick Check: Why 192?

01100101₂ = 101 + 64 + 32 + 8 + 1 = 101 + 64 + 32 + 8 + 1 = 106 01011011₂ = 64 + 32 + 8 + 2 + 1 = 107 106 + 107 = 213, but we only have 8 bits, so we ignore the overflow beyond 8 bits. The correct sum within 8 bits is 11000000₂ = 192. (In this example we actually need to consider overflow; the real sum 213 would require 9 bits.)

💡 Exam Tip: Handling Overflow

• Always check if the result fits in 8 bits. • If there is a carry out of the MSB, it is discarded in unsigned 8‑bit addition. • In exam questions, they may ask you to state whether overflow occurs. • Remember: 255 (11111111₂) is the maximum unsigned 8‑bit value. Anything above it wraps around.

🤔 Analogy: Binary Addition as Counting Cups

Imagine each bit as a cup that can hold either 0 or 1 cup of water. When you add two cups, if both have water (1+1), you pour the water into a bigger cup (carry) and leave 0 in the original cup. This is exactly how binary addition works: 1+1 = 0 with a carry of 1. Visualising it this way helps you remember the carry rule without getting lost in numbers.

📝 Quick Practice Problem

  1. Add 10101010 and 01010101.
  2. Show your work column by column.
  3. State the final 8‑bit result and its decimal equivalent.
  4. Did overflow occur? Explain.

Revision

Log in to practice.

0 views 0 suggestions