Computer Data Representation: Binary, Integers, Floating Point

Binary Encoding Fundamentals

  • Binary (Base 2): Each digit is 0 or 1.
  • Hexadecimal (Base 16): A compact representation of binary.
    • Example: 0x69B53A = 01101001 10110101 00111010 in binary.
  • Memory Addressing:
    • Big Endian: The most significant byte is stored at the lowest memory address.
    • Little Endian: The least significant byte is stored at the lowest memory address.

Unsigned Integers (B2U Encoding)

  • Range: 0 to 2^w - 1 (where w is the number of bits).
  • Addition: u + v mod 2^w (overflow discards the carry bit).
  • Subtraction:
Read More

Assembly Language and Computer Architecture Essentials

Chapter 7: IEEE 32-bit Float

IEEE 32-bit float representation includes:

  • 1 sign bit
  • An 8-bit biased exponent. To calculate, normalize the binary number to the 1.xxxx form, and add 127 (127 = 01111111 in binary).
  • 23 bits for the fraction (mantissa), using the binary number after the decimal.

Chapter 11: Assembly Language

General Purpose Registers

Registers hold temporary data and instructions:

  • %rdi (edi), %rsi (esi), %rdx (edx), %rcx, %rbx, %rax
  • %rsp: Stack Pointer – Points to the top of the stack.
  • %rbp: Base
Read More