Designing a Four-Input Logic Circuit with an Equality Condition
This section designs a combinational logic circuit with inputs , , , and , and output .
The specification is:
- only when and are both high.
- At the same time, and must be equal: either both low or both high.
The condition on and is an XNOR gate condition. An XNOR gate produces for input pairs and ; its Boolean expression is .
Therefore, the required circuit is:
Equivalently:
where denotes XNOR.
The design can be understood as an AND gate combining two conditions:
- and are both .
- and are equal.
Footnotes
-
XNOR gate - Wikipedia - Defines XNOR as logical equivalence and gives its truth table and Boolean forms. ↩
Logic Gates and XNOR Operation
1. Translating the specification into Boolean logic
The phrase “ and are both 1” translates directly to an AND operation:
The phrase “ and are both low or both high” describes equality between and :
Using Boolean algebra, these two cases become:
- Both low:
- Both high:
Combining the alternatives with OR gives:
Finally, both major conditions must hold, so they are connected with AND:
The expanded sum-of-products form is:
This expression contains two valid cases:
- and
Recognize equality conditions
Whenever two binary inputs must be either both 0 or both 1, use an XNOR operation: C ⊙ D = CD + C̄D̄.
2. Truth-table derivation
A truth table contains possible input combinations for four inputs.
The output is only when:
The intermediate signal is useful:
| 0 | 0 | 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 0 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Thus, using standard minterm notation with as the most significant variable:
The two minterms are:
Therefore:
Factoring gives:
Output-1 Input Combinations
Only two of the sixteen possible input combinations produce Y = 1.
3. Circuit implementation using an XNOR gate
The most direct implementation uses:
- One 2-input AND gate for .
- One 2-input XNOR gate for .
- One final 2-input AND gate.
Define intermediate signals:
Then:
or:
Gate-level structure
This is the preferred design because it maps directly to the verbal specification and uses the XNOR gate for the equality condition.
Design the Logic Circuit
- 1Step 1
The requirement that A and B are both high is represented by X = AB.
- 2Step 2
The requirement that C and D are both low or both high is represented by Z = C ⊙ D.
- 3Step 3
Both conditions must be true simultaneously, so connect X and Z to a final AND gate: Y = XZ.
- 4Step 4
Substituting the intermediate signals gives Y = AB(C ⊙ D).
- 5Step 5
Replace the XNOR operation with Z = CD + C̄D̄, giving Y = AB(CD + C̄D̄).
- 6Step 6
Check that the only output-1 rows are 1100 and 1111.
4. Implementation using only AND, OR, and NOT gates
If an XNOR gate is unavailable, construct it from basic gates.
The XNOR expression is:
Required gates:
- NOT gate to produce .
- NOT gate to produce .
- AND gate to produce .
- AND gate to produce .
- OR gate to combine the two terms.
- AND gate to combine the result with .
The complete expression is:
A fully expanded implementation is:
Use one AND gate, one XNOR gate, and one final AND gate.
Do not use XOR
An XOR gate outputs 1 when C and D are different. The problem requires C and D to be equal, so the correct gate is XNOR, not XOR.
5. Karnaugh-map verification
A Karnaugh map for four variables contains cells.
The output is at minterms and :
Using rows and columns in Gray-code order:
| 00 | 01 | 11 | 10 | |
|---|---|---|---|---|
| 00 | 0 | 0 | 0 | 0 |
| 01 | 0 | 0 | 0 | 0 |
| 11 | 1 | 0 | 1 | 0 |
| 10 | 0 | 0 | 0 | 0 |
The two cells are not adjacent in the K-map because the combinations and differ in both variables. Therefore, no larger grouping can combine them into a single product term.
The resulting minimal sum-of-products expression is:
Factoring the common term :
The parenthetical expression is exactly the XNOR function:
Therefore:
Footnotes
-
Introduction of K-Map - Describes four-variable Karnaugh maps and their 16-cell structure. ↩
6. Verification by test cases
| Test case | Reason | |||||
|---|---|---|---|---|---|---|
| Both enabling inputs low | 0 | 0 | 0 | 0 | 0 | |
| One enabling input low | 1 | 0 | 1 | 1 | 0 | |
| unequal | 1 | 1 | 0 | 1 | XNOR output is | 0 |
| Both low | 1 | 1 | 0 | 0 | Both conditions true | 1 |
| Both high | 1 | 1 | 1 | 1 | Both conditions true | 1 |
| unequal | 0 | 1 | 0 | 0 | 0 |
The circuit satisfies the specification for every possible input combination.
Design Pathway
Interpret the statement
1Separate the requirement into an enabling condition, AB, and an equality condition, C ⊙ D."
Write the Boolean function
2Combine the conditions with AND: Y = AB(C ⊙ D)."
Expand the equality function
3Use C ⊙ D = CD + C̄D̄ when an XNOR gate is unavailable."
Implement the gates
4Use two AND gates and one XNOR gate, or construct the XNOR from AND, OR, and NOT gates."
Verify
5Confirm that Y = 1 only for 1100 and 1111."
Frequently Asked Questions
Key Concepts
Knowledge Check
Which gate detects that C and D are either both low or both high?
Explore Related Topics
Various Addressing Modes of 8051 Microcontroller
The 8051 microcontroller provides multiple addressing modes that define how an instruction identifies the location or value of its operand.
- Immediate (
#data) – constant value encoded in the instruction, used for loading fixed numbers. - Register (
Rn) – operand resides in CPU registers R0‑R7 (or A/B), giving the shortest and fastest code. - Direct (
addr) – 8‑bit address is part of the opcode, accessing internal RAM or SFRs directly. - Register indirect (
@R0,@R1,@DPTR) – a register holds the operand’s address, enabling pointer‑like traversal of memory. - Indexed (
@A+DPTRor@A+PC) – adds the accumulator to DPTR or PC for table look‑ups in code memory; branch modes (relative, absolute, long) extend this concept for short, page‑limited, and full‑range jumps.
Proving That a Grammar Is LL(1) but Not SLR(1)
Designing a Turing Machine for the 2’s Complement of a Binary String