Digital Logic ยท Unit 4
Combinational Logic Circuits
Exam-focused notes for Combinational Logic Circuits (Digital Logic, BIT103): what the TU syllabus asks and how it has actually been tested, with 10 solved past questions from this unit.
Combinational Logic Circuits in short
A combinational circuit is a circuit whose output depends only on its present inputs. It has no memory. Adders, subtractors and comparators are the basic building blocks of arithmetic units in every computer.
What this unit covers
- Half adder and full adder design
- Half subtractor and full subtractor design
- Binary parallel adder
- Magnitude comparator circuits
- Combinational circuit design methodology
Combinational circuit design methodology
2081 ยท 10 marks
Design a combinational circuit with three inputs. The output is 1 when the binary value of the input is odd.[10]
2080 ยท 10 marks
Define combinational logic circuit. Design a combinational circuit whose input is a four-bit number and output is the 1's complement of the input number.[10]
Show solved answerHide answer
Combinational Logic Circuit and 1's Complement Design
Definition of Combinational Logic Circuit (2 marks)
A combinational logic circuit is a digital circuit in which the output at any instant of time depends only on the present input values and not on any previous inputs or outputs. There is no memory element involved; the circuit has no feedback path.
Key characteristics:
- Output is a pure function of current inputs only
- No clock signal or storage elements (flip-flops) are used
- Examples: Adder, Subtractor, Multiplexer, Encoder, Decoder
General model: n input variables produce m output variables through a network of logic gates.
Design of 1's Complement Combinational Circuit (8 marks)
Step 1: Problem Statement
- Input: A 4-bit binary number: A, B, C, D (where A is MSB, D is LSB)
- Output: 1's complement of the input: W, X, Y, Z
The 1's complement of a binary number is obtained by inverting (complementing) each bit individually.
| Input Bit | Output Bit |
|---|---|
| A | W = A' |
| B | X = B' |
| C | Y = C' |
| D | Z = D' |
Step 2: Truth Table
| A | B | C | D | W (A') | X (B') | Y (C') | Z (D') |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |
| 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
Step 3: Boolean Expressions
From the truth table, the output functions are simply:
$$W = A'$$ $$X = B'$$ $$Y = C'$$ $$Z = D'$$
Each output is the complement (NOT) of the corresponding input bit.
Step 4: Logic Diagram
The circuit requires four NOT gates (inverters), one for each input bit:
A ----[NOT]---- W (A')
B ----[NOT]---- X (B')
C ----[NOT]---- Y (C')
D ----[NOT]---- Z (D')
Circuit Diagram:
+-------+
A ----->| NOT |-----> W = A'
+-------+
+-------+
B ----->| NOT |-----> X = B'
+-------+
+-------+
C ----->| NOT |-----> Y = C'
+-------+
+-------+
D ----->| NOT |-----> Z = D'
+-------+
Step 5: Verification with Example
Example: Input = 1010 (decimal 10)
| Bit | Input | Output (1's complement) |
|---|---|---|
| A | 1 | W = 0 |
| B | 0 | X = 1 |
| C | 1 | Y = 0 |
| D | 0 | Z = 1 |
Output = 0101 which is indeed the 1's complement of 1010. โ
Summary
| Feature | Description |
|---|---|
| Number of inputs | 4 (A, B, C, D) |
| Number of outputs | 4 (W, X, Y, Z) |
| Gates required | 4 NOT gates |
| Boolean functions | W=A', X=B', Y=C', Z=D' |
| Circuit type | Combinational (no memory, no feedback) |
Conclusion: The 1's complement of a 4-bit number is the simplest combinational circuit, requiring only four inverters, since each output bit is the logical complement of the corresponding input bit.
2078 ยท 10 marks
Design a combinational circuit with four inputs and one output. The output is equal to 1 when (i) all the inputs are equal to 1 or (ii) none of the inputs are equal to 1 or (iii) an odd number of inputs are equal to 1.[10]
2077 ยท 10 marks
Design a combinational circuit whose input is a four-bit number and output is 2's complement of the input number.[10]
Show solved answerHide answer
Design of Combinational Circuit for 2's Complement of a 4-bit Number
Concept
The 2's complement of a binary number is obtained by:
- Taking the 1's complement (inverting all bits), then
- Adding 1 to the result
For a 4-bit input A = AโAโAโAโ, the output is S = SโSโSโSโ
Truth Table
The 2's complement of N is: S = 2โด - N = 16 - N
| Aโ | Aโ | Aโ | Aโ | Sโ | Sโ | Sโ | Sโ |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 |
| 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 |
| 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |
| 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
Logical Design Approach
The copy-and-invert rule
There is a well-known pattern for the 2's complement:
Copy all bits from the right up to and including the first 1, then invert every bit above it.
The rule follows from the definition. Complementing every bit gives $\overline{A_i}$, and adding 1 to that propagates a carry only while the complemented bits are 1, that is only while the original bits are 0. So with $B_i = \overline{A_i}$ and an initial carry $C_0 = 1$:
$$S_i = B_i \oplus C_i = \overline{A_i} \oplus C_i$$
$$C_{i+1} = B_i \cdot C_i = \overline{A_i} \cdot C_i$$
The complement must appear in BOTH equations. Using $A_i$ rather than $\overline{A_i}$ builds an incrementer that computes $A + 1$, not the 2's complement.
Boolean Expressions
Carry Equations:
$$C_0 = 1$$
$$C_1 = \overline{A_0} \cdot C_0 = \overline{A_0}$$
$$C_2 = \overline{A_1} \cdot C_1 = \overline{A_1} \cdot \overline{A_0} = \overline{A_1 + A_0}$$
$$C_3 = \overline{A_2} \cdot C_2 = \overline{A_2 + A_1 + A_0}$$
Output Equations:
Since $\overline{x} \oplus \overline{y} = x \oplus y$, each output simplifies neatly:
$$\boxed{S_0 = \overline{A_0} \oplus 1 = A_0}$$
$$\boxed{S_1 = \overline{A_1} \oplus \overline{A_0} = A_1 \oplus A_0}$$
$$\boxed{S_2 = A_2 \oplus (A_1 + A_0)}$$
$$\boxed{S_3 = A_3 \oplus (A_2 + A_1 + A_0)}$$
Read together these are exactly the copy-and-invert rule: $S_0$ is a plain copy of $A_0$, and each higher bit is inverted precisely when some lower bit is 1, which is when the first 1 has already been passed.
Circuit Diagram
A0 โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ S0 (direct connection)
A1 โโโ
XOR โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ S1
A0 โโโ
A1 โโโ
OR โโ P1 = A1 + A0 โโโ
A0 โโโ XOR โโโโโโโโโโโโโโโโโโโโโ S2
A2 โโโโโโโโโโโโโโโโโโโโโโโโ
A2 โโโ
OR โโ P2 = A2 + P1 โโโ
P1 โโโ XOR โโโโโโโโโโโโโโโโโโโโโ S3
A3 โโโโโโโโโโโโโโโโโโโโโโโโ
Gates required: two OR gates (the second reuses the output of the first) and three XOR gates. $S_0$ needs no gate at all, so seven gate inputs in total realise the whole circuit.
Verification
Take A = 0110 (decimal 6). Then $A_0 = 0$, $A_1 = 1$, $A_2 = 1$, $A_3 = 0$, so
$$S_0 = A_0 = 0$$
$$S_1 = A_1 \oplus A_0 = 1 \oplus 0 = 1$$
$$S_2 = A_2 \oplus (A_1 + A_0) = 1 \oplus 1 = 0$$
$$S_3 = A_3 \oplus (A_2 + A_1 + A_0) = 0 \oplus 1 = 1$$
The output is S = 1010 (decimal 10), and $16 - 6 = 10$, which agrees with the truth table row for 0110.
Checking the two extremes as well: for $A = 0000$ every OR term is 0 and every output is 0, which is correct because the 2's complement of zero is zero; for $A = 1111$ the outputs are $1, 0, 0, 0$ read from $S_0$, giving $S = 0001$, and $16 - 15 = 1$.
Conclusion
The 2's complement circuit does not need a full adder chain. Because the carry out of the increment propagates only while the complemented bits are 1, each output reduces to $S_i = \overline{A_i} \oplus C_i$ with $C_{i+1} = \overline{A_i} \cdot C_i$ and $C_0 = 1$, which flattens to a copy of $A_0$ and an XOR of each higher bit with the OR of all bits below it. Two OR gates and three XOR gates are enough.
Magnitude comparator circuits
2081 ยท 10 marks
Define magnitude comparator?Design a 4-bit magnitude comparator circuit.[2+8]
Show solved answerHide answer
Magnitude Comparator
Definition (2 marks)
A magnitude comparator is a combinational logic circuit that compares two binary numbers and determines their relative magnitudes. Given two n-bit numbers A and B, the comparator produces three output signals:
- A > B (output is HIGH when A is greater than B)
- A = B (output is HIGH when A equals B)
- A < B (output is HIGH when A is less than B)
Design of 4-bit Magnitude Comparator (8 marks)
Given
Two 4-bit numbers:
- A = AโAโAโAโ
- B = BโBโBโBโ
Step 1: Basic Bit Comparison
For each bit position i, define:
| Condition | Expression |
|---|---|
| Aแตข = Bแตข | xแตข = AแตขBแตข + ฤแตข Bฬแตข (XNOR) |
| Aแตข > Bแตข | AแตขBฬแตข |
| Aแตข < Bแตข | ฤแตขBแตข |
So define equality bits:
xโ = AโBโ + ฤโBฬโ
xโ = AโBโ + ฤโBฬโ
xโ = AโBโ + ฤโBฬโ
xโ = AโBโ + ฤโBฬโ
Step 2: Derive Output Expressions
Equality Output: (A = B)
All bit pairs must be equal:
(A = B) = xโ ยท xโ ยท xโ ยท xโ
Greater Than Output: (A > B)
A > B if the most significant differing bit of A is 1 and B is 0:
(A > B) = AโBฬโ
+ xโยทAโBฬโ
+ xโยทxโยทAโBฬโ
+ xโยทxโยทxโยทAโBฬโ
Less Than Output: (A < B)
A < B if the most significant differing bit of B is 1 and A is 0:
(A < B) = ฤโBโ
+ xโยทฤโBโ
+ xโยทxโยทฤโBโ
+ xโยทxโยทxโยทฤโBโ
Note: Alternatively, (A < B) = NOT(A > B) + NOT(A = B), i.e., (A < B) = (A > B)' ยท (A = B)'
Step 3: Logic Circuit Block Diagram
Aโ,Bโ โโโบ [XNOR]โโโบ xโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ|
Aโ,Bโ โโโบ [XNOR]โโโบ xโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ| AND โโโบ (A=B)
Aโ,Bโ โโโบ [XNOR]โโโบ xโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ|
Aโ,Bโ โโโบ [XNOR]โโโบ xโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ|
For (A > B):
AโBฬโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ|
xโยทAโBฬโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ| OR โโโบ (A>B)
xโยทxโยทAโBฬโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ|
xโยทxโยทxโยทAโBฬโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ|
For (A < B):
ฤโBโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ|
xโยทฤโBโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ| OR โโโบ (A<B)
xโยทxโยทฤโBโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ|
xโยทxโยทxโยทฤโBโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ|
Step 4: Verification Example
Let A = 1010 (10) and B = 0110 (6):
| Bit | A | B | xแตข |
|---|---|---|---|
| 3 | 1 | 0 | 0 |
| 2 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 |
| 0 | 0 | 0 | 1 |
- (A = B) = xโยทxโยทxโยทxโ = 0ยท0ยท1ยท1 = 0 โ
- (A > B) = AโBฬโ = 1ยท1 = 1 โ (since MSB of A is 1, MSB of B is 0)
- (A < B) = ฤโBโ = 0ยท0 = 0 โ
2079 ยท 5 marks
What is magnitude comparator? Design 2-bit magnitude comparator. [5]
Half subtractor and full subtractor design
2079 ยท 5 marks
Define Half-subtractor with truth table and logic diagram. [5]
2078 ยท 5 marks
Define Half-subtractor with truth table and logic diagram. [5]
2077 ยท 5 marks
Implement a full subtractor with two half subtractors and one OR Gate. [5]
Binary parallel adder
2078 ยท 5 marks
Write short notes on Binary parallel adder Write short notes on Jonson counter. [2.5+2.5]
Make Unit 4 stick
Practice BIT103 with flashcards & quizzes