Uploaded by beatrice

PracticeProblemsTutorial03

advertisement
CS 230 Spring 2023
Practice Problems Tutorial 03 Solutions
Topics: Boolean Algebra and Circuits
1. Consider the following circuit:
(a) Write a Boolean expression that exactly represents this circuit. The number of
Boolean operators in the expression must match the number of gates in the
diagram.
(b) Draw a truth table for this circuit.
Solution:
(a) (A ∧ B) ↓ ¬(B ⊕ ¬C)
(b)
A B C Result
0 0 0
1
0 0 1
0
0 1 0
0
0 1 1
1
1 0 0
1
1 0 1
0
1 1 0
0
1 1 1
0
2. These questions are related to designing your own circuits.
(a) A 3-input NAND gate has the same basic logic as a 2-input NAND gate.
The output for the gate is 1, when at least one input is 0.
The output for the gate is 0, when all of the inputs are 1.
Draw a truth table for a 3-input NAND gate.
(b) Using a few gates as possible, design and draw a circuit for a 3-input NAND using
only single input and/or 2-input logic gates.
(c) Generally, a multiple-input XOR gate will output 1 when it has an an odd number
of 1s as input, and will output 0 otherwise.
Draw a truth table for a 3-input XOR gate.
CS 230 Spring 2023
Practice Problems Tutorial 03 Solutions
(d) Write a Boolean expression representing a 3-input XOR gate that includes only
∧ , ∨ , and ¬.
Solution:
(a)
A B C Result
0 0 0
1
0 0 1
1
0 1 0
1
0 1 1
1
1 0 0
1
1 0 1
1
1 1 0
1
1 1 1
0
(b) This truth table represents a gate which is the opposite of a 3-input AND gate.
An equivalent Boolean expression would be ¬(A ∧ B ∧ C). Using
associativity, we can rewrite this as ¬((A ∧ B) ∧ C), and draw a circuit with
three logic gates as shown below:
(c)
X
0
0
0
0
1
1
1
1
(d) Here
(¬X
Y Z Result
0 0
0
0 1
1
1 0
1
1 1
0
0 0
1
0 1
0
1 0
0
1 1
1
is one solution:
∧ ¬Y ∧ Z) ∨ (¬X ∧ Y ∧ ¬Z) ∨ (X ∧ ¬Y ∧ ¬Z) ∨ (X ∧ Y ∧ Z)
Download