Foundation of computing
Foundation of computing
Binary representation of data and numbers, Integer Representation, Data storage units
bits, bytes, kilobytes, etc., ASCII and Unicode, CPU Architecture and Instruction Set:
Basic CPU architecture ALU, registers, control unit, Instruction format and assembly
language (basics only) Fetch- execute cycle and instruction execution.
N
IO
AT
C
U
ED
E
IV
What is Binary?
EE
1
BEETECH FEB2025
2. Reliability
N
● Error Reduction:
IO
○ Binary signals are less prone to distortion compared to analog
signals or systems with multiple states.
AT
○ Example: A signal can either be high (1) or low (0), making it
easier to detect and correct errors.
● Noise Immunity: Binary systems are more resistant to electrical
C
noise because small fluctuations in voltage won't affect the
U
interpretation of 0 or 1.
ED
3. Cost-Effectiveness and Scalability
● Circuit Design:
○ Digital circuits (e.g., logic gates like AND, OR, NOT) are built
E
4. Universality
2
BEETECH FEB2025
N
IO
AT
C
U
ED
Representation of Negative Integers
E
IV
H
EE
B
3
BEETECH FEB2025
N
IO
AT
C
U
ED
b. Practical Examples:
4
BEETECH FEB2025
N
● Text: Characters are encoded as binary numbers using standards
IO
like ASCII or Unicode.
Example:
AT
○ A=01000001 in binary (ASCII).
● Images: Stored as a grid of pixels, each represented in binary (e.g.,
grayscale uses 8 bits per pixel).
C
● Audio: Sampled and quantized into binary values during
U
analog-to-digital conversion.
ED
ASCII (American Standard Code for Information Interchange)
What is ASCII?
○ Numbers (0-9).
○ Symbols (*, %, @).
EE
Representation of Characters:
B
● Example:
○ A=65, B=66.
○ a=97, b=98.
○ Space = 32.
c. Limitations of ASCII:
5
BEETECH FEB2025
Unicode
N
● Provides a universal encoding system for all languages and symbols.
● Supports over 1.1 million characters.
IO
UTF-8, UTF-16, and UTF-32:
AT
● UTF-8: Variable-length encoding (1-4 bytes). Compatible with ASCII.
Most common.
● UTF-16: Uses 2-4 bytes per character.
C
● UTF-32: Uses 4 bytes per character (fixed).
U
Importance in Multilingual Systems:
ED
● Enables the representation of languages like Hindi, Chinese, Arabic,
etc.
● Essential for web applications, text processing, and global software.
E
IV
H
EE
B
6
BEETECH FEB2025
N
IO
AT
C
U
ED
E
IV
H
EE
B
7
BEETECH FEB2025
N
IO
AT
C
U
ED
E
IV
H
EE
B
8
BEETECH FEB2025
N
IO
AT
C
U
ED
E
IV
H
EE
B
9
BEETECH FEB2025
N
IO
AT
C
U
ED
E
IV
H
EE
B
10
BEETECH FEB2025
N
IO
AT
C
U
ED
11
BEETECH FEB2025
N
IO
AT
C
2. Main Components of a CPU
U
ED
a) Arithmetic and Logic Unit (ALU)
decision-making.
● Acts as the calculator of the CPU.
H
b) Registers
EE
Registers are small, high-speed memory units inside the CPU that
temporarily store data and instructions. Types of registers include:
B
12
BEETECH FEB2025
N
The Instruction Set is a collection of machine-level commands that a CPU
IO
understands. Each CPU family (Intel, ARM, etc.) has its own ISA.
Types of Instructions
AT
1. Data Transfer Instructions
○ MOV (Move data)
C
○ LOAD (Load data from memory)
U
○ STORE (Store data in memory)
2. Arithmetic Instructions
ED
○ ADD (Addition)
○ SUB (Subtraction)
○ MUL (Multiplication)
○ DIV (Division)
E
13
BEETECH FEB2025
N
IO
AT
There are two main types of ISAs based on instruction complexity:
C
U
ED
E
IV
Instruction Format
H
General Format:
14
BEETECH FEB2025
N
1. Zero-Address Instructions (Stack-Based):
IO
○ No operands (e.g., PUSH, POP).
○ Used in stack-based architectures.
2. One-Address Instructions:
AT
○ One operand (e.g., INC AL).
○ Usually operates on an accumulator register.
C
3. Two-Address Instructions:
○ Two operands (e.g., MOV AX, BX).
U
○ First operand is usually the destination, second is the source.
ED
4. Three-Address Instructions:
○ Three operands (e.g., ADD R1, R2, R3).
○ Used in RISC architectures.
E
IV
15
BEETECH FEB2025
N
IO
AT
C
U
ED
E
3. Registers in Assembly
IV
Registers are small storage locations inside the CPU for fast operations.
H
EE
B
16
BEETECH FEB2025
N
IO
AT
4. Addressing Modes (Ways to Access Data)
C
U
ED
E
IV
17
BEETECH FEB2025
Fetch-Execute Cycle
Every instruction follows a Fetch-Decode-Execute cycle:
N
Example: Adding two numbers
IO
1. Fetch: CPU fetches ADD A, B from memory.
AT
2. Decode: CPU identifies this as an addition instruction.
3. Execute: ALU performs A + B, and stores the result in A
C
U
ED
E
IV
H
EE
B
18
BEETECH FEB2025
N
IO
AT
C
U
ED
E
IV
H
● The Program Counter (PC) holds the address of the next instruction.
● The instruction is fetched from memory (RAM) and loaded into the
Instruction Register (IR).
● The PC is updated to point to the next instruction.
19
BEETECH FEB2025
📌 Example:
If the instruction at memory address 1000 is ADD A, B, it is fetched into
the Instruction Register (IR).
N
● It determines the operands (data on which the operation will be
IO
performed).
📌 Example:
AT
The control unit decodes ADD A, B, identifying it as an addition
operation.
C
Step 3: Execute the Instruction
U
● The Arithmetic and Logic Unit (ALU) or registers execute the
ED
instruction.
● The operation is performed on the specified data.
📌 Example:
E
The ALU adds values in register A and B and stores the result in A.
IV
needed.
EE
📌 Example:
B
3. Instruction Execution
Each instruction follows this three-step process:
20
BEETECH FEB2025
N
IO
AT
C
U
ED
E
IV
H
EE
B
21