Logic Circuits
1. **Implement XOR gate using NAND gates:**
The XOR output is true when inputs differ. The XOR function can be implemented using NAND gates as:
$$XOR(A,B) = NAND(NAND(A, NAND(A,B)), NAND(B, NAND(A,B)))$$
Step-by-step:
1. Compute $NAND(A,B)$.
2. Compute $NAND(A, NAND(A,B))$ and $NAND(B, NAND(A,B))$.
3. Compute $NAND$ of these two results to get XOR output.
2. **Design and implement a 1-bit comparator:**
A 1-bit comparator outputs if two 1-bit inputs are equal.
- Inputs: $A$, $B$
- Outputs:
- $E$ = 1 if $A = B$ (Equality)
- $G$ = 1 if $A > B$
- $L$ = 1 if $A < B$
Expressions:
- $E = (A ext{ AND } B) ext{ OR } (
eg A ext{ AND }
eg B)$
- $G = A ext{ AND }
eg B$
- $L =
eg A ext{ AND } B$
3. **Cattle device logic system:**
i. Truth table for three feeding stations $X$, $Y$, $Z$ where output $F=1$ when two or more stations are empty (assume empty=
1):
|X|Y|Z|F|
|-|-|-|-|
|0|0|0|0|
|0|0|1|0|
|0|1|0|0|
|0|1|1|1|
|1|0|0|0|
|1|0|1|1|
|1|1|0|1|
|1|1|1|1|
ii. Unsimplified logic expression:
$$F = XYZ + XY\overline{Z} + X\overline{Y}Z + \overline{X}YZ$$
iii. Using Karnaugh map simplification (for $X$, $Y$, $Z$), grouping yields:
$$F = XY + YZ + XZ$$
iv. Logic diagram:
Three AND gates with inputs $(X,Y)$, $(Y,Z)$, and $(X,Z)$ connected to an OR gate producing $F$.
4. **Circuit equivalence check:**
Given:
- Circuit 1 output $f = (a ext{ AND } b) ext{ OR } (b ext{ AND } c) ext{ OR } c$
- Circuit 2 output $g = (a ext{ AND } b) ext{ OR } (b ext{ AND } c)$
Check if $f = g$:
- Notice $f = g + c$
Truth table for inputs $a,b,c$ and outputs $f,g$ shows $f
eq g$ when $c=1$ and $a b=0$.
Hence, the two circuits do **not** implement the same function.