Mastering Digital Electronics: From Binary Basics to Verilog Design

Description

Explore the core concepts of digital electronics starting from binary numbers to number system conversions, complements, signed arithmetic, and logic simplification techniques like K-maps — all in a simplified manner for learners.

Introduction

Digital electronics is the backbone of all modern devices—from smartphones to spacecraft. Whether you’re an engineering student just starting your journey, a faculty member preparing course content, or a VLSI enthusiast building your first project, a solid grasp of binary logic, number systems, and circuit design is essential. This blog walks you through key concepts with clear explanations and step-by-step examples, making learning intuitive and hands-on. Perfect for anyone looking to strengthen their foundation in digital design or preparing for practical lab sessions and design challenges.

Digital Systems:

                            A digital system is a system that processes discrete (separate) values, typically using binary signals (0s and 1s). Unlike analog systems that deal with continuous signals, digital systems operate using logic levels that are either on (1) or off (0)

Binary values are a base- 2 numeral system and are represented by digits 0 and 1.

 Digital systems operate using binary.

 But we also use other number systems to simplify representation:

  • Octal (base-8) for compact 3-bit grouping.
  • Decimal (base-10) for human-friendly interaction.
  • Hexadecimal (base-16) for 4-bit grouping in digital design.

Types of Number Systems in Digital Electronics 

Number System

Base

Digits Used

Binary

2

0, 1

Octal

8

0–7

Decimal

10

0–9

Hexadecimal

16

0–9, A(10)–F(15)

The six letters (in addition to the 10 integers) in hexadecimal represent: 10, 11, 12, 13, 14, and 15, respectively.

Binary Arithmetic:

Addition: Rules of binary addition are as follows

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 0, and carry 1 to the next higher significant bit

Subtraction: Rules of binary subtraction are as follows

  • 0 – 0 = 0
  • 0 – 1 = 1, and borrow from the next higher significant bit
  • 1 – 0 = 1
  • 1 – 1 = 0

Number Base Conversions

Number base conversion is the process of converting numbers from one base to another (e.g., Decimal to Binary, Binary to Hexadecimal, etc.). This is essential in digital systems for communication between humans and machines.

1) Decimal to binary

Method: Divide by 2 repeatedly and record the remainders in reverse.

Example:  Convert 13 to binary
→ 13 ÷ 2 = 6, remainder 1
→ 6 ÷ 2 = 3, remainder 0
→ 3 ÷ 2 = 1, remainder 1
→ 1 ÷ 2 = 0, remainder 1
Answer: 1101₂

2)  Binary to decimal

Method: Multiply each bit by 2ⁿ (starting from right, n = 0) and sum.

Example:
Convert 1011₂ to decimal
→ (1×2³) + (0×2²) + (1×2¹) + (1×2⁰)
→ 8 + 0 + 2 + 1 = 11

3) Binary to Octal

Method: Group binary digits in sets of 3 (from right), then convert.

Example:
Binary: 110110
→ Group: 110 110
→ Octal: 6 6 → 66₈

4) Binary to Hexadecimal (Base-2 → Base-16)

Method: Group binary digits in sets of 4 (from right), then convert.

Example:
Binary: 11101001
→ Group: 1110 1001
→ Hex: E9 → E9₁₆

 5) Hexadecimal to Binary (Base-16 → Base-2)

Method: Replace each hex digit with 4-bit binary.

Example:
Hex: 2F
→ 2 = 0010, F = 1111
→ Binary: 00101111

 

 

  1. Decimal to Binary (with fractional part)

Steps:

  1. Convert the integer part to binary using repeated division by 2.
  2. Convert the fractional part using repeated multiplication by 2.
  3. Combine both parts with a binary point (.) in between.

Example: Convert 10.625 to binary

Step 1: Integer part (10)
Divide by 2 and record the remainders (bottom to top):

10 ÷ 2 = 5 → remainder 0 

 5 ÷ 2 = 2 → remainder 1 

 2 ÷ 2 = 1 → remainder 0 

 1 ÷ 2 = 0 → remainder 1 

→ Binary: 1010

Step 2: Fractional part (0.625)
Multiply by 2 and take the integer parts:

0.625 × 2 = 1.25 → 1 

0.25  × 2 = 0.5  → 0 

0.5   × 2 = 1.0  → 1 

→ Binary: .101

Final Answer:
10.625 (decimal) = 1010.101 (binary)

  1. Binary to Decimal (with fractional part)

Steps:

  1. Convert the integer part using powers of 2 from right to left.
  2. Convert the fractional part using negative powers of 2 from left to right.

Example: Convert 1010.101 to decimal

Step 1: Integer part (1010)

1×2³ + 0×2² + 1×2¹ + 0×2⁰ 

= 8 + 0 + 2 + 0 = 10

Step 2: Fractional part (.101)

1×2⁻¹ + 0×2⁻² + 1×2⁻³ 

= 0.5 + 0 + 0.125 = 0.625

Final Answer:
1010.101 (binary) = 10.625 (decimal)

 

Complements of Numbers

In digital systems and arithmetic, complements are used to simplify subtraction and handle negative numbers in binary systems.

There are two main types:

  1. 1’s Complement
  2. 2’s Complement

 

1’s Complement (One’s Complement)

Definition:
The 1’s complement of a binary number is formed by flipping all the bits — changing 1 to 0 and 0 to 1.

Example:
Binary: 10110011
1’s complement: 01001100

This is equivalent to a logical NOT operation.

 

2’s Complement (Two’s Complement)

Definition:
The 2’s complement is found by adding 1 to the 1’s complement of a number.

Steps to Find 2’s Complement:

  1. Take the binary number.
  2. Find its 1’s complement (invert bits).
  3. Add 1 to the result.

Example:
Binary: 00010100 (20 in decimal)
→ 1’s complement: 11101011
→ Add 1: 11101100
2’s complement: 11101100 (Represents -20 in 8-bit 2’s complement form)

Why Are Complements Important?

  • Used in binary subtraction
    A – B = A + (2’s complement of B)
  • Helps in representing negative numbers in binary.
  • Simplifies hardware design for arithmetic units.

Signed Binary Numbers

In digital systems, numbers can be positive or negative. Negative numbers in binary are represented using signed binary representations.

Unlike unsigned binary (which represents only positive numbers), signed binary formats allow for both positive and negative values.

For an 8-bit unsigned binary number, the range is 0 to 255.
For an 8-bit signed binary number (using 2’s complement), the range is −128 to +127.

Methods to Represent Signed Binary Numbers

There are three common ways to represent signed numbers in binary:

  1. Sign-Magnitude Representation
  • The most significant bit (MSB) is the sign bit:
    • 0 = positive
    • 1 = negative
  • The remaining bits represent the magnitude (absolute value).

Example (8 bits):
+5 → 00000101
−5 → 10000101

Issues:

  • Two representations of 0: 00000000 (+0), 10000000 (−0)
  • Arithmetic is more complex
  1. 1’s Complement
  • Negative numbers are represented by inverting all bits of the positive number.
  • MSB still indicates the sign.

Example (8 bits):
+5 → 00000101
−5 → 11111010 (1’s complement of 5)

Issues:

  • Still has two zeros: +0 (00000000) and −0 (11111111)
  • Addition requires handling an end-around carry
  1. 2’s Complement
  • Most commonly used in computers
  • Negative number = invert all bits of the number and add 1
  • Only one representation for 0

Example (8 bits):
+5 → 00000101
−5 → 11111011 (invert 00000101 → 11111010, then add 1 → 11111011)

Advantages:

  • Unique 0 (00000000)
  • Easy arithmetic (same hardware for addition and subtraction)
  • Widely used in processors

Binary coded decimal:

BCD (Binary-Coded Decimal) is a method of representing decimal numbers (0–9) in binary form, where each decimal digit is stored separately as a 4-bit binary number.

 Key Points:

  1. Each decimal digit (0–9) is encoded using 4 bits (a nibble).
  2. This means that only binary values from 0000 (0) to 1001 (9) are valid in BCD.
  3. Binary values from 1010 (10) to 1111 (15) are invalid in standard BCD.

Example: In pure binary, 89 = 01011001,
                 But in BCD, 8 → 1000, 9 → 1001 → 10001001

BCD Addition

  • When the binary sum is equal to or less than 1001 (without a carry), the corresponding BCD digit is correct.
  • However, when the binary sum is greater than or equal to 1010, the result is an invalid BCD digit.
  • The addition of 6(0110) to the binary sum converts it to the correct digit and also produces a carry as required.
  • This is because a carry in the most significant bit position of the binary sum and a decimal carry differ by 16 – 10 = 6.

Gray code:

Gray Code is a binary numeral system where two successive values differ in only one bit. It is also known as Reflected Binary Code or Unit Distance Code.

Why Use Gray Code?

  • To minimize errors in digital systems where changing multiple bits simultaneously can cause glitches.

Conversion:

  1. Binary to Gray Code:
  • First bit (MSB) of Gray = First bit of Binary
  • Each next bit = XOR of current binary bit and the previous binary bit

Example:
Binary = 1011
Gray:

  • 1st bit = 1
  • 2nd = 0 XOR 1 = 1
  • 3rd = 1 XOR 0 = 1
  • 4th = 1 XOR 1 = 0
    Gray Code = 1110
  1. Gray Code to Binary:
  • First bit (MSB) of Binary = First bit of Gray
  • Each next bit = Previous binary bit XOR current gray bit

Example:
Gray = 1110
Binary:

  • 1st = 1
  • 2nd = 1 XOR 1 = 0
  • 3rd = 0 XOR 1 = 1
  • 4th = 1 XOR 0 = 1
    Binary = 1011

Logic minimization
Karnaugh Map (K-map)

          A K-map is a graphical tool used to simplify Boolean expressions and minimize logic circuits easily.

What is it?

  • It’s a grid-like representation of truth table values.
  • Helps to visually group 1s (for SOP) or 0s (for POS) to find simplified expressions.
  • Works best for functions with 2 to 6 variables.

How does it work?

  • Each cell represents a minterm (a unique combination of variable values).
  • Adjacent cells differ by only one variable (Gray code order).
  • Group adjacent 1s in sizes of 1, 2, 4, 8… (powers of two).
  • Each group corresponds to a simplified product term.

 

Example: 3-Variable K-map Simplification

Given function:

F(A, B, C) = 1 for minterms 1, 3, 5, 7
(That means F = 1 when the inputs are these binary combinations):

Decimal

A

B

C

F

0

0

0

0

0

1

0

0

1

1

2

0

1

0

0

3

0

1

1

1

4

1

0

0

0

5

1

0

1

1

6

1

1

0

0

7

1

1

1

1

Step 1: Draw the K-map

AB\C

0

1

00

0

1

01

0

1

11

0

1

10

0

1

Rows are labeled by AB in Gray code: 00, 01, 11, 10
Columns are C = 0 or 1

Step 2: Fill in the K-map with F values (1 or 0)

AB\C

0

1

00

0

1

01

0

1

11

0

1

10

0

1

Step 3: Group adjacent 1s (in powers of 2)

  • All 1s are in the column where C=1 → a group of 4 cells vertically.

Step 4: Write simplified expression

  • Since C=1 for all grouped cells, the simplified function is:

F = C

Original function was complicated, but K-map showed that F depends only on C in this case.

Conclusion

                You’ve now explored the essential building blocks of digital electronics—from basic binary concepts to logic simplification using K-maps. Each topic was presented step by step to reinforce clarity and build confidence. Whether you’re preparing for deeper Verilog programming or aiming to work with actual hardware like the Pantech VLSI Trainer Kit, this guide ensures you’re equipped with the right concepts and practice.

Ready to take the next step? Dive into the upcoming modules on combinational and sequential circuits, simulation techniques, and Verilog coding to strengthen your digital design skills and move closer to real-time hardware implementation

Mon-fri 09:00 AM - 07:00 PM
Sunday Closed
Open chat
Wellcome to Pantech...
Hello 👋
Can we help you?