Digital Logic Design: Complete Guide to Digital Systems and Binary Numbers
📋 Table of Contents
📚 Course Information: IT-151 Digital Logic Design
Text Book: M. Morris Mano, Digital Design, 5th Edition
Additional Readings: Lectures, slides, tutorials
Course Outline - Week 1: Digital System and Binary System
- Digital Systems
- Binary Numbers
- Number-Base Conversions
- Octal and Hexadecimal Numbers
- Complements of Numbers
- Signed Binary Numbers
- Binary Codes
- Binary Storage and Registers
- Binary Logic
📜 Historical Background
The development of digital systems and binary logic has revolutionized modern technology:
- George Boole (1847): Developed Boolean algebra, the mathematical foundation of digital logic
- Claude Shannon (1937): Showed how Boolean algebra could be used to design digital circuits
- John von Neumann (1945): Proposed the stored-program computer architecture
- Jack Kilby & Robert Noyce (1958-59): Invented the integrated circuit
- Gordon Moore (1965): Formulated Moore's Law predicting exponential growth in computing power
These developments created the foundation for the digital age we live in today.
1. Introduction to Digital Systems
🔬 What are Digital Systems?
Digital systems have such a prominent role in everyday life that we refer to the present technological period as the digital age. Digital systems are used in communication, business transactions, traffic control, spacecraft guidance, medical treatment, weather monitoring, the Internet, and many other commercial, industrial, and scientific enterprises.
We have digital telephones, digital televisions, digital versatile discs, digital cameras, handheld devices, and, of course, digital computers. These devices have graphical user interfaces (GUIs), which enable them to execute commands that appear to the user to be simple, but which, in fact, involve precise execution of a sequence of complex internal instructions.
📝 Key Characteristics of Digital Systems
One characteristic of digital systems is their ability to represent and manipulate discrete elements of information. Any set that is restricted to a finite number of elements contains discrete information. Examples of discrete sets are:
- The 10 decimal digits
- The 26 letters of the alphabet
- The 52 playing cards
- The 64 squares of a chessboard
Early digital computers were used for numeric computations. From this application, the term digital computer emerged.
💡 Binary Representation
Discrete elements of information are represented in a digital system by physical quantities called signals. Electrical signals such as voltages and currents are the most common. The signals in most present-day electronic digital systems use just two discrete values and are therefore said to be binary.
A binary digit, called a bit, has two values: 0 and 1. Discrete elements of information are represented with groups of bits called binary codes.
2. Binary Numbers
🔢 Understanding Number Systems
A decimal number such as 7392 represents a quantity equal to 7 thousands, plus 3 hundreds, plus 9 tens, plus 2 units. The thousands, hundreds, etc., are powers of 10 implied by the position of the coefficients in the number.
2.1 Binary Number System
🧮 Binary System Fundamentals
General Number Representation
A number expressed in a base-r system has coefficients multiplied by powers of r:
The coefficients \(a_j\) range in value from 0 to \(r - 1\).
Binary Number Example
The binary system is a base-2 system. The coefficients have only two possible values: 0 and 1. For example, the decimal equivalent of the binary number 11010.11 is 26.75:
2.2 Powers of Two
| n | 2ⁿ | n | 2ⁿ | n | 2ⁿ |
|---|---|---|---|---|---|
| 0 | 1 | 8 | 256 | 16 | 65,536 |
| 1 | 2 | 9 | 512 | 17 | 131,072 |
| 2 | 4 | 10 | 1,024 | 18 | 262,144 |
| 3 | 8 | 11 | 2,048 | 19 | 524,288 |
| 4 | 16 | 12 | 4,096 | 20 | 1,048,576 |
| 5 | 32 | 13 | 8,192 | 21 | 2,097,152 |
| 6 | 64 | 14 | 16,384 | 22 | 4,194,304 |
| 7 | 128 | 15 | 32,768 | 23 | 8,388,608 |
3. Number-Base Conversions
🔄 Conversion Between Number Systems
The conversion of a number in base r to decimal is done by expanding the number in a power series and adding all the terms. Converting a decimal number to base r is done by separating the number into its integer and fraction parts and converting each part separately.
3.1 Decimal to Binary Conversion
3.2 Decimal Fraction to Binary
4. Octal and Hexadecimal Numbers
🔢 Alternative Number Systems
The conversion from and to binary, octal, and hexadecimal plays an important role in digital computers. Since \(2^3 = 8\) and \(2^4 = 16\), each octal digit corresponds to three binary digits and each hexadecimal digit corresponds to four binary digits.
4.1 Conversion Between Bases
Convert the binary number 10110001101011.111100000110 to octal.
4.2 Number Systems Comparison
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
5. Complements of Numbers
🔁 Understanding Complements
Complements are used in digital computers for simplifying the subtraction operation and for logical manipulation. There are two types of complements for each base-r system:
- The radix complement (also called r's complement)
- The diminished radix complement (also called (r-1)'s complement)
5.1 Diminished Radix Complement
🧮 (r-1)'s Complement
Definition
Given a number N in base r having n digits, the (r-1)'s complement of N is defined as \((r^n - 1) - N\).
Examples
For decimal numbers, r = 10 and (r-1) = 9, so the 9's complement of N is \((10^n - 1) - N\).
Binary 1's Complement
For binary numbers, r = 2 and (r-1) = 1, so the 1's complement of N is \((2^n - 1) - N\).
5.2 Radix Complement
🧮 r's Complement
Definition
The r's complement of an n-digit number N in base r is defined as \(r^n - N\) for \(N \neq 0\) and 0 for \(N = 0\).
Relationship with (r-1)'s Complement
The r's complement can be obtained from the (r-1)'s complement by adding 1:
Examples
10's complement of 012398 = 987601 + 1 = 987602
2's complement of 1101100 = 0010011 + 1 = 0010100
5.3 Subtraction with Complements
Subtract 72532 - 3250 using 10's complement.
6. Signed Binary Numbers
➕➖ Representing Negative Numbers
To represent negative integers, we need a notation for negative values. In ordinary arithmetic, a negative number is indicated by a minus sign and a positive number by a plus sign. Because of hardware limitations, computers must represent everything with binary digits.
6.1 Signed-Magnitude Representation
🧮 Sign Bit Representation
Convention
The leftmost bit (most significant bit) represents the sign:
- 0 for positive
- 1 for negative
Examples
6.2 Signed-Complement System
🧮 Complement Representation
1's Complement Representation
Positive numbers are represented as themselves, negative numbers are represented as the 1's complement of their positive counterparts.
2's Complement Representation
Positive numbers are represented as themselves, negative numbers are represented as the 2's complement of their positive counterparts.
6.3 Arithmetic with Signed Numbers
Add (-6) + (-13) using 2's complement representation (8-bit numbers).
7. Binary Codes
🔤 Encoding Information
Digital systems use signals that have two distinct values and circuit elements that have two stable states. There is a direct analogy among binary signals, binary circuit elements, and binary digits. A binary number of n digits may be represented by n binary circuit elements, each having an output signal equivalent to a 0 or a 1.
7.1 Binary-Coded Decimal (BCD)
| Decimal Digit | BCD (8421) | Excess-3 | 2421 | 84-2-1 |
|---|---|---|---|---|
| 0 | 0000 | 0011 | 0000 | 0000 |
| 1 | 0001 | 0100 | 0001 | 0111 |
| 2 | 0010 | 0101 | 0010 | 0110 |
| 3 | 0011 | 0110 | 0011 | 0101 |
| 4 | 0100 | 0111 | 0100 | 0100 |
| 5 | 0101 | 1000 | 1011 | 1011 |
| 6 | 0110 | 1001 | 1100 | 1010 |
| 7 | 0111 | 1010 | 1101 | 1001 |
| 8 | 1000 | 1011 | 1110 | 1000 |
| 9 | 1001 | 1100 | 1111 | 1111 |
7.2 Other Decimal Codes
📝 Weighted and Non-Weighted Codes
BCD and the 2421 code are examples of weighted codes. In a weighted code, each bit position has a weight, and the code represents the decimal digit by the sum of the weights of the 1 bits.
The Excess-3 code is an example of a non-weighted code. This code is derived from the corresponding BCD code by adding 0011 (3) to each coded number.
7.3 Gray Code
🔄 Reflected Binary Code
The Gray code is a binary code in which two successive values differ in only one bit. This property makes it useful in analog-to-digital conversion and in applications where a physical quantity is represented by a continuous change of a shaft position.
| Decimal | Binary | Gray Code |
|---|---|---|
| 0 | 0000 | 0000 |
| 1 | 0001 | 0001 |
| 2 | 0010 | 0011 |
| 3 | 0011 | 0010 |
| 4 | 0100 | 0110 |
| 5 | 0101 | 0111 |
| 6 | 0110 | 0101 |
| 7 | 0111 | 0100 |
| 8 | 1000 | 1100 |
| 9 | 1001 | 1101 |
| 10 | 1010 | 1111 |
| 11 | 1011 | 1110 |
| 12 | 1100 | 1010 |
| 13 | 1101 | 1011 |
| 14 | 1110 | 1001 |
| 15 | 1111 | 1000 |
7.4 ASCII Character Code
🔤 American Standard Code for Information Interchange
ASCII is a 7-bit code used to represent alphanumeric characters, punctuation marks, and control characters. It includes:
- 26 uppercase letters (A-Z)
- 26 lowercase letters (a-z)
- 10 digits (0-9)
- Various punctuation marks and special characters
- Control characters (CR, LF, ESC, etc.)
8. Binary Storage and Registers
💾 Digital Storage Elements
A binary cell is a device that possesses two stable states and is capable of storing one bit of information. The input to the cell receives excitation signals that set it to one of the two states. The output of the cell is a physical quantity that distinguishes between the two states.
8.1 Binary Cells and Registers
🧮 Register Organization
Register Definition
A register is a group of binary cells. A register with n cells can store any discrete quantity of information that contains n bits. The state of a register is an n-tuple of 1's and 0's, with each bit designating the state of one cell in the register.
Register Capacity
The total number of distinct states a register can have is \(2^n\). This number limits the total number of discrete symbols or values that can be assigned to the register.
8.2 Register Transfer
📝 Data Transfer Operations
A digital system is characterized by its registers and the components that perform data processing. The digital functions are defined as the tasks that can be performed on the binary information stored in the registers. Information transfer from one register to another is designated by a replacement operator.
Example: \(R2 \leftarrow R1\) denotes a transfer of the contents of register R1 into register R2.
9. Binary Logic
🔌 Logic Operations
Binary logic deals with variables that take on two discrete values and with operations that assume logical meaning. The two values the variables take may be called by different names, but for our purpose, it is convenient to think in terms of bits and assign the values 1 and 0.
9.1 Definition of Binary Logic
🧮 Logical Operations
Three Basic Logical Operations
- AND: This operation is represented by a dot (·) or by the absence of an operator. The AND operation produces a 1 only if all inputs are 1.
- OR: This operation is represented by a plus sign (+). The OR operation produces a 1 if at least one input is 1.
- NOT: This operation is represented by a prime (') or an overbar. The NOT operation produces the complement of the input.
Truth Tables
Each logical operation can be defined by a truth table that lists all possible input combinations and their corresponding outputs.
9.2 Logic Gates
| Gate | Graphic Symbol | Algebraic Function | Truth Table |
|---|---|---|---|
| AND | [AND Symbol] | F = x · y | x y | F 0 0 | 0 0 1 | 0 1 0 | 0 1 1 | 1 |
| OR | [OR Symbol] | F = x + y | x y | F 0 0 | 0 0 1 | 1 1 0 | 1 1 1 | 1 |
| NOT | [NOT Symbol] | F = x' | x | F 0 | 1 1 | 0 |
| NAND | [NAND Symbol] | F = (x · y)' | x y | F 0 0 | 1 0 1 | 1 1 0 | 1 1 1 | 0 |
| NOR | [NOR Symbol] | F = (x + y)' | x y | F 0 0 | 1 0 1 | 0 1 0 | 0 1 1 | 0 |
| XOR | [XOR Symbol] | F = x ⊕ y | x y | F 0 0 | 0 0 1 | 1 1 0 | 1 1 1 | 0 |
Frequently Asked Questions
The binary system is used in digital computers because:
- Simplicity: Binary devices are simple to design and build. Electronic components naturally have two stable states (on/off, high voltage/low voltage).
- Reliability: Binary signals are less susceptible to noise and distortion. The distinction between 0 and 1 is clear and easy to maintain.
- Mathematical Foundation: Boolean algebra provides a complete mathematical framework for binary logic operations.
- Cost-Effectiveness: Binary circuits are cheaper to manufacture and maintain compared to circuits that would need to handle multiple discrete levels.
The main differences between 1's complement and 2's complement are:
| Feature | 1's Complement | 2's Complement |
|---|---|---|
| Definition | Flip all bits | Flip all bits and add 1 |
| Range (n-bit) | -(2n-1-1) to +(2n-1-1) | -2n-1 to +(2n-1-1) |
| Zero Representation | Two representations: +0 and -0 | One representation: 0 |
| Arithmetic | Requires end-around carry | Simpler, no end-around carry |
| Modern Usage | Rarely used | Standard in modern computers |
2's complement is preferred in modern digital systems because it eliminates the problem of negative zero and simplifies arithmetic operations.
Gray code prevents errors in position encoding through its unique property: only one bit changes between consecutive numbers. This is particularly important in applications like:
- Rotary Encoders: When a shaft rotates between positions, only one bit changes at a time, eliminating ambiguous readings during transitions.
- Analog-to-Digital Conversion: Prevents large errors that could occur if multiple bits change simultaneously but not exactly at the same time.
- Karnaugh Maps: Used in digital logic design to simplify Boolean expressions.
For example, when moving from position 3 (binary 011) to position 4 (binary 100) in standard binary, all three bits change. If the bits don't change exactly simultaneously, temporary incorrect values like 000, 001, 010, etc., might be read. With Gray code, position 3 is 010 and position 4 is 110 - only one bit changes, eliminating this problem.
📚 Master Digital Logic Design
Understanding digital systems, binary numbers, and logic gates is fundamental to computer science, electrical engineering, and many areas of modern technology. Continue your journey into the fascinating world of digital logic and computer architecture.
Read More: Digital Logic Design Resources© Digital Logic Education | IT-151 Course: Digital Logic Design
Based on M. Morris Mano's "Digital Design, 5th Edition" with additional insights from university curriculum
Contact: digital.logic@education.com