Homework 2: Circuitous Circuits

Homework is important practice for you, but it’s not graded so you don’t have to submit it. This particular homework is designed to help you review combinational circuits.

Problem 1: Universal Gates

In lecture we mentioned that NAND (and NOR) gates are universal in the sense that any combinational circuit can be built exclusively out of NAND (or NOR) gates without any other gates.

For this problem, first show how you can implement the standard AND, OR, and NOT gates using only NAND gates; then show how to do the same thing using only NOR gates. So you should end up with six circuits, three consisting of only NAND gates, three consisting of only NOR gates.

You should draw these circuits and carefully verify that their truth tables agree with those of the AND, OR, and NOT gates they are supposed to replace.

Problem 2: XOR and XNOR Gates

Below you’ll find the truth tables for XOR and XNOR gates. Show how you can implement XOR and XNOR gates in terms of just AND, OR, and NOT gates.

  a  b | a XOR b     a  b | a XNOR b
 ------+---------   ------+----------
  0  0 |    0        0  0 |    1
  0  1 |    1        0  1 |    0
  1  0 |    1        1  0 |    0
  1  1 |    0        1  1 |    1

You should use the “design process” from lecture: From the truth tables above, derive a formula for the circuits in either DNF or CNF (don’t mix normal forms!). Then draw these circuits and carefully verify that their truth tables agree with those given above. Do not simplify your circuits, leave them in CNF or DNF!

Problem 3: Seven-Segment Display

Seven-segment displays can be found in a huge number of electronics applications, including on some fancy PC motherboards (where they usually indicate error codes). Everybody knows what they look like, but just in case:

Animated seven-segment display

Each of the seven display elements can be switched on and off independently through one of seven pins. The pins are labeled A to G according to the following scheme (forget the decimal point, we won’t use it):

Seven-segment display labels

Here is how the hexadecimal digits from 0 to F are usually represented on a seven-segment display:

  _       _   _       _   _   _   _   _   _       _       _   _
 | |   |  _|  _| |_| |_  |_    | |_| |_| |_| |_  |    _| |_  |_
 |_|   | |_   _|   |  _| |_|   | |_|  _| | | |_| |_  |_| |_  |

For this problem, you have to design a circuit that takes an octal digit 0-7 encoded on three lines and displays it correctly by outputting 0/1 on the pins A-G of the seven-segment display. Your circuit takes the inputs X, Y, and Z on which the digits 0-7 are supplied as follows:

 Digit | X Y Z
   0   | 0 0 0
   1   | 0 0 1
   2   | 0 1 0
   3   | 0 1 1
   4   | 1 0 0
   5   | 1 0 1
   6   | 1 1 0
   7   | 1 1 1

The outputs of your circuit are A-G connected to the seven-segment display as shown above. You should once again use the “design process” from lecture: From the truth tables (which you have to design for this problem!), derive formulas for the circuit(s) in DNF or CNF (it’s okay to mix normal forms but be sure to explain why you picked one over the other) and then draw the circuit(s). Do not simplify the circuits, leave them in CNF or DNF!

Note: If you’re really into circuits, handle 4-bit numbers as well. But this would be in addition to the circuit(s) for 3-bit numbers!

Problem 4: Arithmetic Logic Unit (ALU)

Design a 4-bit ALU that supports the operations AND, OR, NOT, and ADD on two 4-bit inputs; there is a single 4-bit result. Explain the structure of the 4-bit AND, OR, NOT, and ADD circuitry, but don’t worry about drawing it in detail. Explain how you combine everything into one ALU using multiplexers.

You will have to figure out (and should explain in detail!) how you can use the multiplexers from lecture in parallel to route 4-bit quantities around your ALU as needed.




The “written answers” for the problems above should go into a plain ASCII text file called README; make sure you explain which notation you’re using for boolean formulas (the C-type notation is recommended!); make sure to include explanatory notes that tell us how you solved the problem in question. If your “diagrams” are in ASCII as well, they can go into the README file; if your diagrams are in PDF, there should be one file for each problem, so problem1.pdf, problem2.pdf, and so on.