Unit 4: Universal Gate Adventure

ECE120 — Basic Electronics Engineering Workshop 9 min read

I. Orientation — Boolean Logic and Universal Gates

Digital logic represents information using two discrete states, conventionally called logic 0 and logic 1. Logic gates implement Boolean operations on these states, while NAND and NOR are called universal gates because either gate type alone can be combined to realize every Boolean function.

  • Binary convention: Logic 0 commonly represents LOW and logic 1 represents HIGH; the exact voltage ranges depend on the IC family and supply voltage.
  • Boolean variables: Symbols such as (A), (B), and (Y) can take only the values 0 or 1.
  • Input–output relation: A gate’s behavior is specified by a Boolean expression and verified by a truth table containing every input combination.
  • Standard operations:
    • NOT: Complement, written (\overline{A}) or (A').
    • AND: Logical product, written (A\cdot B).
    • OR: Logical sum, written (A+B).
  • Derived operations:
    • NAND: (\overline{A\cdot B}).
    • NOR: (\overline{A+B}).
    • XOR: (A\oplus B), HIGH when the inputs differ.
    • XNOR: (\overline{A\oplus B}), HIGH when the inputs agree.
  • Positive logic assumption: Unless stated otherwise, the higher voltage level is treated as logic 1.
  • Universality principle: NAND is functionally complete, and NOR is independently functionally complete; therefore, a circuit can be built entirely from NAND gates or entirely from NOR gates.
  • Laboratory principle: Logical correctness and electrical correctness must both be checked; a valid Boolean design can fail physically because of floating inputs, wrong supply connections, excessive loading, or incorrect LED polarity.

II. Logic-Gate Implementation and Validation — From Boolean Function to Working Circuit

A. Implementation and validation of logic gates

Implementation converts a Boolean operation into a physical circuit, while validation compares the circuit’s observed output against its predicted truth table.

  • Basic gate functions: Each gate has a definite Boolean equation and input–output behavior.
TEXT
NOT:   Y = A̅
AND:   Y = A·B
OR:    Y = A + B
NAND:  Y = (A·B)̅
NOR:   Y = (A + B)̅
XOR:   Y = A ⊕ B
XNOR:  Y = (A ⊕ B)̅
  • (A) and (B): Binary inputs.
  • (Y): Binary output.
  • Overbar: Complement or inversion.
  • (\cdot): AND operation.
  • (+): OR operation.
  • (\oplus): Exclusive-OR operation.
  • Reference truth table: A two-input gate must be checked for all (2^2=4) possible input combinations.
(A) (B) AND OR NAND NOR XOR XNOR
0 0 0 0 1 1 0 1
0 1 0 1 1 0 1 0
1 0 0 1 1 0 1 0
1 1 1 1 0 0 0 1
  • Common IC examples: Standard logic ICs place several gates in one package.

    • 7400 or 74LS00: Four two-input NAND gates.
    • 7402 or 74LS02: Four two-input NOR gates.
    • 7404 or 74LS04: Six NOT gates.
    • 7408 or 74LS08: Four two-input AND gates.
    • 7432 or 74LS32: Four two-input OR gates.
    • 7486 or 74LS86: Four two-input XOR gates.
    • Pin assignments must be taken from the relevant datasheet because different devices do not share one universal pinout.
  • Circuit implementation procedure:

    1. Identify the IC: Confirm the part number, package orientation, supply pins, gate-input pins, and output pins.
    2. Connect power: Apply the datasheet-specified (V_{CC}) and ground; many classic TTL devices use (5\text{ V}).
    3. Provide inputs: Use switches or jumper wires connected to defined HIGH and LOW levels.
    4. Observe output: Connect the output to a logic probe, multimeter, oscilloscope, or an LED through a current-limiting resistor.
    5. Apply every input combination: For (n) inputs, test all (2^n) combinations.
    6. Compare results: Record the actual output and compare it row by row with the expected truth table.
  • LED current limiting: An LED must not be connected directly between an output and ground.

TEXT
R = (VS − VF) / IF
  • (R): Series resistance in ohms.
  • (V_S): Available output or supply voltage.
  • (V_F): LED forward voltage.
  • (I_F): Desired LED current in amperes.
  • For (V_S=5\text{ V}), (V_F=2\text{ V}), and (I_F=9\text{ mA}), (R\approx333\,\Omega); a standard (330\,\Omega) resistor is suitable if the gate can safely provide that current.
  • Validation criteria:

    • Functional correctness: Every measured truth-table row matches the specified Boolean operation.
    • Defined voltage levels: HIGH and LOW readings fall within the datasheet’s guaranteed ranges; they need not be exactly (5\text{ V}) and (0\text{ V}).
    • Stable output: The output does not flicker or change when inputs are held constant.
    • Repeatability: Reapplying the same inputs produces the same output.
  • Worked validation example—two-input NAND gate: A gate from a 74LS00 is powered according to its datasheet and tested with four input combinations.

    • Inputs 00, 01, and 10 must produce output 1.
    • Input 11 must produce output 0.
    • A LOW output for 01 would indicate a wiring fault, damaged IC, undefined input, or incorrect pin identification rather than NAND behavior.
  • Electrical precautions:

    • Floating inputs: Never leave inputs unconnected; use a definite HIGH or LOW connection.
    • Unused gates: Tie unused inputs to valid logic levels, but leave unused outputs unconnected.
    • Output conflict: Do not directly connect two ordinary gate outputs together because one may drive HIGH while the other drives LOW.
    • Power removal: Switch off power before changing ICs or major wiring.
    • Decoupling: A (0.1\,\mu\text{F}) ceramic capacitor near each IC’s supply pins helps suppress transient noise.

B. Applications and limitations

Logic-gate testing establishes whether a digital building block operates correctly before it is used in a larger system.

  • Applications:

    • Control circuits: AND gates enforce simultaneous conditions, such as (Y=A\cdot B).
    • Alarm circuits: OR gates activate an output when any monitored condition is true.
    • Parity and comparison: XOR detects unequal bits, while XNOR detects equality.
    • Fault isolation: Truth-table testing identifies defective gates or incorrect interconnections.
  • Limitations:

    • Propagation delay: Outputs change a finite time after inputs; cascaded gates accumulate delay.
    • Fan-out: One output can drive only a limited number of inputs.
    • Noise margin: Electrical noise can cause an input voltage to cross a logic threshold.
    • Switch bounce: Mechanical switches may generate several rapid transitions instead of one clean change.
    • Family compatibility: TTL and CMOS devices may have different voltage thresholds, current capabilities, and supply requirements.

III. Universal-Gate Design — Realization Using NAND or NOR Alone

A. Design of logic gates using universal gates

Universal-gate design replaces conventional gates with networks containing only NAND gates or only NOR gates, usually by applying Boolean identities and De Morgan’s theorems.

  • De Morgan’s theorems: These identities provide the main algebraic basis for conversion.
TEXT
(A·B)̅ = A̅ + B̅
(A + B)̅ = A̅·B̅
  • Complementing a product produces the sum of the complemented variables.
  • Complementing a sum produces the product of the complemented variables.
  1. NAND-only realization

    • NOT from NAND: Connecting both NAND inputs to (A) makes the gate an inverter.
TEXT
Y = A NAND A = (A·A)̅ = A̅
  • AND from NAND: The first NAND forms (\overline{A\cdot B}), and a second NAND used as an inverter restores (A\cdot B).
TEXT
X = A NAND B
Y = X NAND X = A·B
  • OR from NAND: Invert both inputs and then NAND them.
TEXT
Y = (A NAND A) NAND (B NAND B)
  = (A̅·B̅)̅
  = A + B
  • NOR from NAND: First construct OR, then invert its output with another NAND.
  • XOR from NAND: A standard four-NAND realization is:
TEXT
X1 = A NAND B
X2 = A NAND X1
X3 = B NAND X1
Y  = X2 NAND X3
  • The result is (Y=A\oplus B): 1 for 01 and 10, and 0 for 00 and 11.
  1. NOR-only realization

    • NOT from NOR: Connecting both NOR inputs together produces inversion.
TEXT
Y = A NOR A = (A + A)̅ = A̅
  • OR from NOR: The first NOR forms (\overline{A+B}), and the second NOR inverts it.
TEXT
X = A NOR B
Y = X NOR X = A + B
  • AND from NOR: Invert both inputs and NOR the results.
TEXT
Y = (A NOR A) NOR (B NOR B)
  = (A̅ + B̅)̅
  = A·B
  • NAND from NOR: First construct AND, then invert its output using a NOR gate.
  • XOR from NOR: Four NOR gates first form XNOR, and a fifth NOR used as an inverter produces XOR.
TEXT
X1 = A NOR B
X2 = A NOR X1
X3 = B NOR X1
X4 = X2 NOR X3
Y  = X4 NOR X4
  • Worked design example—implementing (Y=A+B) using NAND only:

    • Invert (A) with one NAND: (X_1=A\text{ NAND }A=\overline A).
    • Invert (B) with another NAND: (X_2=B\text{ NAND }B=\overline B).
    • NAND the inverted inputs: (Y=X_1\text{ NAND }X_2).
    • By De Morgan’s theorem, (Y=\overline{\overline A\cdot\overline B}=A+B).
    • The design requires three two-input NAND gates and must match the OR truth-table column for all four input combinations.
  • Design validation:

    • Algebraic check: Simplify the final expression to the required function.
    • Truth-table check: Compare outputs for every possible input combination.
    • Gate-level check: Label intermediate outputs such as (X_1) and (X_2) to locate wiring errors.
    • Hardware check: Confirm supply, grounding, input levels, output loading, and package pinout.

B. Applications and limitations

Universal-gate conversion simplifies component selection but may increase circuit size or delay.

  • Advantages:

    • Reduced IC variety: A complete circuit can be assembled using one gate type, such as the four NAND gates in a 7400.
    • Simpler inventory: Workshops need fewer different replacement components.
    • Manufacturing regularity: Repeated structures are convenient in integrated-circuit design.
    • Functional completeness: Any combinational Boolean function can be reduced to NAND-only or NOR-only form.
  • Limitations:

    • Higher gate count: An OR function requires three NAND gates instead of one OR gate.
    • Greater propagation delay: Each additional gate level contributes delay.
    • Increased power and area: More gates generally require more physical resources.
    • More wiring: Additional interconnections increase the chance of breadboard errors.
    • Optimization trade-off: NAND-only and NOR-only implementations of the same function may differ in gate count, available IC packages, and delay; the preferred design is the one meeting the practical circuit requirements.