0% found this document useful (0 votes)
5 views5 pages

Cs Book

The document explains floating point representation in binary format according to the IEEE 754 standard, detailing bias values for different precision formats. It covers binary arithmetic, complements, various coding systems like BCD, Excess-3, Gray Code, ASCII, and EBCDIC, and introduces logic gates and Boolean expressions in digital logic. The document serves as a foundational overview of key concepts in digital systems and representations.

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)
5 views5 pages

Cs Book

The document explains floating point representation in binary format according to the IEEE 754 standard, detailing bias values for different precision formats. It covers binary arithmetic, complements, various coding systems like BCD, Excess-3, Gray Code, ASCII, and EBCDIC, and introduces logic gates and Boolean expressions in digital logic. The document serves as a foundational overview of key concepts in digital systems and representations.

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/ 5

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

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)

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)

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

2
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

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

3
Code Description Example

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 perform basic logical functions
using binary input (0 and 1) and produce a single binary output.

Gate Type Symbol Operation Truth Table (A, B → Output)

AND A·B Output is 1 if both A and B are 1 0,0 → 0; 0,1 → 0; 1,0 → 0; 1,1 → 1

OR A+B Output is 1 if either A or B is 1 0,0 → 0; 0,1 → 1; 1,0 → 1; 1,1 → 1

NOT ¬A Output is the inverse of A 0 → 1; 1 → 0

NAND ¬(A·B) Opposite of AND 0,0 → 1; 0,1 → 1; 1,0 → 1; 1,1 → 0

NOR ¬(A+B) Opposite of OR 0,0 → 1; 0,1 → 0; 1,0 → 0; 1,1 → 0

XOR A⊕B Output is 1 if A ≠ B 0,0 → 0; 0,1 → 1; 1,0 → 1; 1,1 → 0

XNOR ¬(A⊕B) Output is 1 if A = B 0,0 → 1; 0,1 → 0; 1,0 → 0; 1,1 → 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

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

1 1 1 0 1 1

(Full truth table to be added...)

(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