TUpapers logo TUpapers.com

Explore TUpapers

Study materials and tools in one place.

  • Dashboard
  • Blog
  • Search
  • About

Follow us

TUpapers on Facebook
TUpapers on Instagram
Contact TUpapers on WhatsApp
TUpapers subreddit on Reddit
Student Dashboard Student Dashboard
TUpapers logo TUpapers.com
  • Blog
  • About

Support Us

Your support helps us for further development and maintenance of site and resources!

Bank QR code for payment
eSewa QR code for payment
Khalti QR code for payment

The best way to support TUpapers is by purchasing a Premium Suscription or Notes Every purchase directly funds new features, better study resources, and platform maintenance.

On this chapter

Digital Design Fundamentals and Number System

All Chapters

Dashboard

Select a chapter to start reading

Digital Logics Notes | BCA First Semester | TU Papers

1 Chapter 1 Preview

No preview available.

Notes for this subject are coming soon — check back later.

Student Dashboard

Continue Reading

Get full notes inside the dashboard, along with other study tools.

Unit 1: Digital Design Fundamentals and Number System [8 Hours]

1.1 Analog and Digital Signal

A signal is a physical quantity that carries information from one point to another. Signals are the backbone of all communication and computing systems. They come in two fundamental types: analog and digital.

An analog signal is a continuous signal that varies smoothly over time and can take any value within a given range. It mimics the natural world — sound, temperature, and light are all analog in nature. On an oscilloscope, it looks like a smooth, flowing sine wave.

A digital signal is a discrete signal that can only take specific values — in electronics, this is almost always just two: HIGH (1) and LOW (0). It appears as a sharp, rectangular square wave. Computers exclusively understand digital signals.

Let's Break It Down:

Think of a dimmer switch vs a regular on/off light switch. The dimmer can go to any brightness level — that's analog. The on/off switch is either fully on or fully off — that's digital. Your voice on a phone is analog; after the phone processes it, it becomes digital for transmission.

FeatureAnalog SignalDigital Signal
NatureContinuousDiscrete
ValuesInfinite (any value in range)Finite (0 and 1 only)
Wave ShapeSine wave (smooth curves)Square wave (sharp edges)
Noise ImmunityLow (noise easily distorts it)High (easy to distinguish 0 from 1)
AccuracyHigh (captures fine detail)Depends on resolution/bits
BandwidthLess bandwidth requiredMore bandwidth required
ProcessingHarder to process/storeEasy to store and process
ExamplesHuman voice, temperature, AM radioComputer data, CDs, digital TV

Summary

  • Analog signals are continuous and can take infinite values; digital signals are discrete with only 0 and 1.
  • Digital signals are more noise-resistant and easier to process than analog signals.
  • Most real-world signals are analog; they must be converted (via ADC) to be processed digitally.

Exam Tip:

A common question asks to "list differences between analog and digital signals." The key three: continuous vs discrete, infinite values vs 0/1, low noise immunity vs high noise immunity. Also know that ADC (Analog-to-Digital Converter) converts analog to digital, and DAC (Digital-to-Analog Converter) does the reverse.

1.2 Analog and Digital System

A system is a combination of components that processes input signals to produce a desired output. Based on the type of signals they handle, systems are classified as analog or digital.

An analog system processes analog signals. It works with continuously varying physical quantities. Traditional thermometers, vinyl record players, and AM/FM radios are analog systems. The output of an analog system is also a continuous signal.

A digital system processes digital signals using logic circuits that understand only 0s and 1s. Computers, smartphones, digital cameras, and digital watches are digital systems. They are built from components like logic gates, flip-flops, and microprocessors. Digital systems are far more reliable, programmable, and versatile.

FeatureAnalog SystemDigital System
Signal TypeAnalog (continuous)Digital (discrete)
ComponentsResistors, capacitors, transistorsLogic gates, flip-flops, ICs
ProgrammabilityNot easily programmableHighly programmable
ReliabilityLower (affected by noise)Higher (robust to noise)
CostLess expensive for simple tasksCost-effective for complex tasks
StorageDifficult to store dataEasy to store (memory/disks)
ExamplesAnalog clock, AM radio, thermometerComputer, digital camera, smartphone

Summary

  • Analog systems process continuous signals; digital systems process discrete 0/1 signals.
  • Digital systems are more reliable, programmable, and easier to store data in.
  • Most modern systems are digital or hybrid (analog input → digital processing → analog output).

Exam Tip:

Questions often ask for advantages of digital systems over analog. Key points: noise immunity, ease of storage, programmability, and reproducibility. Also note: digital systems are not inherently more accurate — they depend on the number of bits used.

1.3 Number System Representation

A number system is a mathematical framework that uses symbols (digits) and a base (radix) to represent quantities. The base tells you how many unique digits the system uses before it rolls over — like how decimal resets after 9.

All number systems use positional notation, meaning the value of a digit depends on its position. The rightmost digit has position 0 (ones place), and each position to the left increases the power by 1.

The general formula for the value of a number N in base r is:

N = d(n) × r^n + d(n-1) × r^(n-1) + ... + d(1) × r^1 + d(0) × r^0

Where:
  d   = digit at that position
  r   = radix (base)
  n   = position index (starting from 0 at rightmost)

Example: Decimal 365 = 3×10² + 6×10¹ + 5×10⁰ = 300 + 60 + 5

Number SystemBase (Radix)Digits UsedUsed In
Binary20, 1Computers, digital circuits
Octal80–7Shorthand for binary in older systems
Decimal100–9Human everyday use
Hexadecimal160–9, A–FMemory addresses, color codes

Summary

  • Number systems use a base (radix) and positional notation to represent values.
  • The four main systems are Binary (2), Octal (8), Decimal (10), and Hexadecimal (16).
  • The value of each digit = digit × base^position.

Exam Tip:

You may be asked to identify a number system by its digits. If a number contains letters like A, B, C, D, E, F — it is hexadecimal. If it has digits 8 or 9 — it cannot be binary or octal. Memorize the digit ranges!

1.4 Number System and their Conversion

Number system conversion is the process of expressing the same value in a different base. Since computers use binary internally but humans use decimal, conversion is a critical skill in digital design.

The two main strategies are: successive division (for integer parts, going from decimal to another base) and successive multiplication (for fractional parts). Converting between binary, octal, and hex is especially easy because they share powers-of-2 relationships.

ConversionMethod
Decimal → Any BaseDivide by base repeatedly; collect remainders bottom-up
Any Base → DecimalMultiply each digit by base^position and sum all
Binary → OctalGroup bits in 3s from right; convert each group
Binary → HexGroup bits in 4s from right; convert each group
Octal → BinaryReplace each octal digit with its 3-bit binary equivalent
Hex → BinaryReplace each hex digit with its 4-bit binary equivalent
Octal ↔ HexConvert via binary as intermediate step

1.4.1 Binary Number System

The binary number system uses base 2 with only two digits: 0 and 1. These correspond to the OFF and ON states of electronic switches (transistors). Every piece of data inside a computer is ultimately stored and processed as binary.

Each binary digit is called a bit. A group of 8 bits is a byte. Binary numbers are written with a subscript 2 or prefix 0b — e.g., 1011₂.

Positional values in binary (powers of 2):

Position76543210
Value (2^n)1286432168421

Binary → Decimal (expand positional values):

1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰
       = 8 + 0 + 2 + 1
       = 11₁₀

Decimal → Binary (repeated division by 2):

Convert 13₁₀ to Binary:
13 ÷ 2 = 6  remainder 1  ← LSB (Least Significant Bit)
 6 ÷ 2 = 3  remainder 0
 3 ÷ 2 = 1  remainder 1
 1 ÷ 2 = 0  remainder 1  ← MSB (Most Significant Bit)

Read remainders bottom-up: 1101₂

Verify: 1×8 + 1×4 + 0×2 + 1×1 = 13 ✓

Binary → Octal (group into 3 bits):

1011010₂ → pad to: 001 011 010
001 = 1,  011 = 3,  010 = 2
Result: 132₈

Binary → Hexadecimal (group into 4 bits):

1011 1010₂ → 1011 = B,  1010 = A
Result: BA₁₆

Summary

  • Binary uses base 2 (digits 0 and 1); it is the native language of computers.
  • Binary → Decimal: multiply each bit by its positional power of 2 and sum.
  • Decimal → Binary: divide by 2 repeatedly, read remainders bottom-up.
  • Binary → Octal: group into 3 bits; Binary → Hex: group into 4 bits.

Exam Tip:

Always pad binary groups with leading zeros when converting to octal or hex. For example, 101₂ for octal grouping becomes 001 → 1, not just 101 → 5 (that's wrong grouping). LSB is on the right, MSB on the left.

1.4.2 Octal Number System

The octal number system uses base 8 and the digits 0 through 7. It was historically used as a compact shorthand for binary because each octal digit represents exactly 3 binary bits. You'll see it in Unix file permissions (e.g., chmod 755).

Octal → Decimal:

Convert 725₈ to Decimal:
7×8² + 2×8¹ + 5×8⁰
= 7×64 + 2×8 + 5×1
= 448 + 16 + 5
= 469₁₀

Decimal → Octal (divide by 8):

Convert 469₁₀ to Octal:
469 ÷ 8 = 58  remainder 5
 58 ÷ 8 =  7  remainder 2
  7 ÷ 8 =  0  remainder 7

Read bottom-up: 725₈ ✓

Octal → Binary (each digit = 3 bits):

7 = 111,  2 = 010,  5 = 101
725₈ = 111 010 101₂

Summary

  • Octal uses base 8; digits range from 0 to 7.
  • Each octal digit maps to exactly 3 binary bits.
  • Octal to Decimal: expand using powers of 8.

1.4.3 Decimal Number System

The decimal number system is the one humans use naturally in everyday life. It uses base 10 with digits 0 through 9. Each position represents a power of 10.

While computers do not work internally in decimal, all human-readable output is converted back to decimal. Understanding decimal is foundational because every other conversion usually passes through it as an intermediate step.

Example: 3825₁₀
= 3×10³ + 8×10² + 2×10¹ + 5×10⁰
= 3000 + 800 + 20 + 5 = 3825

Summary

  • Decimal is base 10, using digits 0–9; it is the most familiar number system.
  • It serves as the common bridge when converting between other number systems.

1.4.4 Hexadecimal Number System

The hexadecimal (hex) number system uses base 16 with digits 0–9 and letters A–F (where A=10, B=11, C=12, D=13, E=14, F=15). Each hex digit represents exactly 4 binary bits (a nibble), making hex an extremely compact way to write binary. Memory addresses, color codes (#FF5733), and machine language are all written in hex.

DecimalBinaryOctalHexadecimal
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F

Hex → Decimal:

Convert 2AF₁₆ to Decimal:
2×16² + A×16¹ + F×16⁰
= 2×256 + 10×16 + 15×1
= 512 + 160 + 15
= 687₁₀

Decimal → Hex (divide by 16):

Convert 687₁₀ to Hex:
687 ÷ 16 = 42  remainder 15 → F
 42 ÷ 16 =  2  remainder 10 → A
  2 ÷ 16 =  0  remainder  2 → 2

Read bottom-up: 2AF₁₆ ✓

Summary

  • Hex uses base 16 with digits 0–9 and A–F; each hex digit = 4 binary bits.
  • Widely used in memory addressing, color codes, and machine-level programming.
  • Converting hex to/from binary requires no calculation — just a direct digit-to-nibble mapping.

Exam Tip:

Memorize A=10 through F=15. Exams frequently ask you to convert a hex number to decimal or binary. The table of 0–15 equivalents across all four systems is the most tested fact in this entire unit — print it and stick it somewhere visible.

1.5 Representation of Signed Numbers and Floating Point Numbers

So far we only dealt with positive numbers. But in real computing, we also need to represent negative numbers. Computers cannot use a minus sign — everything must be in 0s and 1s. Three main methods exist to represent signed integers in binary.

Signed Number Representations

MethodIdeaRange (n bits)Problem
Sign-MagnitudeMSB = sign (0=+, 1=−); rest = magnitude−(2^(n-1)−1) to +(2^(n-1)−1)Two representations of zero (+0, −0); complex arithmetic
1's ComplementInvert all bits of positive number to get negative−(2^(n-1)−1) to +(2^(n-1)−1)Still two zeros; end-around carry in addition
2's ComplementInvert all bits then add 1−2^(n-1) to +(2^(n-1)−1)None — industry standard

Example with 4-bit representation of −5:

+5 in binary = 0101

Sign-Magnitude of −5:  1101   (MSB set to 1)
1's Complement of −5:  1010   (flip all bits of 0101)
2's Complement of −5:  1011   (1010 + 1 = 1011)

Personal Side Note:

2's complement is what your computer actually uses. The other two are mostly asked in exams to test your understanding. If an exam asks "represent −7 in 8-bit 2's complement", just flip all bits of +7 and add 1 — you've got it.

Floating Point Number Representation

Integers can't represent decimal fractions like 3.14 or very large/small numbers like 6.022×10²³. The floating point representation solves this using a format similar to scientific notation.

The IEEE 754 standard is the most widely used floating point format. A floating point number has three parts: Sign bit, Exponent, and Mantissa (Fraction/Significand).

FormatTotal BitsSignExponentMantissaBias
Single Precision321 bit8 bits23 bits127
Double Precision641 bit11 bits52 bits1023

The formula for the value: Value = (−1)^Sign × 1.Mantissa × 2^(Exponent − Bias)

Example: Represent −6.5 in IEEE 754 Single Precision

Step 1: Sign = 1 (negative)
Step 2: 6.5 in binary = 110.1₂
Step 3: Normalize: 1.101 × 2²
Step 4: Exponent = 2 + 127 (bias) = 129 = 10000001₂
Step 5: Mantissa = 101 followed by 20 zeros = 10100000000000000000000

Final: 1 | 10000001 | 10100000000000000000000

Summary

  • Signed numbers use MSB as sign; three representations: Sign-Magnitude, 1's Complement, 2's Complement.
  • 2's Complement is the standard used in modern computers — one unique zero, straightforward arithmetic.
  • Floating point stores fractions and very large/small numbers using Sign + Exponent + Mantissa (IEEE 754).
  • Single precision = 32 bits (bias 127); Double precision = 64 bits (bias 1023).

Exam Tip:

To find 2's complement: flip all bits → add 1. Alternatively, from right, keep all bits up to and including the first 1, then flip the rest. Both methods give the same result. For floating point, always remember: stored exponent = actual exponent + bias.

1.6 Complement of Number Systems

The complement of a number is used primarily to perform subtraction using only addition circuits — a massive hardware simplification. There are two types of complements for any radix r: the r's complement and the (r−1)'s complement.

Let's Break It Down:

Think of complements like a clock. On a 12-hour clock, going back 3 hours from 12 is the same as going forward 9 hours. The complement is that "alternative path" — subtraction becomes addition. Computers love this because they only need adder circuits, no separate subtractors.

1.6.1 r's Complement

The r's complement of an n-digit number N in base r is defined as: r^n − N. For binary (r=2), this gives the 2's complement. For decimal (r=10), this gives the 10's complement.

2's Complement (r=2, n=4):
Number N = 0110₂ (= 6₁₀)
2's complement = 2⁴ − 0110 = 10000 − 0110 = 1010₂ (= 10₁₀)
Verify: 6 + 10 = 16 = 2⁴ ✓

Shortcut: Flip all bits, then add 1.
0110 → flip → 1001 → add 1 → 1010 ✓

10's Complement (r=10, n=3):
Number N = 342₁₀
10's complement = 10³ − 342 = 1000 − 342 = 658₁₀
Verify: 342 + 658 = 1000 = 10³ ✓

Shortcut: Subtract each digit from 9 (except rightmost non-zero),
subtract rightmost non-zero from 10.
342 → 6 5 8 ✓

Using 2's complement for subtraction: To compute A − B, take 2's complement of B and add to A. Discard the carry out of MSB.

Example: 1010 − 0110 (10 − 6 = 4)
2's complement of 0110 = 1010
Add: 1010 + 1010 = 10100
Discard carry: 0100 = 4 ✓

1.6.2 (r−1)'s Complement (with r as 2 or 10)

The (r−1)'s complement of an n-digit number N in base r is: r^n − r^0 − N = (r^n − 1) − N. For binary (r=2), this is 1's complement. For decimal (r=10), this is 9's complement.

1's Complement (r=2):
Number N = 0110₂
1's complement = (2⁴ − 1) − 0110 = 1111 − 0110 = 1001₂
Shortcut: Simply flip all bits → 0110 → 1001 ✓

9's Complement (r=10, n=3):
Number N = 342₁₀
9's complement = (10³ − 1) − 342 = 999 − 342 = 657₁₀
Shortcut: Subtract every digit from 9 → 9−3=6, 9−4=5, 9−2=7 → 657 ✓

Subtraction using 1's complement: Add the 1's complement of the subtrahend to the minuend. If a carry occurs out of the MSB, add it back to the result — this is the end-around carry.

Example: 1010 − 0110 using 1's complement
1's complement of 0110 = 1001
  1010
+ 1001
------
 10011  ← carry out of MSB
Add carry: 0011 + 1 = 0100 = 4 ✓

ComplementFor Binary (r=2)For Decimal (r=10)FormulaShortcut
r's Complement2's Complement10's Complementr^n − NFlip bits + add 1 (binary); subtract from 10 (last non-zero) and 9 (rest)
(r−1)'s Complement1's Complement9's Complement(r^n − 1) − NFlip all bits (binary); subtract each digit from 9 (decimal)

Summary

  • r's complement = r^n − N; for binary this is 2's complement (flip + add 1).
  • (r−1)'s complement = (r^n − 1) − N; for binary this is 1's complement (just flip bits).
  • 2's complement is preferred: unique zero, no end-around carry needed for subtraction.
  • 1's complement subtraction requires end-around carry (add carry back to result).

Exam Tip:

Exams often ask: "Find 1's and 2's complement of 10110101." For 1's complement: flip each bit → 01001010. For 2's complement: add 1 to 1's complement → 01001011. Also expect questions on subtraction using complements — show every step clearly.

1.7 Binary Arithmetic

Binary arithmetic involves performing mathematical operations — addition, subtraction, multiplication, and division — directly on binary numbers using the same logic as decimal, but with only two digits (0 and 1) and a carry/borrow mechanism that kicks in much sooner.

Binary Addition

Rules of binary addition:

ABSumCarry
0000
0110
1010
1101
Example: Add 1011 + 0110
  1011   (= 11)
+ 0110   (=  6)
------
 10001   (= 17) ✓

Carry chain: position 0: 1+0=1; position 1: 1+1=10 (write 0, carry 1);
             position 2: 0+1+1=10 (write 0, carry 1); position 3: 1+0+1=10 (write 0, carry 1)
             carry produces the leading 1.

Binary Subtraction

Rules of binary subtraction (using borrow):

ABDifferenceBorrow
0000
0111 (borrow)
1010
1100
Example: 1101 − 0110 (= 13 − 6 = 7)
  1101
- 0110
------
  0111 = 7 ✓

Binary Multiplication

Binary multiplication follows the same partial-product method as decimal long multiplication. Since digits are only 0 or 1, each partial product is either 0 or a shifted copy of the multiplicand.

Example: 1011 × 0101 (= 11 × 5 = 55)
    1011
  × 0101
  ------
    1011    (1011 × 1, shift 0)
   0000     (1011 × 0, shift 1)
  1011      (1011 × 1, shift 2)
 0000       (1011 × 0, shift 3)
---------
 0110111 = 55 ✓

Binary Division

Binary division uses the same long division method as decimal. At each step, you check if the divisor fits into the current portion of the dividend — place 1 if yes, 0 if no.

Example: 1100 ÷ 0011 (= 12 ÷ 3 = 4)

    0100
   ------
11 ) 1100
      11
     ---
      000  → quotient = 0100 = 4 ✓

Summary

  • Binary addition: 1+1 = 10 (write 0, carry 1); all other combos are straightforward.
  • Binary subtraction: 0−1 = 1 with a borrow from the next position.
  • Multiplication uses shift-and-add; division uses shift-and-subtract.
  • In hardware, subtraction is typically done using 2's complement addition.

Exam Tip:

Always show working step-by-step in exam answers. For addition, write the carry row explicitly. For multiplication, write each partial product on a separate line with the correct shift. Examiners award marks for working, not just the final answer.

1.8 Representation of BCD, ASCII, Excess-3, Gray Code, and Error Detection Codes

Beyond pure binary, several special codes have been developed to make it easier for computers to represent and communicate human-readable information or to handle data more reliably.

BCD — Binary Coded Decimal

BCD (Binary Coded Decimal) represents each decimal digit (0–9) using its 4-bit binary equivalent. Instead of converting the entire decimal number to binary, each digit is independently coded. BCD is used in digital displays (calculators, clocks) where decimal output is directly needed.

Example: Convert 539 to BCD
5   →  0101
3   →  0011
9   →  1001
BCD of 539 = 0101 0011 1001

Note: Codes 1010 through 1111 (10–15) are invalid in BCD — only 0000 to 1001 are used.

DecimalBCDDecimalBCD
0000050101
1000160110
2001070111
3001181000
4010091001

Exam Tip:

BCD is NOT the same as binary. 539 in pure binary is 1000011011; in BCD it's 0101 0011 1001. Also note: BCD addition — if the sum of two BCD digits exceeds 9 or produces a carry, add 6 (0110) to correct it.

ASCII — American Standard Code for Information Interchange

ASCII is a character encoding standard that assigns a unique 7-bit binary number to every letter, digit, punctuation mark, and control character. This allows computers to store and communicate text. Standard ASCII covers 128 characters (0–127). Extended ASCII uses 8 bits for 256 characters.

CharacterDecimalBinaryHex
A65100000141
B66100001042
Z9010110105A
a97110000161
0 (digit)48011000030
Space32010000020

Exam Tip:

Key ASCII values to memorize: 'A' = 65, 'a' = 97, '0' = 48. Lowercase = Uppercase + 32. ASCII codes 0–31 are non-printable control characters (like newline, tab).

Excess-3 Code (XS-3)

Excess-3 (XS-3) is a BCD variant where each decimal digit is represented by its BCD equivalent plus 3 (0011). For example, decimal 5 in BCD is 0101; in Excess-3 it is 0101 + 0011 = 1000. It is a self-complementing code — the 9's complement of a digit can be obtained by simply inverting all bits, which simplifies BCD subtraction.

DecimalBCDExcess-3
000000011
100010100
200100101
300110110
401000111
501011000
601101001
701111010
810001011
910011100

Exam Tip:

Excess-3 is self-complementing: inverting the XS-3 code of a digit gives the XS-3 code of its 9's complement (9 − digit). Example: XS-3 of 4 = 0111; invert = 1000 = XS-3 of 5 (and 9−4=5). This is why it simplifies BCD arithmetic circuits.

Gray Code (Reflected Binary Code)

Gray code is a binary code where only one bit changes between consecutive values — this is called the unit distance property. It was invented by Frank Gray at Bell Labs and is used in rotary encoders, analog-to-digital converters, and error minimization in digital communications.

Let's Break It Down:

Imagine a car speedometer where the display jumps from 09 to 10. In regular binary, multiple bits change at once — if the hardware reads them at slightly different times, you could briefly read a wrong value. Gray code fixes this: only one bit ever changes at a time, so there's never an ambiguous in-between state. It's like a relay race where only one runner moves at a time.

Binary to Gray Code Conversion:

Rule: MSB of Gray code = MSB of binary.
      Each subsequent bit = XOR of current binary bit and previous binary bit.

Example: Binary 1011 → Gray Code
MSB: G3 = B3 = 1
G2 = B3 XOR B2 = 1 XOR 0 = 1
G1 = B2 XOR B1 = 0 XOR 1 = 1
G0 = B1 XOR B0 = 1 XOR 1 = 0

Gray Code = 1110

Gray Code to Binary Conversion:

Rule: MSB of binary = MSB of Gray code.
      Each subsequent binary bit = XOR of previous binary bit and current Gray bit.

Example: Gray Code 1110 → Binary
B3 = G3 = 1
B2 = B3 XOR G2 = 1 XOR 1 = 0
B1 = B2 XOR G1 = 0 XOR 1 = 1
B0 = B1 XOR G0 = 1 XOR 0 = 1

Binary = 1011 ✓ (back to original)

DecimalBinaryGray CodeBits Changed
000000000—
1000100011
2001000111
3001100101
4010001101
5010101111
6011001011
7011101001

Error Detection Codes

Error detection codes are special coding techniques that add extra bits to data so that transmission or storage errors can be automatically detected (and sometimes corrected). When digital data travels through noisy channels, bits can flip — error codes catch this.

Parity Bit

The simplest error detection method. A single extra bit — the parity bit — is appended to the data to make the total number of 1s either even (even parity) or odd (odd parity). If a single bit flips during transmission, the parity count changes and the error is detected. However, if two bits flip, the error cancels out — parity cannot detect even-number bit errors.

Data: 1011001 (four 1s — already even)
Even parity bit: 0  → transmitted as 1011001 0
Odd parity bit:  1  → transmitted as 1011001 1

If received as 1111001 (one bit flipped):
Count of 1s = 5 (odd) — parity error detected!

Hamming Code

Hamming code, developed by Richard Hamming, is an error-correcting code that can detect and correct single-bit errors. It works by strategically placing parity bits at positions that are powers of 2 (positions 1, 2, 4, 8, ...) among the data bits. Each parity bit covers a specific subset of data bit positions.

For a 4-bit data word, Hamming code needs 3 parity bits (total 7 bits):
Bit positions: 1  2  3  4  5  6  7
               P1 P2 D1 P3 D2 D3 D4

P1 covers positions: 1, 3, 5, 7 (binary: bit1=1)
P2 covers positions: 2, 3, 6, 7 (binary: bit2=1)
P3 covers positions: 4, 5, 6, 7 (binary: bit3=1)

If an error occurs, the parity checks reveal which position has the error → it is flipped to correct it.
This is called Single Error Correction, Double Error Detection (SECDED) when an extra bit is added.

CodeTypeDetectsCorrectsOverhead
Parity BitDetection onlyOdd number of bit errorsCannot correct1 extra bit
Hamming CodeDetection + Correction1–2 bit errorsSingle-bit errorlog₂(n)+1 extra bits
CRCDetection onlyBurst errorsCannot correct16–32 extra bits

Summary

  • BCD: each decimal digit represented by 4 bits independently; codes 1010–1111 invalid.
  • ASCII: 7-bit code for 128 characters; 'A'=65, 'a'=97, '0'=48.
  • Excess-3: BCD + 3; self-complementing, simplifies subtraction.
  • Gray code: only 1 bit changes per step; used in encoders to prevent reading errors.
  • Error Detection: parity detects odd-bit errors; Hamming code corrects single-bit errors.

Exam Tip:

For Gray code questions: Binary→Gray uses XOR with the previous binary bit. Gray→Binary uses XOR with the previous binary result. For Hamming code: number of parity bits r needed satisfies 2^r ≥ m + r + 1 where m is the number of data bits.

Chapter Summary — Unit 1: Digital Design Fundamentals and Number System

  • Analog signals are continuous; digital signals are discrete (0 or 1). Digital systems are more noise-resistant and programmable.
  • The four main number systems are Binary (2), Octal (8), Decimal (10), and Hexadecimal (16), all using positional notation with base-weighted digit values.
  • Conversion rules: Decimal↔Any base via repeated division/expansion; Binary↔Octal via 3-bit grouping; Binary↔Hex via 4-bit grouping.
  • Signed numbers use Sign-Magnitude, 1's complement, or 2's complement (the industry standard). Floating point (IEEE 754) represents fractions/large numbers using Sign + Exponent + Mantissa.
  • Complements: r's complement = r^n − N (2's complement for binary); (r−1)'s complement = (r^n−1) − N (1's complement for binary). Used to simplify subtraction hardware.
  • Binary arithmetic follows the same rules as decimal but with carry/borrow at 2 instead of 10. 1+1=10 in binary.
  • BCD codes each decimal digit with 4 bits separately. ASCII encodes 128 characters in 7 bits. Excess-3 is self-complementing BCD+3. Gray code changes only 1 bit per step. Error codes (parity, Hamming) detect and correct transmission errors.
Views: …
TUpapers.com logo tupapers.com
  • Privacy Policy

  • Contact Us

  • Terms

  • Pricing

  • SEEpapers.com

TUpapers on Facebook
TUpapers on Instagram
Contact TUpapers on WhatsApp Contact TUpapers on WhatsApp
TUpapers subreddit on Reddit

Courses

  • BBA

  • BCA

  • BIT

  • CSIT

  • BBS

  • BHM

  • BBM

  • BITM

  • BTTM

  • BA

  • BE

  • BSW

© 2026 tupapers.com. All rights reserved.