0% found this document useful (0 votes)
75 views18 pages

MODULE 2 Notes

The document outlines the curriculum for GYEST203 Foundations of Computing, focusing on various topics including binary number systems, integer representation in binary, data storage units, ASCII and Unicode encoding systems, CPU architecture, and instruction formats. Each section includes examples, practice questions, and conclusions to reinforce learning. The content is structured to provide foundational knowledge necessary for understanding computing principles.

Uploaded by

rohithk3470
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)
75 views18 pages

MODULE 2 Notes

The document outlines the curriculum for GYEST203 Foundations of Computing, focusing on various topics including binary number systems, integer representation in binary, data storage units, ASCII and Unicode encoding systems, CPU architecture, and instruction formats. Each section includes examples, practice questions, and conclusions to reinforce learning. The content is structured to provide foundational knowledge necessary for understanding computing principles.

Uploaded by

rohithk3470
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/ 18

GYEST203 FOUNDATIONS OF

COMPUTING, Module-2
Dr Biju V.G.
Associate Professor & Head,
Dept. of ECE
March 26, 2025

Contents
1 Binary Number system 3
1.1 Decimal to Binary Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 Example 1: Convert 25 to Binary . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2 Example 2: Convert 43 to Binary . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.3 Example 3: Convert 78 to Binary . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Binary to Decimal Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2.1 Example 4: Convert (1011)2 to Decimal . . . . . . . . . . . . . . . . . . . 4
1.2.2 Example 5: Convert (11010)2 to Decimal . . . . . . . . . . . . . . . . . . . 4
1.2.3 Example 6: Convert (1001101)2 to Decimal . . . . . . . . . . . . . . . . . . 4
1.3 Practice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.1 Decimal to Binary Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.2 Binary to Decimal Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 Integer Representation in Binary 5


2.1 Steps for Integer Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1 Sign Magnitude Representation . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2 One’s Complement Representation . . . . . . . . . . . . . . . . . . . . . . 6
2.1.3 Two’s Complement Representation . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Examples of Integer Representation . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Example 1: Represent +19 in 8-bit Two’s Complement . . . . . . . . . . . 6
2.2.2 Example 2: Represent -19 in 8-bit Two’s Complement . . . . . . . . . . . . 6
2.2.3 Example 3: Represent +45 in 8-bit Two’s Complement . . . . . . . . . . . 6
2.2.4 Example 4: Represent -45 in 8-bit Two’s Complement . . . . . . . . . . . . 6
2.2.5 Example 5: Represent -128 in 8-bit Two’s Complement . . . . . . . . . . . 7
2.3 Practice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Practice Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4.1 Two’s Complement Solutions . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 Data Storage Units 8


3.1 Common Data Storage Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 Examples of Data Storage Measurements . . . . . . . . . . . . . . . . . . . . . . . 8
3.3 Practice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1
GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

3.4 Practice Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9


3.5 Two’s Complement Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.6 Data Storage Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

4 ASCII and Unicode Encoding Systems 9


4.1 ASCII (American Standard Code for Information Interchange) . . . . . . . . . . . 9
4.1.1 Examples of ASCII Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 Unicode Encoding System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2.1 Examples of Unicode Codes . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3 Advantages and Disadvantages of Unicode over ASCII . . . . . . . . . . . . . . . 10
4.3.1 Advantages of Unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3.2 Disadvantages of Unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.4 Comparison Table: ASCII vs Unicode . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

5 Central Processing Unit (CPU) 11


5.1 Basic CPU Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.1.1 Arithmetic and Logic Unit (ALU) . . . . . . . . . . . . . . . . . . . . . . . 11
5.1.2 Control Unit (CU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.1.3 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.2 Working of the CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.3 Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

6 Instruction Format and Assembly Language (Basics) 13


6.1 Fetch-Execute Cycle and Instruction Execution . . . . . . . . . . . . . . . . . . . 14
6.2 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

7 Descriptive Questions and Answers 15


7.1 Binary Representation of Data and Numbers . . . . . . . . . . . . . . . . . . . . . 15
7.2 Integer Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
7.3 Data Storage Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
7.4 ASCII and Unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.5 Explain the basic components of a CPU and their functions. . . . . . . . . . . . . 16
7.6 What is an instruction format? Describe its components. . . . . . . . . . . . . . . 17
7.7 Explain the basic syntax of an assembly language instruction. . . . . . . . . . . . 17
7.8 Describe the Fetch-Execute Cycle. . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.9 What are the different types of registers in a CPU? . . . . . . . . . . . . . . . . . 17
7.10 What is the role of the Control Unit in instruction execution? . . . . . . . . . . . 18
7.11 Explain different types of instruction formats. . . . . . . . . . . . . . . . . . . . . 18
7.12 What is an addressing mode? Explain different types. . . . . . . . . . . . . . . . . 18

Dr. Biju V.G. Page 2 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

1 Binary Number system


The Binary Number System is a base-2 numeral system that uses only two digits: 0 and 1. It
is the foundation of all modern computing systems and digital electronics.

1.1 Decimal to Binary Conversion


To convert a decimal number to binary:

1. Divide the decimal number by 2.

2. Record the remainder (0 or 1).

3. Continue dividing the quotient by 2 until you reach 0.

4. The binary equivalent is obtained by reading the remainders from bottom to top.

1.1.1 Example 1: Convert 25 to Binary


ˆ 25 ÷ 2 = 12 remainder 1
ˆ 12 ÷ 2 = 6 remainder 0
ˆ 6 ÷ 2 = 3 remainder 0
ˆ 3 ÷ 2 = 1 remainder 1
ˆ 1 ÷ 2 = 0 remainder 1
Answer: Reading the remainders from bottom to top: (25)10 = (11001)2

1.1.2 Example 2: Convert 43 to Binary


ˆ 43 ÷ 2 = 21 remainder 1
ˆ 21 ÷ 2 = 10 remainder 1
ˆ 10 ÷ 2 = 5 remainder 0
ˆ 5 ÷ 2 = 2 remainder 1
ˆ 2 ÷ 2 = 1 remainder 0
ˆ 1 ÷ 2 = 0 remainder 1
Answer: (43)10 = (101011)2

1.1.3 Example 3: Convert 78 to Binary


ˆ 78 ÷ 2 = 39 remainder 0
ˆ 39 ÷ 2 = 19 remainder 1
ˆ 19 ÷ 2 = 9 remainder 1
ˆ 9 ÷ 2 = 4 remainder 1
ˆ 4 ÷ 2 = 2 remainder 0
Dr. Biju V.G. Page 3 Associate Professor & Head, ECE
GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

ˆ 2 ÷ 2 = 1 remainder 0
ˆ 1 ÷ 2 = 0 remainder 1
Answer: (78)10 = (1001110)2

1.2 Binary to Decimal Conversion


To convert a binary number to decimal:
1. Multiply each binary digit by the corresponding power of 2.
2. Sum all the products.

1.2.1 Example 4: Convert (1011)2 to Decimal

(1011)2 = (1 × 23 ) + (0 × 22 ) + (1 × 21 ) + (1 × 20 )
= (1 × 8) + (0 × 4) + (1 × 2) + (1 × 1)
= 8 + 0 + 2 + 1 = (11)10

1.2.2 Example 5: Convert (11010)2 to Decimal

(11010)2 = (1 × 24 ) + (1 × 23 ) + (0 × 22 ) + (1 × 21 ) + (0 × 20 )
= (1 × 16) + (1 × 8) + (0 × 4) + (1 × 2) + (0 × 1)
= 16 + 8 + 0 + 2 + 0 = (26)10

1.2.3 Example 6: Convert (1001101)2 to Decimal

(1001101)2 = (1 × 26 ) + (0 × 25 ) + (0 × 24 ) + (1 × 23 ) + (1 × 22 ) + (0 × 21 ) + (1 × 20 )
= (1 × 64) + (0 × 32) + (0 × 16) + (1 × 8) + (1 × 4) + (0 × 2) + (1 × 1)
= 64 + 0 + 0 + 8 + 4 + 0 + 1 = (77)10

1.3 Practice Questions


Convert the following decimal numbers to binary:
ˆ (1) 19
ˆ (2) 54
ˆ (3) 77
ˆ (4) 99
ˆ (5) 145
Convert the following binary numbers to decimal:
ˆ (1) 10011
ˆ (2) 110110
ˆ (3) 101010
ˆ (4) 111111
ˆ (5) 1000001
Dr. Biju V.G. Page 4 Associate Professor & Head, ECE
GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

1.3.1 Decimal to Binary Solutions


ˆ (19) = (10011)
10 2

ˆ (54) = (110110)
10 2

ˆ (77) = (1001101)
10 2

ˆ (99) = (1100011)
10 2

ˆ (145) = (10010001)
10 2

1.3.2 Binary to Decimal Solutions


ˆ (10011) = (19)2 10

ˆ (110110) = (54) 2 10

ˆ (101010) = (42) 2 10

ˆ (111111) = (63) 2 10

ˆ (1000001) = (65) 2 10

1.4 Conclusion
Understanding binary number systems and their conversions is essential in digital electronics and
computing. This knowledge is fundamental in computer architecture, microprocessor design, and
software development.

2 Integer Representation in Binary


In digital systems, integers can be represented in different formats:
ˆ Unsigned Representation: Only positive integers.
ˆ Signed Magnitude: Uses the leftmost bit as a sign bit.
ˆ One’s Complement: Negative numbers are represented by inverting all bits of their pos-
itive counterpart.
ˆ Two’s Complement: Negative numbers are represented by inverting all bits and adding
1.

2.1 Steps for Integer Representation


2.1.1 Sign Magnitude Representation
1. The representation has two part 1. MSB for showing sign 2. The rest bit for showing
magnitude.
2. If the number is positive represent Sign bit with binary 0.
3. If the number is negative represent Sign bit with binary 1.
4. Write the binary equivalent of the absolute value of the number as the magnitude.
ˆ Eg:- (10) = (01010)
ˆ Eg:- (−10) = (11010)
10 2

10 2

Dr. Biju V.G. Page 5 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

2.1.2 One’s Complement Representation


1. Write the binary equivalent of the absolute value of the number.

2. If the number is positive, the representation remains unchanged.

3. If the number is negative:

ˆ Invert all bits (One’s complement).


2.1.3 Two’s Complement Representation
1. Write the binary equivalent of the absolute value of the number.

2. If the number is positive, the representation remains unchanged.

3. If the number is negative:

ˆ Invert all bits (One’s complement).


ˆ Add 1 to the result.
2.2 Examples of Integer Representation
2.2.1 Example 1: Represent +19 in 8-bit Two’s Complement
ˆ Convert 19 to binary: (00010011) 2

ˆ Since it is positive, the representation remains the same.


Answer: (00010011)2

2.2.2 Example 2: Represent -19 in 8-bit Two’s Complement


ˆ Convert 19 to binary: (00010011) 2

ˆ Take One’s complement: (11101100) 2

ˆ Add 1: (11101101) 2

Answer: (11101101)2

2.2.3 Example 3: Represent +45 in 8-bit Two’s Complement


ˆ Convert 45 to binary: (00101101) 2

Answer: (00101101)2

2.2.4 Example 4: Represent -45 in 8-bit Two’s Complement


ˆ Convert 45 to binary: (00101101) 2

ˆ Take One’s complement: (11010010) 2

ˆ Add 1: (11010011) 2

Answer: (11010011)2

Dr. Biju V.G. Page 6 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

2.2.5 Example 5: Represent -128 in 8-bit Two’s Complement


ˆ Convert 128 to binary (in 8-bit it is out of range, but we use the format for representation):
(10000000)2

Answer: (10000000)2

2.3 Practice Questions


Convert the following integers into 8-bit Two’s Complement representation:

ˆ (1) +27
ˆ (2) -27
ˆ (3) +63
ˆ (4) -63
ˆ (5) -100
2.4 Practice Solutions
2.4.1 Two’s Complement Solutions
ˆ (27) = (00011011)
10 2

ˆ (-27) = (11100101)
10 2

ˆ (63) = (00111111)
10 2

ˆ (-63) = (11000001)
10 2

ˆ (-100) = (10011100)
10 2

2.5 Conclusion
Understanding binary number systems, integer representation, and conversions is essential in
digital electronics and computing. Two’s complement representation is widely used for signed
integer storage and arithmetic operations in computer systems.

Dr. Biju V.G. Page 7 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

3 Data Storage Units


Data in digital systems is measured in units of storage. The smallest unit of data is a bit. Other
units are derived based on powers of 2.

3.1 Common Data Storage Units


ˆ Bit (b): The smallest unit of data in computing, representing a binary digit (0 or 1).
ˆ Nibble: 1 Nibble = 4 bits.
ˆ Byte (B): 1 Byte = 8 bits.
ˆ Kilobyte (KB): 1 KB = 1024 Bytes.
ˆ Megabyte (MB): 1 MB = 1024 KB.
ˆ Gigabyte (GB): 1 GB = 1024 MB.
ˆ Terabyte (TB): 1 TB = 1024 GB.
ˆ Petabyte (PB): 1 PB = 1024 TB.
ˆ Exabyte (EB): 1 EB = 1024 PB.
ˆ Zettabyte (ZB): 1 ZB = 1024 EB.
ˆ Yottabyte (YB): 1 YB = 1024 ZB.
3.2 Examples of Data Storage Measurements
ˆ A simple text file of 1000 characters typically requires 1 KB.
ˆ A high-resolution image may occupy around 5 MB.
ˆ A full-length HD movie could take up around 4 GB.
ˆ A 1 TB hard drive can store approximately 250,000 songs in MP3 format.
3.3 Practice Questions
Convert the following integers into 8-bit Two’s Complement representation:

ˆ (1) +27
ˆ (2) -27
ˆ (3) +63
ˆ (4) -63
ˆ (5) -100
Answer the following data storage questions:

ˆ (1) How many bits are in 4 bytes?


ˆ (2) Convert 2048 KB to MB.
Dr. Biju V.G. Page 8 Associate Professor & Head, ECE
GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

ˆ (3) If a file is 3 GB, how many MB is it?


ˆ (4) Convert 5 TB to GB.
ˆ (5) If a 10 MB image is stored on a 1 GB drive, how many such images can be stored?
3.4 Practice Solutions
3.5 Two’s Complement Solutions
ˆ (27) = (00011011)
10 2

ˆ (-27) = (11100101)
10 2

ˆ (63) = (00111111)
10 2

ˆ (-63) = (11000001)
10 2

ˆ (-100) = (10011100)
10 2

3.6 Data Storage Solutions


ˆ (1) 4 bytes = 4 Ö 8 = 32 bits.
ˆ (2) 2048 KB = 2048 ö 1024 = 2 MB.
ˆ (3) 3 GB = 3 Ö 1024 = 3072 MB.
ˆ (4) 5 TB = 5 Ö 1024 = 5120 GB.
ˆ (5) 1 GB = 1024 MB, so 1024 MB ö 10 MB = 102 images.
3.7 Conclusion
Understanding binary number systems, integer representation, conversions, and data storage units
is fundamental to computer science and digital electronics. These concepts play a vital role in
memory management, data transmission, and computer architecture.

4 ASCII and Unicode Encoding Systems


Character encoding is essential in digital systems to represent textual data using binary codes.
Two major encoding standards are ASCII and Unicode.

4.1 ASCII (American Standard Code for Information Interchange)


ASCII is a character encoding standard that represents text in computers. It uses a 7-bit binary
number to represent 128 characters, including:

ˆ Uppercase and lowercase English letters (A-Z, a-z)


ˆ Digits (0-9)
ˆ Punctuation marks and symbols (!, @, #, etc.)
ˆ Control characters (e.g., newline, tab)
Dr. Biju V.G. Page 9 Associate Professor & Head, ECE
GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

4.1.1 Examples of ASCII Codes


1. Letter ‘A’  65  (1000001) 2

2. Letter ‘a’  97  (1100001) 2

3. Digit ‘5’  53  (0110101) 2

4. Space ‘ ’  32  (0100000) 2

5. Exclamation ‘!’  33  (0100001) 2

4.2 Unicode Encoding System


Unicode is a more advanced encoding system designed to accommodate characters from multiple
languages worldwide. Unlike ASCII, Unicode can use 8, 16, or 32 bits per character, supporting
over 143,000 symbols, including:

ˆ All ASCII characters


ˆ Symbols and special characters
ˆ Non-Latin scripts (e.g., Chinese, Arabic, Hindi)
ˆ Emojis
4.2.1 Examples of Unicode Codes
1. Letter ‘A’  U+0041  (01000001) 2

4.3 Advantages and Disadvantages of Unicode over ASCII


4.3.1 Advantages of Unicode
ˆ Supports characters from all languages, making it ideal for global applications.
ˆ Includes symbols, special characters, and emojis, which are absent in ASCII.
ˆ Can represent more than 1,000,000 characters.
4.3.2 Disadvantages of Unicode
ˆ Requires more storage space compared to ASCII (UTF-16 and UTF-32 take up more mem-
ory).

ˆ Can be complex to implement due to different encoding formats (UTF-8, UTF-16, UTF-32).
ˆ Some older systems only support ASCII, leading to compatibility issues.
4.4 Comparison Table: ASCII vs Unicode
4.5 Conclusion
ASCII and Unicode are fundamental encoding systems in computing. ASCII is limited to En-
glish characters and symbols, while Unicode provides a universal standard supporting multiple
languages and symbols. Unicode’s flexibility makes it suitable for modern applications, despite
requiring more storage and processing power.

Dr. Biju V.G. Page 10 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

ASCII (American Stan-


Feature dard Code for Informa- Unicode
tion Interchange)
A universal character en-
A character encoding stan-
coding standard supporting
Definition dard that represents text
almost all languages and
using 7 or 8 bits.
symbols.
Uses 7 bits (128 characters) Uses 8, 16, or 32 bits, al-
Bit Size or 8 bits (256 characters in lowing over a million char-
extended ASCII). acters.
Supports characters from all
Only English characters,
Character Support languages, emojis, and spe-
digits, and basic symbols.
cial symbols.
Requires less storage as it Requires more storage be-
Storage Requirement uses only 7 or 8 bits per cause it can use up to 32 bits
character. per character.
Used in older systems and Used in modern systems,
Usage simple text-based applica- web applications, and inter-
tions. national communication.

Table 1: Comparison Between ASCII and Unicode

5 Central Processing Unit (CPU)


The CPU, often referred to as the ”brain” of the computer, is a crucial component responsible
for executing instructions from programs. It performs the arithmetic, logical, control, and in-
put/output (I/O) operations as specified by the instructions. The CPU’s performance greatly
influences the overall speed and efficiency of a computer.

ˆ Arithmetic and Logic Unit (ALU)


ˆ Control Unit (CU)
ˆ Registers
5.1 Basic CPU Architecture
The CPU follows the fetch-decode-execute cycle to process instructions.

5.1.1 Arithmetic and Logic Unit (ALU)


The ALU is responsible for performing arithmetic and logical operations. It performs:

ˆ Arithmetic operations: Addition, Subtraction, Multiplication, Division


ˆ Logical operations: AND, OR, NOT, XOR
ˆ Comparison operations: Greater than, Less than, Equal to
ˆ Shift operations: Left Shift, Right Shift
Dr. Biju V.G. Page 11 Associate Professor & Head, ECE
GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

5.1.2 Control Unit (CU)


The Control Unit manages and coordinates the activities of the CPU. It performs the following
tasks:
ˆ Fetches instructions from memory
ˆ Decodes instructions to understand the operation to be performed
ˆ Sends control signals to different components for execution
ˆ Manages the flow of data between memory, ALU, and registers
5.1.3 Registers
Registers are small, high-speed storage locations in the CPU used to temporarily hold data and
instructions. Important types of registers include:
ˆ Accumulator (A): Stores intermediate results of operations
ˆ Program Counter (PC): Holds the address of the next instruction
ˆ Instruction Register (IR): Holds the currently executing instruction
ˆ Memory Address Register (MAR): Holds the memory address being accessed
ˆ Memory Buffer Register (MBR): Holds data fetched from memory
ˆ Stack Pointer (SP): Points to the top of the stack in memory
ˆ Status Register: Stores condition flags like zero flag, carry flag, etc.

Figure 1: Block Diagram of a CPU

Dr. Biju V.G. Page 12 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

5.2 Working of the CPU


The CPU operates in four primary steps:

1. Fetch: The CU retrieves the next instruction from memory.

2. Decode: The instruction is interpreted into executable signals.

3. Execute: The ALU performs the required operation, and the result is stored.

4. Store: The result is written back to memory or a register for further use.

5.3 Instruction Set


An instruction set is a collection of commands a CPU can execute. It includes:

ˆ Data Transfer Instructions: MOV, LOAD, STORE


ˆ Arithmetic Instructions: ADD, SUB, MUL, DIV
ˆ Logical Instructions: AND, OR, XOR, NOT
ˆ Branching Instructions: JMP, CALL, RET
ˆ Input/Output Instructions: IN, OUT
5.4 Conclusion
Understanding CPU architecture and instruction sets helps in learning how computers process
data efficiently. The ALU, Control Unit, and Registers work together to execute instructions,
making computing possible.

6 Instruction Format and Assembly Language (Basics)


An instruction format consists of different fields that specify the operation to be performed. The
basic components of an instruction format are:

ˆ Opcode: Specifies the operation (e.g., ADD, MOV).


ˆ Operand(s): Specifies the data or memory location.
ˆ Addressing Mode: Specifies how operands are accessed.
Assembly language is a low-level programming language that uses mnemonic codes instead of
binary machine code. Basic examples:

MOV A, B ; Move data from register B to A


ADD A, C ; Add contents of C to A
JMP START ; Jump to label START

Dr. Biju V.G. Page 13 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

6.1 Fetch-Execute Cycle and Instruction Execution


The fetch-execute cycle is the process by which a CPU retrieves and executes an instruction. The
steps include:

1. Fetch: The CPU fetches an instruction from memory (address held in the Program Counter).

2. Decode: The Control Unit decodes the instruction to determine the required operation.

3. Execute: The ALU or other components execute the instruction.

4. Store: The result is stored back in a register or memory.

5. Update PC: The Program Counter is incremented to the next instruction.

6.2 Conclusion
Understanding CPU architecture, instruction formats, and the fetch-execute cycle is essential to
learning how computers process data efficiently. The ALU, Control Unit, and Registers work
together to execute instructions, making computing possible.

Dr. Biju V.G. Page 14 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

7 Descriptive Questions and Answers


7.1 Binary Representation of Data and Numbers
Q1: What is the binary number system? Explain its significance in computer science.
A1: The binary number system is a base-2 numeral system that uses only two digits, 0 and
1. It is significant in computer science because digital computers operate using electrical signals,
which are efficiently represented using two states: ON (1) and OFF (0). Every piece of data and
instruction in a computer is ultimately stored and processed in binary.
Q2: Convert the decimal number 45 into binary.
A2: The conversion process is as follows:

45 ÷ 2 = 22 remainder 1
22 ÷ 2 = 11 remainder 0
11 ÷ 2 = 5 remainder 1
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1

Reading the remainders from bottom to top, the binary representation of 45 is 101101.

7.2 Integer Representation


Q3: What are signed and unsigned integers? How are negative numbers represented
in binary?
A3:

ˆ Unsigned integers represent only non-negative numbers (0 and positive values).


ˆ Signed integers include both positive and negative numbers.
ˆ Negative numbers are commonly represented using two’s complement, where the most
significant bit (MSB) serves as the sign bit (0 for positive, 1 for negative).

Q4: Represent -13 in 8-bit two’s complement.


A4:

ˆ Convert 13 to binary: 00001101


ˆ Take the one’s complement: 11110010
ˆ Add 1 to get two’s complement: 11110011
Thus, -13 in 8-bit two’s complement form is 11110011.

7.3 Data Storage Units


Q5: Define the different units of data storage.
A5: Data is stored in units of bits and bytes. The common storage units are:

ˆ 1 Byte = 8 Bits
Dr. Biju V.G. Page 15 Associate Professor & Head, ECE
GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

ˆ 1 Kilobyte (KB) = 1024 Bytes


ˆ 1 Megabyte (MB) = 1024 KB
ˆ 1 Gigabyte (GB) = 1024 MB
ˆ 1 Terabyte (TB) = 1024 GB
Q6: How many bytes are there in 5 GB?
A6: Using the conversion factors:

5 GB = 5 × 1024 MB
= 5 × 1024 × 1024 KB
= 5 × 1024 × 1024 × 1024 Bytes
= 5, 368, 709, 120 Bytes

Thus, 5 GB contains 5,368,709,120 bytes.

7.4 ASCII and Unicode


Q7: What is the difference between ASCII and Unicode?
A7: ASCII (American Standard Code for Information Interchange) is a character encoding
standard that uses 7 or 8 bits to represent characters (128 or 256 possible characters). Unicode
is an extended encoding system that supports multiple languages and symbols using 8, 16, or 32
bits.
Q8: What is the ASCII code for the character ’A’ and ’a’ ?
A8:
ˆ The ASCII code for ’A’ is 65 (Binary: 01000001).
ˆ The ASCII code for ’a’ is 97 (Binary: 01100001).
Q9: Convert the string ”Hi” into ASCII and binary.
A9: The ASCII values and their binary representations are:

H = 72, Binary: 01001000


i = 105, Binary: 01101001

Thus, ”Hi” in binary is 01001000 01101001.

7.5 Explain the basic components of a CPU and their functions.


Answer: The Central Processing Unit (CPU) consists of three main components:
ˆ Arithmetic and Logic Unit (ALU): Responsible for performing arithmetic operations
(addition, subtraction, multiplication, division) and logical operations (AND, OR, NOT,
XOR).

ˆ Registers: Small, high-speed storage locations within the CPU used for temporary data
storage during execution.

ˆ Control Unit (CU): Manages and coordinates all activities of the CPU. It fetches instruc-
tions from memory, decodes them, and executes them by directing ALU and registers.

Dr. Biju V.G. Page 16 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

7.6 What is an instruction format? Describe its components.


Answer: An instruction format is the layout of bits in an instruction. It includes:
ˆ Opcode (Operation Code): Specifies the operation to be performed.
ˆ Operands: Indicate the data to be processed or the location where data is stored.
ˆ Addressing Mode: Specifies how the operand is to be interpreted (direct, indirect, register,
etc.).

7.7 Explain the basic syntax of an assembly language instruction.


Answer: An assembly language instruction generally consists of:
ˆ Label (optional): Identifies a memory location.
ˆ Mnemonic (Operation Code): Represents the operation (e.g., ADD, MOV, SUB).
ˆ Operands: The data or memory addresses involved in the operation.
ˆ Comments (optional): Provide explanations for better readability.
Example:
MOV AX, BX ; Move contents of BX into AX
ADD AX, 10 ; Add 10 to AX

7.8 Describe the Fetch-Execute Cycle.


Answer: The Fetch-Execute Cycle is the process by which the CPU executes instructions. It
consists of the following steps:
1. Fetch: The control unit retrieves the instruction from memory and stores it in the instruc-
tion register.

2. Decode: The control unit decodes the instruction to determine the operation and operands.

3. Execute: The ALU performs the required operation, and the result is stored in the appro-
priate register or memory.

4. Store: The result is written back to memory if needed, and the next instruction is fetched.

7.9 What are the different types of registers in a CPU?


Answer: The CPU contains several types of registers, including:
ˆ General Purpose Registers (GPRs): Used for storing data and intermediate results
(e.g., AX, BX in x86 architecture).

ˆ Special Purpose Registers:


– Program Counter (PC): Holds the address of the next instruction to be executed.
– Instruction Register (IR): Holds the current instruction being executed.
– Stack Pointer (SP): Points to the top of the stack.
– Status Register/Flags Register: Holds status flags such as zero, carry, overflow,
etc.

Dr. Biju V.G. Page 17 Associate Professor & Head, ECE


GYEST203 FOUNDATIONS OF COMPUTING, Module-1 CE Munnar

7.10 What is the role of the Control Unit in instruction execution?


Answer: The Control Unit (CU) plays a crucial role in instruction execution by:

ˆ Fetching instructions from memory.


ˆ Decoding instructions to determine the required operation.
ˆ Controlling the flow of data between the CPU, ALU, and registers.
ˆ Generating control signals to execute the instruction properly.
ˆ Managing the sequence of execution and handling branching operations.
7.11 Explain different types of instruction formats.
Answer: Instruction formats can be classified into:

ˆ Zero-Address Instructions: Operands are implicitly on a stack (e.g., PUSH, POP).


ˆ One-Address Instructions: One explicit operand with an implicit accumulator (e.g.,
LOAD, STORE).

ˆ Two-Address Instructions: Two explicit operands, allowing direct data movement (e.g.,
MOV A, B).

ˆ Three-Address Instructions: Three explicit operands, allowing more complex operations


(e.g., ADD A, B, C).

7.12 What is an addressing mode? Explain different types.


Answer: Addressing modes determine how an operand is interpreted. Common types include:

ˆ Immediate Addressing: Operand is a constant value (e.g., ADD A, 5).


ˆ Register Addressing: Operand is stored in a register (e.g., MOV A, B).
ˆ Direct Addressing: Operand is stored at a specific memory address.
ˆ Indirect Addressing: Operand’s memory address is held in a register.
ˆ Indexed Addressing: Operand’s address is computed using an index register.

Dr. Biju V.G. Page 18 Associate Professor & Head, ECE

You might also like