Computer Architecture
Chapter
1: Computer Arithmetic
1.1 Introduction to Number Systems
In
our daily lives, we constantly use numbers for various tasks such as counting,
measuring, and performing calculations. The system we commonly use is the decimal system. However,
computers operate differently. They are electronic devices that work with
electrical signals, typically either "on"
(1) or "off"
(0). Because of this, computers use distinct methods to represent
and process numerical information.
A
number system
is a set of rules and symbols used to represent numerical values. The most
crucial characteristic of any number system is its base (radix). The base
tells us how many unique digits or symbols are available before we "carry
over" to the next position.
In
this section, we will explore the four number systems most relevant to computer
science: Decimal, Binary,
Octal, and Hexadecimal. Understanding these is essential for
learning how computers store and manipulate data.
1.1.1 The Decimal Number System
(Base-10)
This
is the number system used in everyday life. It is called Base-10 because it uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
·
Definition &
Uses: Used universally for calculations, money,
measurements, and daily operations.
·
Digits:
0–9.
Place Value Concept (Powers of 10):
Each
digit’s position determines its value:
·
Rightmost digit: 10⁰ = 1
·
Next digit: 10¹ = 10
·
Next: 10² = 100, and so on.
Example: 456
·
6 × 10⁰ = 6
·
5 × 10¹ = 50
·
4 × 10² = 400
Sum = 400 + 50 + 6 = 456
1.1.2 The Binary Number System (Base-2)
Binary
is the fundamental number system used by computers. It contains only two digits: 0 and 1, and
each digit is called a bit.
·
Why Binary?
Computers use electronic circuits with two states:
o
ON (1)
– High voltage
o
OFF (0)
– Low voltage
This
makes binary simple, reliable, and efficient.
·
Digits:
0 and 1.
Place Value Concept (Powers of 2):
Each
position represents a power of 2:
·
Rightmost bit: 2⁰ = 1
·
Next bit: 2¹ = 2
·
Next: 2² = 4, and so on.
Understanding Bits:
A
bit is the
smallest data unit. Groups of bits form larger units (e.g., 8 bits = 1 byte).
Example: 1101
·
1 × 2⁰ = 1
·
0 × 2¹ = 0
·
1 × 2² = 4
·
1 × 2³ = 8
Sum = 8 + 4 + 0 + 1 = 13
1.1.3 The Octal Number System (Base-8)
Octal
uses 8 digits: 0–7.
·
Digits:
0, 1, 2, 3, 4, 5, 6, 7.
Place Value Concept (Powers of 8):
·
Rightmost digit: 8⁰ = 1
·
Next digit: 8¹ = 8
·
Next: 8² = 64, and so on.
Historical Significance:
Each
octal digit equals 3
binary bits (2³ = 8), making it easier to read and write binary
in early computing.
Example: 37 (Octal)
·
7 × 8⁰ = 7
·
3 × 8¹ = 24
Sum = 24 + 7 = 31
1.1.4 The Hexadecimal Number System
(Base-16)
Hexadecimal
uses 16 symbols: 0–9 and
A–F, where:
·
A = 10
·
B = 11
·
C = 12
·
D = 13
·
E = 14
·
F = 15
·
Digits:
0–9 and A–F.
Place Value Concept (Powers of 16):
·
Rightmost digit: 16⁰ = 1
·
Next digit: 16¹ = 16
·
Next: 16² = 256, and so on.
Uses in Computing:
·
Memory addresses
·
Web colors
(e.g., #FF0000 = red)
·
MAC addresses
·
Error/debugging codes
Binary Connection:
One
hexadecimal digit equals 4
binary bits (2⁴
= 16).
Example: 2F (Hex)
·
F = 15 × 16⁰
= 15
·
2 × 16¹ = 32
Sum = 32 + 15 = 47