0% found this document useful (0 votes)
4 views9 pages

Computer Science Book (2)

The document provides an overview of the generations of computers, detailing the technology used and key features from the first generation (vacuum tubes) to the fifth generation (AI and ULSI). It also covers the basic building blocks of computers, number systems, conversions, floating point representation, binary arithmetic, and various coding systems like BCD, ASCII, and Gray Code. Additionally, it introduces digital logic and logic gates, including their functions and truth tables.

Uploaded by

xewohew360
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)
4 views9 pages

Computer Science Book (2)

The document provides an overview of the generations of computers, detailing the technology used and key features from the first generation (vacuum tubes) to the fifth generation (AI and ULSI). It also covers the basic building blocks of computers, number systems, conversions, floating point representation, binary arithmetic, and various coding systems like BCD, ASCII, and Gray Code. Additionally, it introduces digital logic and logic gates, including their functions and truth tables.

Uploaded by

xewohew360
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/ 9

Unit 1: Introduction and Background

1.1 Generations of Computers

Time
Generation Technology Used Key Features
Period

Huge size, slow processing, machine language


1st 1940 - 1956 Vacuum Tubes
only, high electricity usage

Smaller size, faster than vacuum tubes, assembly


2nd 1956 - 1963 Transistors
language

Integrated Circuits More reliable, use of high-level programming


3rd 1964 - 1971
(ICs) languages

Very fast, GUI interface, portable computers, low


4th 1971 - 2010 Microprocessors
cost

2010 - AI & ULSI (Nano Artificial intelligence, quantum computing, voice


5th
Present tech) recognition

1.2 Basic Building Blocks of Computer

Block Description Examples

Input Unit Takes user input and converts it into binary data Keyboard, Mouse, Scanner

Memory
Stores data temporarily or permanently RAM, ROM, Hard Drive
Unit

Control
Directs operations of the processor Part of CPU
Unit

ALU Performs arithmetic and logical operations Part of CPU

Registers Temporary storage for immediate data Program Counter, Accumulator

Output Unit Converts binary data to human-readable form Monitor, Printer, Speaker

Transfers data between components (Data, Address, Internal system


Bus System
Control Buses) communication lines

Block Diagram: (Input) → Memory → [Control Unit + ALU + Registers] → Output

1
1.3 Number Systems and Conversions

Number systems are methods for representing numbers. The most common systems used in computing
are: - Binary (Base-2) - Octal (Base-8) - Decimal (Base-10) - Hexadecimal (Base-16)

Each of these has a unique way to represent integers and fractional values.

Decimal to Others

Decimal to Binary

Integer Part: - Divide by 2 and record the remainder. - Reverse the remainders. - Example: 25 → 11001

Fractional Part: - Multiply by 2 and take the integer part. - Continue with the fractional part. - Example:
0.625 - 0.625 × 2 = 1.25 → 1 - 0.25 × 2 = 0.5 → 0 - 0.5 × 2 = 1.0 → 1 - Result: 0.101

Decimal to Octal

Integer Part: Divide by 8, reverse remainders. - Example: 100 → 144

Fractional Part: Multiply by 8. - Example: 0.8125 - 0.8125 × 8 = 6.5 → 6 - 0.5 × 8 = 4.0 → 4 - Result: 0.64

Decimal to Hexadecimal

Integer Part: Divide by 16. - Example: 254 → FE

Fractional Part: Multiply by 16. - Example: 0.6875 - 0.6875 × 16 = 11.0 → B - Result: 0.B

Binary to Others

Binary to Decimal

• Multiply each digit by 2ⁿ.


• Example: 1010 → 10
• Binary Fraction: 1.101
• = 1×2⁰ + 1×2⁻¹ + 0×2⁻² + 1×2⁻³ = 1 + 0.5 + 0 + 0.125 = 1.625

Binary to Octal

• Group in 3 bits.
• Example: 110101.011
• 110 101 . 011 → Octal: 65.3

2
Binary to Hexadecimal

• Group in 4 bits.
• Example: 10110111 → 1011 0111 → B7

Octal to Others

Octal to Decimal

• Multiply each digit by 8ⁿ.


• Example: 145
• = 1×8² + 4×8¹ + 5×8⁰ = 64 + 32 + 5 = 101

Fractional Example: - Convert 17.52 (Octal) to Decimal - Integer part: 1×8¹ + 7×8⁰ = 8 + 7 = 15 - Fraction
part: 5×8⁻¹ + 2×8⁻² = 0.625 + 0.03125 = 0.65625 - Result: 15.65625

Octal to Binary

• Convert each digit to 3-bit binary.


• Example (Integer): 237 → 010 011 111 → 010011111

Fractional Example: - Convert 7.4 (Octal) to Binary: - 7 = 111 - .4 → Binary of 4 = 100 (in octal, 4 is a single
digit) - So, 7.4 → 111.100 in binary - Result: 111.100

Octal to Hexadecimal

• Step 1: Convert each octal digit to 3-bit binary.


• Step 2: Combine all binary digits.
• Step 3: Group the binary into 4-bit chunks from right to left.
• Step 4: Convert each group to hex.
• Example: 157 (Octal)
• Octal to Binary: 001 101 111 → 001101111
• Binary to Hex: 0001 1011 11 → pad to 000110111100 → Group: 0001 1011 1100
• Hex: 1BC---

Hexadecimal to Others

Hexadecimal to Binary (with Fraction)

• Convert each hex digit (including fractional) to 4-bit binary.


• Example: 3.B
• 3 = 0011, B = 1011 → 3.B₁₆ = 0011.1011₂

Hexadecimal to Decimal (with Fraction)

• Integer Part: Same as before → A2 = 10×16¹ + 2×16⁰ = 160 + 2 = 162


• Fractional Example: 3.B

3
• B = 11 → 11 × 16⁻¹ = 11 ÷ 16 = 0.6875
• Total = 3 + 0.6875 = 3.6875

Hexadecimal to Octal (with Fraction)

• Step 1: Convert hex to binary (4-bit groups).


• Step 2: Group binary into 3-bit segments from decimal point.
• Step 3: Convert each group to octal.

Example: Convert 3.B (Hex) to Octal - 3 = 0011, B = 1011 → Binary = 0011.1011 - Group: 000 011 . 101 100
→ Octal: 3.54 - Final Answer: 3.B₁₆ = 3.54₈

Hex to Binary

• Each digit → 4-bit binary


• A2 → 1010 0010 → 10100010

Hex to Decimal

• A2 = 10×16¹ + 2×16⁰ = 160 + 2 = 162

Hexadecimal to Octal

• Step 1: Convert hex to binary (each digit = 4-bit binary).


• Step 2: Group binary into 3-bit segments from right to left.
• Step 3: Convert each group to octal.

Integer Example: - A2 (Hex) - Hex to Binary: A = 1010, 2 = 0010 → 10100010 - Group in 3s: 010 100 010 →
Octal: 2 4 2 → Answer: 242

Fractional Example: - Convert 2.F (Hex) to Octal - 2 = 0010, F = 1111 → Binary: 0010.1111 - Group: 000 010 .
111 100 → Octal: 2.74 - Result: 2.74 - Step 2: Group binary into 3-bit segments from right to left. - Step 3:
Convert each group to octal. - Example: A2 (Hex) - Hex to Binary: A = 1010, 2 = 0010 → 10100010 - Group in
3s: 010 100 010 → Octal: 2 4 2 - Answer: 242### Floating Point Representation

A floating point number represents real numbers using scientific notation in binary format.

Is the Bias Always 127? No. The bias value depends on the precision format being used in IEEE 754
standard:

Format Exponent Bits Bias Value Formula

32-bit (Single Precision) 8 bits 127 2^(8-1) - 1 = 127

64-bit (Double Precision) 11 bits 1023 2^(11-1) - 1 = 1023

16-bit (Half Precision) 5 bits 15 2^(5-1) - 1 = 15

4
This bias helps in representing both positive and negative exponents without using a sign bit for the
exponent itself.

Why Add 127 (Bias) to the Exponent? In IEEE 754 format, the exponent is stored using a technique called
"biased exponent." This means: - Instead of storing negative exponents directly (which would require a
separate sign), we add a constant value (called bias) to the actual exponent. - For 32-bit IEEE 754, the bias is
127. - So, an actual exponent of 0 is stored as 127, exponent 1 as 128, exponent -1 as 126, etc. - This
simplifies hardware implementation and comparison of floating point numbers.

IEEE 754 Single Precision Format (32-bit): - 1 bit for Sign (0 = positive, 1 = negative) - 8 bits for Exponent
(with a bias of 127) - 23 bits for Mantissa (fractional part after the leading 1)

Steps: 1. Convert the number to binary. 2. Normalize it (shift to make only one non-zero digit before
decimal). 3. Determine sign bit (0 or 1). 4. Calculate exponent and add bias. 5. Write the mantissa.

Example: Represent 5.75 in IEEE 754: - Binary of 5.75 = 101.11 - Normalized: 1.0111 × 2² - Sign = 0 (positive)
- Exponent = 2 + 127 = 129 → 10000001 - Mantissa = 01110000000000000000000 - Result: 0 10000001
01110000000000000000000

1.4 Binary Arithmetic and Complements

Operations:

• Addition, Subtraction, Multiplication, Division


• Rules:
•0+0=0
•0+1=1
•1+0=1
• 1 + 1 = 10 (carry 1)

Complements:

• 1’s Complement:
• Flip all bits (0↔1)

• Example: Binary of 6 = 0110 → 1’s complement = 1001

• 2’s Complement:

• Add 1 to the 1’s complement


• Example: Decimal -6
◦ +6 in binary (4-bit) = 0110
◦ 1’s Comp = 1001
◦ +1 = 1010 → 2’s Complement = 1010 (represents -6 in binary)

5
1.5 Codes
1. BCD (Binary-Coded Decimal): - Each digit of a decimal number is represented by its 4-bit binary
equivalent. - Example: - Decimal 259 → BCD: 0010 0101 1001 - Used in digital clocks, calculators.

2. Excess-3 (XS-3): - A self-complementary code used for decimal digits. - It adds 3 to each decimal digit,
then converts to binary. - Example: - Decimal 4 → 4 + 3 = 7 → Binary: 0111

3. Gray Code: - Gray Code is a binary numbering system where only one bit changes at a time between
two successive numbers. - This helps prevent errors in digital electronics, especially during signal transition
when multiple bits changing simultaneously might cause glitches.

Why Use Gray Code?

• When binary numbers count up (e.g., from 3 (011) to 4 (100)), more than one bit changes at once.
• This can confuse digital circuits if bits change at slightly different times.
• Gray Code prevents this by ensuring only one bit flips at a time.

Simple Rule to Convert Binary to Gray Code:

1. Keep the first bit (leftmost) the same.


2. Then, XOR each pair of adjacent binary bits to get the next Gray code bits.

Example: Convert Binary 1011 to Gray Code

• Binary = 1 0 1 1
• Step 1: First bit = 1
• Step 2: 1 ⊕ 0 = 1
• Step 3: 0 ⊕ 1 = 1
• Step 4: 1 ⊕ 1 = 0
• Gray Code = 1 1 1 0

Another Example: Convert Binary 1101 to Gray Code

• Binary = 1 1 0 1
• Step 1: First bit = 1
• Step 2: 1 ⊕ 1 = 0
• Step 3: 1 ⊕ 0 = 1
• Step 4: 0 ⊕ 1 = 1
• Gray Code = 1 0 1 1

Convert Gray Code to Binary

To convert Gray Code back to Binary: 1. Keep the first bit (MSB) the same. 2. For each next bit: - If Gray bit =
0 → Copy previous binary bit - If Gray bit = 1 → Invert previous binary bit

6
Example: Convert Gray Code 1011 to Binary

• Gray = 1 0 1 1
• Step 1: First bit = 1
• Step 2: 0 → Copy = 1
• Step 3: 1 → Invert = 0
• Step 4: 1 → Invert = 1

• Binary = 1 1 0 1

• Gray Code is widely used in:

• Rotary Encoders
• Karnaugh Maps (to reduce logic expressions)
• Analog-to-Digital Conversion

4. ASCII (American Standard Code for Information Interchange): - 7-bit code to represent text
characters. - Example: - A → 1000001 (65 in decimal), a → 1100001 (97 in decimal) - Used in keyboards, files,
text data.

5. EBCDIC (Extended Binary Coded Decimal Interchange Code): - 8-bit code used in IBM mainframes. -
Different from ASCII. - Example: - A → 11000001

Comparison Table:

Code Description Example

BCD Binary-Coded Decimal 9 → 1001

Excess-3 Adds 3 to decimal before binary conversion 2 → 0101

Gray Only one bit changes at a time 3 → 010

ASCII Character encoding (7-bit) A → 1000001

EBCDIC Extended Binary Coded Decimal Interchange A → 11000001

Next: Unit 2 - Digital Logic (to be continued...)

Unit 2: Digital Logic

2.1 Logic Gates

Logic gates are the fundamental building blocks of digital circuits. They operate using binary input values (0
and 1) and produce binary output based on a logical operation.

7
Below are the basic logic gates with their symbol descriptions, Boolean expressions, and compact truth
tables in list form:

AND Gate AND Gate - - Boolean Expression: Y = A · B - Truth Table: - A=0, B=0 → Y=0 - A=0, B=1 → Y=0 -
A=1, B=0 → Y=0 - A=1, B=1 → Y=1

OR Gate OR Gate - - Boolean Expression: Y = A + B - Truth Table: - A=0, B=0 → Y=0 - A=0, B=1 → Y=1 - A=1,
B=0 → Y=1 - A=1, B=1 → Y=1

NOT Gate NOT Gate - - Boolean Expression: Y = ¬A - Truth Table: - A=0 → Y=1 - A=1 → Y=0

NAND Gate NAND Gate - - Boolean Expression: Y = ¬(A · B) - Truth Table: - A=0, B=0 → Y=1 - A=0, B=1 →
Y=1 - A=1, B=0 → Y=1 - A=1, B=1 → Y=0

NOR Gate NOR Gate - - Boolean Expression: Y = ¬(A + B) - Truth Table: - A=0, B=0 → Y=1 - A=0, B=1 → Y=0 -
A=1, B=0 → Y=0 - A=1, B=1 → Y=0

XOR Gate (Exclusive OR) XOR Gate - - Boolean Expression: Y = A ⊕ B - Truth Table: - A=0, B=0 → Y=0 - A=0,
B=1 → Y=1 - A=1, B=0 → Y=1 - A=1, B=1 → Y=0

XNOR Gate (Exclusive NOR) XNOR Gate - - Boolean Expression: Y = ¬(A ⊕ B) - Truth Table: - A=0, B=0 →
Y=1 - A=0, B=1 → Y=0 - A=1, B=0 → Y=0 - A=1, B=1 → Y=1

Each gate can be constructed using electronic components like diodes and transistors and is essential in
designing circuits.

2.2 Boolean Expressions and Truth Tables

Boolean algebra deals with expressions involving binary variables and logic operations.

Example: - Expression: Y = A·(B + ¬C) - Truth table involves listing all combinations of inputs A, B, and C, and
computing Y for each.

A B C ¬C B + ¬C A·(B + ¬C) = Y

0 0 0 1 1 0

0 0 1 0 0 0

1 1 0 1 1 1

1 1 1 0 1 1

(Full truth table to be added...)

8
(Next: Boolean Laws, Expression Simplification, Karnaugh Maps, Adders/Subtractors...)

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