0% found this document useful (0 votes)
5 views

Number Systems

The document explains various number systems, including decimal, binary, octal, and hexadecimal, detailing their bases, place values, and applications. It also describes the functions and operations of an Arithmetic Logic Unit (ALU) within a CPU, highlighting its role in performing arithmetic and logical operations. The ALU's components, such as input registers and the control unit, are outlined, along with examples of how it executes operations like addition and logical comparisons.

Uploaded by

Hasaan ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Number Systems

The document explains various number systems, including decimal, binary, octal, and hexadecimal, detailing their bases, place values, and applications. It also describes the functions and operations of an Arithmetic Logic Unit (ALU) within a CPU, highlighting its role in performing arithmetic and logical operations. The ALU's components, such as input registers and the control unit, are outlined, along with examples of how it executes operations like addition and logical comparisons.

Uploaded by

Hasaan ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Number Systems

A number system is a writing system for expressing numbers in a consistent manner. It provides
a standard for counting and performing arithmetic operations. Number systems are categorized
based on their base or radix, and the base refers to the number of unique digits used in the
system.

Types of Number Systems

1. Decimal Number System (Base-10):


o Most Common: The decimal system is the standard system for denoting integer
and non-integer numbers. It is based on 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
o Place Value: Each position represents a power of 10. For example, 345 can be
expressed as:

3×102+4×101+5×1003 \times 10^2 + 4 \times 10^1 + 5 \times


10^03×102+4×101+5×100

o Used in Everyday Life: Used for most human applications, including counting,
calculations, and financial transactions.
2. Binary Number System (Base-2):
o Used in Computers: Computers use the binary system, which consists of only
two digits: 0 and 1. These correspond to the off and on states of electrical circuits.
o Place Value: Each position represents a power of 2. For example, 1011 (in
binary) can be expressed as:

1×23+0×22+1×21+1×20=11 (in decimal)1 \times 2^3 + 0 \times 2^2 + 1 \times


2^1 + 1 \times 2^0 = 11 \text{ (in
decimal)}1×23+0×22+1×21+1×20=11 (in decimal)

o Importance in Digital Electronics: Binary is foundational to all digital


computing and electronics.
3. Octal Number System (Base-8):
o Uses 8 Digits: The octal system uses digits from 0 to 7.
o Place Value: Each position represents a power of 8. For example, 175 (in octal)
can be expressed as:

1×82+7×81+5×80=1×64+7×8+5×1=125 (in decimal)1 \times 8^2 + 7 \times 8^1 +


5 \times 8^0 = 1 \times 64 + 7 \times 8 + 5 \times 1 = 125 \text{ (in
decimal)}1×82+7×81+5×80=1×64+7×8+5×1=125 (in decimal)

o Compact Representation: Often used in computing for a more compact


representation of binary data.
4. Hexadecimal Number System (Base-16):
o Uses 16 Digits: The hexadecimal system uses digits from 0 to 9 and letters A to
F, where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.
o Place Value: Each position represents a power of 16. For example, 2F3 (in
hexadecimal) can be expressed as:

2×162+15×161+3×160=2×256+15×16+3×1=755 (in decimal)2 \times 16^2 + 15


\times 16^1 + 3 \times 16^0 = 2 \times 256 + 15 \times 16 + 3 \times 1 = 755
\text{ (in decimal)}2×162+15×161+3×160=2×256+15×16+3×1=755 (in decimal)

o Use in Computing: Hexadecimal is often used in programming and debugging to


represent binary data in a more readable format.
5. Other Number Systems:
o Roman Numerals: An ancient number system using letters (I, V, X, L, etc.).
o Unary System: A base-1 system, which only uses one symbol (typically 1), used
for counting.

Conversion Between Number Systems

1. Binary to Decimal:
o For example, converting binary 1010 to decimal:

1×23+0×22+1×21+0×20=8+2=101 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 0


\times 2^0 = 8 + 2 = 101×23+0×22+1×21+0×20=8+2=10

2. Decimal to Binary:
o To convert decimal 10 to binary, repeatedly divide by 2 and note the remainders:

10÷2=5 (remainder 0)5÷2=2 (remainder 1)2÷2=1 (remainder 0)1÷2=0 (remainder


1)10 \div 2 = 5 \text{ (remainder 0)} \\ 5 \div 2 = 2 \text{ (remainder 1)} \\ 2 \div
2 = 1 \text{ (remainder 0)} \\ 1 \div 2 = 0 \text{ (remainder
1)}10÷2=5 (remainder 0)5÷2=2 (remainder 1)2÷2=1 (remainder 0)1÷2=0 (remain
der 1)

Thus, 10 in decimal is 1010 in binary.

3. Binary to Hexadecimal:
o Group binary digits into sets of 4 and convert each group to its hexadecimal
equivalent. For example, 11010111 (binary) becomes D7 (hexadecimal).

How an ALU (Arithmetic Logic Unit) Works


The Arithmetic Logic Unit (ALU) is a fundamental component of a computer's central
processing unit (CPU). It performs both arithmetic operations (like addition, subtraction,
multiplication) and logical operations (like AND, OR, NOT). The ALU is essential for
executing most of the instructions in a computer program.

Functions of the ALU

1. Arithmetic Operations:
o Addition: The ALU adds numbers using binary arithmetic. For example, adding
1101 (13) and 1011 (11) gives 11000 (24) in binary.
o Subtraction: The ALU performs binary subtraction, using techniques like two's
complement to represent negative numbers.
o Multiplication: It can multiply numbers using algorithms like shift-and-add or
Booth's algorithm.
o Division: Similar to multiplication, it uses algorithms to divide binary numbers.
2. Logical Operations:
o AND: The ALU performs a logical AND operation where the result is 1 only if
both operands are 1.
o OR: The ALU performs a logical OR operation where the result is 1 if at least one
operand is 1.
o NOT: The ALU performs a logical NOT operation, flipping the bits (1 becomes 0
and vice versa).
o XOR: The ALU performs a logical XOR operation, where the result is 1 if
exactly one of the operands is 1.
3. Comparison Operations:
o Equal to (==): The ALU checks if two values are equal.
o Greater than (>): The ALU compares two values to see if one is greater than the
other.
o Less than (<): The ALU compares two values to see if one is less than the other.

How the ALU Works

The ALU is typically composed of several key components that allow it to perform operations:

1. Input Registers:
o The ALU receives input data from registers in the CPU. These inputs are typically
two binary numbers (operands) that will be operated on.
2. Control Unit:
o The control unit of the CPU signals the ALU on which operation to perform
(addition, subtraction, AND, OR, etc.) based on the instruction currently being
executed.
3. Operation Unit:
o The operation unit performs the actual arithmetic or logical operations. For
example, an adder is used for addition, a subtractor for subtraction, and so on.
4. Output:
o After the ALU performs the desired operation, the result is stored in a register or
sent to memory.
5. Flags:
o The ALU may also set flags in a status register based on the outcome of
operations. Common flags include:
 Zero Flag (Z): Set if the result is 0.
 Carry Flag (C): Set if there’s a carry out from an operation (important for
addition).
 Overflow Flag (O): Set if there’s an overflow in an arithmetic operation.
 Negative Flag (N): Set if the result is negative.

How ALU Performs Arithmetic Operations

Let’s take an example of binary addition. Adding 1101 (13) and 1011 (11):

 Perform bit-by-bit addition, starting from the least significant bit:

yaml
CopyEdit
1101

 1011

11000

markdown
CopyEdit

- In this case, we get a carry at the second position, which is handled by


the ALU.

For **subtraction** using two’s complement, the ALU would invert the bits of
the second operand (the number to be subtracted) and then add 1. This way,
the ALU performs subtraction just like addition, but with the second operand
in its negative form.

### **How ALU Performs Logical Operations**

- For **AND**, the ALU applies the following rule:


- **1 AND 1 = 1**
- **1 AND 0 = 0**
- **0 AND 1 = 0**
- **0 AND 0 = 0**

Example:

1101 (13) AND 1011 (11) = 1001 (9)


markdown
CopyEdit

- For **OR**, the ALU applies the rule:


- **1 OR 1 = 1**
- **1 OR 0 = 1**
- **0 OR 1 = 1**
- **0 OR 0 = 0**

Example:

1101 (13) OR 1011 (11) = 1111 (15)

pgsql
CopyEdit

---

### **Conclusion**

The **number system** is the foundation of all computational processes, and


different systems (binary, decimal, hexadecimal, etc.) are used for various
applications in computing. The **ALU** plays a crucial role in executing
arithmetic and logical operations in a CPU, enabling it to perform
calculations, comparisons, and decision-making processes that power software
applications and operating systems.

If you’d like more details on a specific part of this explanation or have


additional questions, feel free to ask!
4o mini

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy