Transistors
A transistor is a three-terminal semiconductor device that transfers electrons
from one terminal to another, leading to the generation and control of current
flow. It functions as a switch or amplifier and is a fundamental building block in
all digital electronic circuits. Transistors are the basic building blocks of digital
circuits. They are semiconductor devices that control the flow of electrical current
and act as switches or amplifiers. In digital electronics, transistors are primarily
used as switches to represent binary states (0 and 1).
Types of Transistors Used in Digital Circuits
1. Bipolar Junction Transistors (BJT)
• Current-controlled device
• Terminals: Emitter, Base, Collector
• Two main types: NPN and PNP
• Used in analog and switching applications
2. Field-Effect Transistors (FET)
• Voltage-controlled device
• Terminals: Source, Gate, Drain
• Includes MOSFETs, which are widely used in digital circuits
Among FETs, MOSFETs (Metal-Oxide-Semiconductor FETs) are the most
popular in VLSI and CMOS technologies. There are two main MOSFET types:
The most commonly used transistors in modern digital systems are MOSFETs
(Metal-Oxide-Semiconductor Field-Effect Transistors). There are two main
types:
➢ NMOS (n-type MOSFET)
• Turns ON (conducts current) when gate voltage is
HIGH (logic 1)
• Electrons are the charge carriers (high mobility)
• Faster switching speed
• Typically has a width (W) = 1 unit
➢ PMOS (p-type MOSFET)
• Turns ON when gate voltage is LOW (logic 0)
• Holes are the charge carriers (lower mobility than
electrons)
• Slower than NMOS
• Typically has a width (W) = 2 units to balance speed
The mobility of electrons in NMOS is approximately 2.5 times higher than
the mobility of holes in PMOS.
CMOS Logic (Complementary MOS)
• CMOS combines NMOS and PMOS transistors to create efficient logic
gates.
• In a CMOS inverter:
o NMOS pulls the output LOW when input is HIGH
o PMOS pulls the output HIGH when input is LOW
• Only one transistor conducts at a time, resulting in very low power
consumption.
• The output of a CMOS gate is always the complement of the input (for
inverters) or the logic function's complement depending on gate design.
When Are PMOS and NMOS Connected in Parallel or Series?
• In CMOS logic design, the arrangement depends on the logic function
being implemented.
Implementing an AND logic using CMOS
• NMOS: Inputs are connected in series (both must be ON for output to be
LOW)
• PMOS: Inputs are connected in parallel (either input LOW will make
Implementing an OR logic using CMOS
• NMOS: Inputs are connected in parallel (either ON pulls output LOW)
• PMOS: Inputs are connected in series (both must be OFF to pull output
HIGH)
This configuration ensures that:
• The pull-up network (PMOS) conducts when output should be HIGH.
• The pull-down network (NMOS) conducts when output should be
LOW.
Logic PMOS Connection (Pull-Up NMOS Connection (Pull-Down
Function Network) Network)
AND Parallel Series
OR Series Parallel
Self-Learned Insight: Why CMOS is Used in Digital Electronics
CMOS (Complementary Metal-Oxide-Semiconductor) technology is
widely used in digital electronics because of the following key reasons:
1. Low Power Consumption
2. High Noise Immunity
3. High Packing Density
4. Scalability
5. Ease of Design Using Logic Gates
6. Balanced Speed and Power
➢ CMOS Logic Gate Transistor Count Summary
Sl. No. Logic Gate NMOS Used PMOS Used Total Transistors
1 NOT (Inverter) 1 1 2
2 Buffer 2 2 4
3 NAND (2-input) 2 2 4
4 NOR (2-input) 2 2 4
5 AND (2-input) 3 3 6
6 OR (2-input) 3 3 6
7 XOR (2-input) 5 5 10
8 XNOR (2-input) 4 4 8
Number System
In digital electronics, a number system is a way to represent numbers using digits
and a base (or radix). Different number systems are used based on the application,
such as computation, communication, or hardware design. In digital electronics,
understanding different number systems is essential because computers and
digital circuits use various bases to store and process data.
Common Number Systems are:
System Base Digits Used Usage
Binary 2 0, 1 Digital circuits and computers
Octal 8 0 to 7 Compact form of binary for humans
Decimal 10 0 to 9 Everyday arithmetic and human interface
Memory addressing, colour codes, compact
Hexadecimal 16 0 to 9, A to F
binary
In the hexadecimal number system, which is base-16, the letters A to F
are used to represent decimal values from 10 to 15. This means that A stands for
10, B for 11, C for 12, D for 13, E for 14, and F for 15.
➢ Conversions between Binary, Octal, Decimal, and Hexadecimal
1. Binary to Decimal
Multiply each bit by 2ⁿ and add all values.
Example: Convert 1101₂ to decimal.
Calculate: (1×2³) + (1×2²) + (0×2¹) + (1×2⁰)
= 8 + 4 + 0 + 1 = 13₁₀
2. Binary to Octal
Group bits in 3 from right and convert to octal digits.
Example: Convert 101110₂ to octal.
Group bits in 3 from right: 101 110
Convert each group: 101₂ = 5₈, 110₂ = 6₈
Result: 56₈
3. Binary to Hexadecimal
Group bits in 4 from right and convert to hex digits
Example: Convert 11101010₂ to hex.
Group bits in 4 from right: 1110 1010
Convert each group: 1110₂ = E₁₆, 1010₂ = A₁₆
Result: EA₁₆
4. Octal to Binary
Convert each octal digit to a 3-bit binary group.
Example: Convert 73₈ to binary.
Convert each digit: 7 = 111₂, 3 = 011₂
Result: 111011₂
5. Octal to Decimal
Multiply each digit by 8ⁿ and add all values.
Example: Convert 73₈ to decimal.
Calculate: (7×8¹) + (3×8⁰) = 56 + 3 = 59₁₀
6. Octal to Hexadecimal
Convert octal to binary (3-bit), then binary to hex (4-bit).
Example: Convert 73₈ to hex.
Step 1: Octal to binary → 7=111, 3=011 → 111011₂
Step 2: Binary to hex → group 4 bits: 0001 1101 1 → pad zeros: 0001 1101 100
→ 1 D 4 (needs padding)
Actually, group bits correctly: 111011 → 0011 1011 → 3B₁₆
Result: 3B₁₆
7. Decimal to Binary
Divide by 2 repeatedly and read remainders in reverse.
Example: Convert 22₁₀ to binary.
22 ÷ 2 = 11 remainder 0
11 ÷ 2 = 5 remainder 1
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Read remainders bottom to top: 10110₂
Result: 10110₂
8. Decimal to Octal
Divide by 8 repeatedly and read remainders in reverse.
Example: Convert 83₁₀ to octal.
83 ÷ 8 = 10 remainder 3
10 ÷ 8 = 1 remainder 2
1 ÷ 8 = 0 remainder 1
Read bottom to top: 123₈
Result: 123₈
9. Decimal to Hexadecimal
Divide by 8 repeatedly and read remainders in reverse.
Example: Convert 254₁₀ to hex.
254 ÷ 16 = 15 remainder 14 (E)
15 ÷ 16 = 0 remainder 15 (F)
Read bottom to top: FE₁₆
Result: FE₁₆
10. Hexadecimal to Binary
Convert each hex digit to a 4-bit binary group.
Example: Convert 9B₁₆ to binary.
9 = 1001₂ B = 1011₂
Result: 10011011₂
11. Hexadecimal to Octal
Convert hex to binary (4-bit), then binary to octal (3-bit).
Example: Convert 9B₁₆ to octal.
Step 1: Hex to binary → 9 = 1001, B = 1011 → 10011011₂
Step 2: Binary to octal → group 3 bits: 010 011 011 → 2 3 3
Result: 233₈
12. Hexadecimal to Decimal
Multiply each digit by 16ⁿ and add all values.
Example: Convert 9B₁₆ to decimal.
(9×16¹) + (11×16⁰) = 144 + 11 = 155₁₀
Handling Numbers with Points in Different Conversions
We divide into two parts:
• Whole number part → convert as usual.
• Fractional part (after decimal point) → converted differently (see below).
1. Decimal to Binary (with point)
Steps:
• Convert whole part by repeated division by 2.
• Convert fraction part by repeated multiplication by 2.
Example: Convert 10.625₁₀ to binary
• Whole part: 10 → 1010
• Fraction part:
▪ 0.625 × 2 = 1.25 → 1
▪ 0.25 × 2 = 0.5 → 0
▪ 0.5 × 2 = 1.0 → 1
Result: 0.101
Final Binary = 1010.101₂
2. Binary to Decimal (with point)
Steps:
• Convert whole part normally.
• Convert fractional part using 2⁻¹, 2⁻², ...
Example: Convert 101.101₂ to decimal
• Whole: 101 = 5
• Fraction:
▪ 1×(½) + 0×(¼) + 1×(⅛) = 0.5 + 0 + 0.125 = 0.625
Final Decimal = 5.625₁₀
3. Decimal to Octal or Hex (with point)
Use same method:
• Divide whole part normally.
• Multiply fractional part repeatedly by 8 (for octal) or 16 (for hex).
Example: Convert 17.8125₁₀ to hex
• Whole: 17 ÷ 16 → remainder 1, quotient 1 → 11₁₆
• Fraction:
▪ 0.8125 × 16 = 13.0 → D
Final Hex = 11.D₁₆
4. Binary to Hex or Octal (with point)
Same as integers:
• Group binary digits left of point and right of point
• Add leading/trailing zeros if needed.
Example: Convert 1010.101₂ to hex
• Left: 1010 = A
• Right: 101 → add 0 to make 4 bits → 1010 = A
Result = A.A₁₆
Tip for All:
• Pad zeros to match required bits:
o Octal → 3-bit
o Hex → 4-bit
➢ Addition in Different Number Systems
1 Binary Addition (Base-2)
• Only digits: 0 and 1
• Rules:
0+0=0
0+1=1
1+0=1
1 + 1 = 10 (carry 1)
1 + 1 + 1 = 11 (carry 1)
Example:
1011
+ 1101
= 11000₂
2 Octal Addition (Base-8)
• Digits: 0 to 7
• If sum ≥ 8, subtract 8 and carry 1.
Example:
745
+ 123
= 1070₈
3 Decimal Addition (Base-10)
• Normal base used daily
• Carry when sum ≥ 10
Example:
89
+ 76
= 165₁₀
4 Hexadecimal Addition (Base-16)
• Digits: 0–9 and A–F (A=10, F=15)
• If sum ≥ 16, subtract 16 and carry 1.
Example:
A9
+ 1F
= C8₁₆
(169 + 31 = 200 in decimal → C8 in hex)
➢ Subtraction in Different Number Systems
1 Binary Subtraction (Base-2)
• Only digits: 0 and 1
• Rules:
0−0=0
1−0=1
1−1=0
0 − 1 = 1 (borrow 1 from left, becomes 10 − 1 = 1)
Example:
1011
− 1001
= 0010₂
2 Octal Subtraction (Base-8)
Digits: 0 to 7 Example:
• Borrow when needed just like decimal 725
• If digit is smaller, borrow 8 from next digit − 146
= 557₈
3 Decimal Subtraction (Base-10)
• Our regular method
• Borrow when needed from higher digits
Example:
132
− 57
= 75₁₀
4 Hexadecimal Subtraction (Base-16)
• Digits: 0–9 and A–F (A=10, F=15)
• If needed, borrow 16 from the next digit
Example:
2D
− 1A
= 13₁₆
(45 − 26 = 19 in decimal = 13 in hex)
➢ Tips:
• Always convert A–F to decimal values when subtracting in hexadecimal
• Use binary as an intermediate step if needed for accuracy
• Borrowing in non-decimal bases means subtracting from the base (like 2,
8, or 16), not 10
Binary Number Representation
In digital electronics, binary numbers are used to represent all data using
only two digits: 0 and 1 (Base-2 system).
Types of Binary Number Representation:
1 Unsigned Binary
• Only positive numbers (no sign bit)
• Range for n bits: 0 to (2ⁿ – 1)
• MSB (Most Significant Bit) is always part of the value
Example (4 bits): 0000 to 1111 → 0 to 15
2 Signed Binary Representations (include negative values)
a) Sign-Magnitude
• MSB is sign bit (0 = +, 1 = –)
• Range: – (2ⁿ⁻¹ – 1) to +(2ⁿ⁻¹ – 1)
Example (4 bits): –7 to +7 (Note: –0 exists, so one value is wasted)
b) 1’s Complement
• Negative number = invert all bits
• Range (n bits): – (2ⁿ⁻¹ – 1) to +(2ⁿ⁻¹ – 1)
Example (4 bits): –7 to +7 (includes both +0 and –0)
c) 2’s Complement (Most Common)
• Negative = 1’s complement + 1
• No –0, so range increases by 1 on negative side
• Range: –2ⁿ⁻¹ to +(2ⁿ⁻¹ – 1)
Example (4 bits): –8 to +7
Type Binary Decimal
Unsigned 0101 +5
Sign-Magnitude 1101 -5
1’s Complement 1010 -5
2’s Complement 1011 -5
Complements
Complements are alternative representations of numbers used mainly to
simplify subtraction operations and to represent negative numbers in digital
systems.
Let the base (radix) of a number system be r, and the number have n digits.
1. (r–1)’s Complement (Diminished Radix Complement)
Formula: (rⁿ)₁₀ – N – 1 or Subtract each digit from (r – 1)
Where:
• r = base of given number
• n = number of digits
• N is the original number
2. r’s Complement (Radix Complement)
Formula: (rⁿ)₁₀ – N or (r–1)’s Complement + 1
System (r−1)’s Complement r’s Complement
Binary (2) 1’s → Flip bits 2’s → 1’s comp + 1
Decimal (10) 9’s → 9 − digit 10’s → 9’s comp + 1
Octal (8) 7’s → 7 − digit 8’s → 7’s comp + 1
Hex (16) F’s → F − digit (in hex) 16’s → F’s comp + 1
➢ Representation of Complements with Examples
1's Complement
Definition: Flip all the bits (0 → 1 and 1 → 0)
Example 1: Original: 1010
1’s Complement: 0101
Example 2: Original: 1100
1’s Complement: 0011
2's Complement
Definition: 1's complement + 1 (used to represent negative numbers)
Example 1: Original: 1010
Step 1: 1’s Complement = 0101
Step 2: Add 1 → 0101 + 1 = 0110
2’s Complement: 0110
Example 2: Original: 1100
Step 1: 1’s Complement = 0011
Step 2: Add 1 → 0011 + 1 = 0100
2’s Complement: 0100
7’s Complement
Definition: Subtract each digit from 7 (i.e., 7 – digit)
Example 1: Original: 136₈
→7–1=6
→7–3=4
→7–6=1
7’s Complement = 641₈
Example 2: Original: 425₈
→7–4=3
→7–2=5
→7–5=2
7’s Complement = 352₈
8’s Complement
Definition: Add 1 to the 7’s complement.
Example 1: 7’s Complement of 425₈ = 352₈
→ 352 + 1 = 353₈
8’s Complement = 353₈
Example 2: 7’s Complement of 136₈ = 641₈
→ 641 + 1 = 642₈
8’s Complement = 642₈
9’s Complement
Definition: Subtract each digit from 9
Example 1: Original: 425
→9–4=5
→9–2=7
→9–5=4
9’s Complement = 574
Example 2: Original: 136
→9–1=8
→9–3=6
→9–6=3
9’s Complement = 863
10’s Complement
Definition: Add 1 to the 9’s complement.
Example 1: 9’s Complement of 425 = 574
→ 574 + 1 = 575
10’s Complement = 575
Example 2: 9’s Complement of 136 = 863
→ 863 + 1 = 864
10’s Complement = 864
15’s Complement
Definition: Subtract each digit from F (15 decimal).
Example 1: Original: 2A₁₆
→F – 2 = D
→F – A (10) = 5
15’s Complement = D5₁₆
Example 2: Original: 3C7₁₆
→F – 3 = C
→F – C (12) = 3
→F–7=8
15’s Complement = C38₁₆
16’s Complement
Definition: Add 1 to the 15’s complement.
Example 1: 15’s Complement of 2A₁₆ = D5₁₆
→D5 + 1 = D6₁₆
16’s Complement = D6₁₆
Example 2: 15’s Complement of 3C7₁₆ = C38₁₆
→C38 + 1 = C39₁₆
16’s Complement = C39₁₆
➢ Subtraction Using Complements
1. Subtraction Using (r–1)’s Complement
In binary, (r–1)’s complement is 1’s complement, where each bit is flipped (0 →
1 and 1 → 0).
Steps: Let’s perform A – B
1. Find the 1’s complement of B.
2. Add it to A.
3. If carry is generated, add the carry to the result (end-around carry).
4. If no carry, the result is negative — take 1’s complement again and add a
minus sign.
❖ For 1’s Complement for Binary
Example 1: A > B (Carry is Generated)
A = 6 (0110), B = 3 (0011)
We want to compute: A – B = 6 – 3
Step 1: 1’s complement of B (0011) → 1100
Step 2: Add A (0110) + 1’s complement of B (1100):
0110
+ 1100
10010 → 5-bit result
Step 3: Carry is generated (leftmost bit = 1), so add carry (1) to LSB:
0010 (ignore leftmost 1)
+ 1
0011 → Decimal = 3
Example 2: A < B (No Carry — Result is Negative)
A = 3 (0011), B = 6 (0110)
We want to compute: A – B = 3 – 6
Step 1: 1’s complement of B (0110) → 1001
Step 2: Add A (0011) + 1’s complement of B (1001):
0011
+ 1001
1100
Step 3: No carry is generated → So result is negative
To find the magnitude:
Take 1’s complement of result (1100): Flip bits: 0011
So, magnitude = 3
❖ For 7’s Complement for Octal
Example: A = 341, B = 402 (in octal)
We want to perform A – B = 341 – 402
Step 1: Find 7’s complement of B (402)
Subtract each digit from 7:
7-4=3
7-0=7
7-2=5
→ 7's complement of 402 = 375
Step 2: Add A + 7’s complement of B
341
+ 375
736
Step 3: No carry (since result < 777)
→ So, result is negative
Step 4: Take 7’s complement of result (736)
7–7=0
7–3=4
7–6=1
→ Final Answer = –041 (octal)
❖ For 9’s Complement for Decimal
Example: A = 346, B = 587 (in decimal)
We want to perform: 346 – 587
Step 1: Find 9's complement of B (587)
Subtract each digit from 9:
9–5=4
9–8=1
9–7=2
→ 9’s complement of 587 = 412
Step 2: Add A + 9’s complement of B → 346
+ 412
758
Step 3: No carry generated (Result < 999)
→ So, the result is negative
Step 4: Take 9’s complement of result (758)
9–7=2
9–5=4
9–8=1
→ Final Answer: –241
❖ For 15’s Complement for Hexadecimal
To find the 15's complement of a hexadecimal number, subtract each digit from
F (15).
Example: A = 2A (hex), B = 7C (hex)
We want to perform: 2A – 7C
Step 1: Find 15's complement of B (7C)
Subtract each digit from F: F – 7 = 8
F – C = F – 12 = 3
→ 15’s complement of 7C = 83
Step 2: Add A + 15’s complement of B
2A
+ 83
AD
(AD = 173 in decimal)
Step 3: Since result < FF → No carry → Result is negative
Step 4: Take 15's complement of AD
F–A=5
F–D=2
→ 15’s complement of AD = 52
2. Subtraction Using r’s Complement (Specifically: 2’s
Complement for Binary)
In binary, the r’s complement is the 2’s complement, where:
• First, take the 1’s complement (flip all bits)
• Then, add 1 to get the 2’s complement.
Steps to Perform A – B Using 2’s Complement:
1. Find the 2’s complement of B (i.e., flip all bits and add 1).
2. Add it to A (binary addition).
3. If a carry is generated, discard it.
4. If no carry, the result is negative and already in 2’s complement form.
❖ For 2’s Complement for Binary
Example 1: A > B (Carry Generated)
A = 6 (0110), B = 3 (0011)
We want to compute: 6 – 3
Step 1: 2’s complement of B = 1’s complement of 0011 = 1100 → Add 1 = 1101
Step 2: Add A + 2’s complement of B:
0110
+ 1101
10011
Step 3: Carry is generated (leftmost bit = 1), so discard it
Result: 0011 → 3
Example 2: A < B (No Carry – Negative Result)
A = 3 (0011), B = 6 (0110)
We want to compute: 3 – 6
Step 1: 2’s complement of B =1’s complement of 0110 = 1001→ Add 1 = 1010
Step 2: Add A + 2’s complement of B:
0011
+ 1010
1101
Step 3: No carry → result is negative and already in 2’s complement
To find the magnitude:
Take 2’s complement of 1101 →1’s complement = 0010 +1 = 0011
So, magnitude = 3
❖ For 8’s Complement for Octal
Example: A = 341, B = 402 (in octal)
Step 1: Find 8’s complement of B = 402
• First find 7’s complement = 375
• Then add 1: 375 + 1 = 376
Step 2: Add A + 8’s complement of B
341
+ 376
737
Step 3: No carry (still less than 1000 octal)
→ Result is negative in 8’s complement
Step 4: To find magnitude – take 8’s complement of 737
Step 1: 7’s complement of 737 =7 – 7 = 0, 7 – 3 = 4, 7 – 7 = 0 → 040
Add 1 → 041
Final Answer: –041 (octal)
❖ For 10’s Complement for Decimal
Example: A = 346, B = 587 (in decimal)
We want: 346 – 587
Step 1: Find 10’s complement of B (587)
→ First get 9’s complement = 412 → Then add 1: 412 + 1 = 413
Step 2: Add A + 10’s complement of B
346
+ 413
759
Step 3: No carry (Result < 1000)
→ Result is negative in 10’s complement form
Step 4: Take 10’s complement of 759
First, find 9’s complement:
9–7=2
9–5=4
9 – 9 = 0 → 240 + 1 = 241
Final Answer: –241
❖ For 16’s Complement for Hexadecimal
16’s complement = 15’s complement + 1
Example: A = 2A (hex), B = 7C (hex)
Step 1: Take 15’s complement of 7C = 83→ Add 1 → 83 + 1 = 84 (this is 16’s
complement)
Step 2: Add A + 16’s complement of B
2A
+ 84
AE (AE = 174 in decimal)
Step 3: No carry → result is negative
Step 4: Take 16's complement of AE
→ 15’s complement of AE = 51
→ Add 1 → 52
Final Answer: –52 (hex)