Designing a Four-Input Logic Circuit with an Equality Condition

Designing a Four-Input Logic Circuit with an Equality Condition

Verified Sources
Sep 11, 2026

This section designs a combinational logic circuit with inputs AA, BB, CC, and DD, and output YY.

The specification is:

  • Y=1Y=1 only when AA and BB are both high.
  • At the same time, CC and DD must be equal: either both low or both high.

The condition on CC and DD is an XNOR gate condition. An XNOR gate produces 11 for input pairs 0000 and 1111; its Boolean expression is CD+C‾ D‾CD+\overline{C}\,\overline{D}.

Therefore, the required circuit is:

Y=AB(CD+C‾ D‾)Y=AB(CD+\overline{C}\,\overline{D})

Equivalently:

Y=AB(C⊙D)Y=AB(C\odot D)

where ⊙\odot denotes XNOR.

The design can be understood as an AND gate combining two conditions:

  1. AA and BB are both 11.
  2. CC and DD are equal.

Footnotes

  1. 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 “AA and BB are both 1” translates directly to an AND operation:

ABAB

The phrase “CC and DD are both low or both high” describes equality between CC and DD:

(C=0,D=0) or (C=1,D=1)(C=0,D=0)\ \text{or}\ (C=1,D=1)

Using Boolean algebra, these two cases become:

  • Both low: C‾ D‾\overline{C}\,\overline{D}
  • Both high: CDCD

Combining the alternatives with OR gives:

C⊙D=CD+C‾ D‾C\odot D=CD+\overline{C}\,\overline{D}

Finally, both major conditions must hold, so they are connected with AND:

Y=AB(CD+C‾ D‾)Y=AB(CD+\overline{C}\,\overline{D})

The expanded sum-of-products form is:

Y=ABCD+ABC‾ D‾Y=ABCD+AB\overline{C}\,\overline{D}

This expression contains two valid cases:

  • A=B=C=D=1A=B=C=D=1
  • A=B=1A=B=1 and C=D=0C=D=0

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 24=162^4=16 possible input combinations for four inputs.

The output is 11 only when:

A=1,B=1,C=DA=1,\quad B=1,\quad C=D

The intermediate signal E=C⊙DE=C\odot D is useful:

E={1,C=D0,C≠DE= \begin{cases} 1,&C=D\\ 0,&C\ne D \end{cases}
AABBCCDDABABC⊙DC\odot DY=AB(C⊙D)Y=AB(C\odot D)
0000010
0001000
0010000
0011010
0100010
0101000
0110000
0111010
1000010
1001000
1010000
1011010
1100111
1101100
1110100
1111111

Thus, using standard minterm notation with AA as the most significant variable:

Y(A,B,C,D)=∑m(12,15)Y(A,B,C,D)=\sum m(12,15)

The two minterms are:

m12=ABC‾ D‾m_{12}=AB\overline{C}\,\overline{D} m15=ABCDm_{15}=ABCD

Therefore:

Y=ABC‾ D‾+ABCDY=AB\overline{C}\,\overline{D}+ABCD

Factoring ABAB gives:

Y=AB(C‾ D‾+CD)Y=AB(\overline{C}\,\overline{D}+CD)

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 ABAB.
  • One 2-input XNOR gate for C⊙DC\odot D.
  • One final 2-input AND gate.

Define intermediate signals:

X=ABX=AB Z=C⊙DZ=C\odot D

Then:

Y=XZY=XZ

or:

Y=(AB)(C⊙D)Y=(AB)(C\odot D)

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

  1. 1
    Step 1

    The requirement that A and B are both high is represented by X = AB.

  2. 2
    Step 2

    The requirement that C and D are both low or both high is represented by Z = C ⊙ D.

  3. 3
    Step 3

    Both conditions must be true simultaneously, so connect X and Z to a final AND gate: Y = XZ.

  4. 4
    Step 4

    Substituting the intermediate signals gives Y = AB(C ⊙ D).

  5. 5
    Step 5

    Replace the XNOR operation with Z = CD + C̄D̄, giving Y = AB(CD + C̄D̄).

  6. 6
    Step 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:

C⊙D=CD+C‾ D‾C\odot D=CD+\overline{C}\,\overline{D}

Required gates:

  1. NOT gate to produce C‾\overline{C}.
  2. NOT gate to produce D‾\overline{D}.
  3. AND gate to produce CDCD.
  4. AND gate to produce C‾ D‾\overline{C}\,\overline{D}.
  5. OR gate to combine the two terms.
  6. AND gate to combine the result with ABAB.

The complete expression is:

Y=AB(CD+C‾ D‾)Y=AB(CD+\overline{C}\,\overline{D})

A fully expanded implementation is:

Y=(AB)[(CD)+(C‾ D‾)]Y=(AB)\left[(CD)+(\overline{C}\,\overline{D})\right]

Y=AB(C⊙D)Y=AB(C\odot D) 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 1616 cells.

The output is 11 at minterms m12m_{12} and m15m_{15}:

Y=∑m(12,15)Y=\sum m(12,15)

Using rows ABAB and columns CDCD in Gray-code order:

AB\CDAB\backslash CD00011110
000000
010000
111010
100000

The two 11 cells are not adjacent in the K-map because the CDCD combinations 0000 and 1111 differ in both variables. Therefore, no larger grouping can combine them into a single product term.

The resulting minimal sum-of-products expression is:

Y=ABC‾ D‾+ABCDY=AB\overline{C}\,\overline{D}+ABCD

Factoring the common term ABAB:

Y=AB(C‾ D‾+CD)Y=AB(\overline{C}\,\overline{D}+CD)

The parenthetical expression is exactly the XNOR function:

C‾ D‾+CD=C⊙D\overline{C}\,\overline{D}+CD=C\odot D

Therefore:

Y=AB(C⊙D)\boxed{Y=AB(C\odot D)}

Footnotes

  1. Introduction of K-Map - Describes four-variable Karnaugh maps and their 16-cell structure. ↩

6. Verification by test cases

Test caseAABBCCDDReasonYY
Both enabling inputs low0000AB=0AB=00
One enabling input low1011AB=0AB=00
C,DC,D unequal1101XNOR output is 000
Both C,DC,D low1100Both conditions true1
Both C,DC,D high1111Both conditions true1
A,BA,B unequal0100AB=0AB=00

The circuit satisfies the specification for every possible input combination.

Design Pathway

Interpret the statement

1

Separate the requirement into an enabling condition, AB, and an equality condition, C ⊙ D."

Write the Boolean function

2

Combine the conditions with AND: Y = AB(C ⊙ D)."

Expand the equality function

3

Use C ⊙ D = CD + C̄D̄ when an XNOR gate is unavailable."

Implement the gates

4

Use two AND gates and one XNOR gate, or construct the XNOR from AND, OR, and NOT gates."

Verify

5

Confirm that Y = 1 only for 1100 and 1111."

Frequently Asked Questions

Key Concepts

1 / 5
Question · Term

What does XNOR mean?

Click to reveal
Answer · Definition

XNOR is the equality operation. It outputs 1 when both inputs are equal: 00 or 11.

Knowledge Check

Question 1 of 5
Q1Single choice

Which gate detects that C and D are either both low or both high?