EECS 270: Lab 2

Timing, delay and functional decomposition

See lab schedule for new dates.
Total value: 75 points

  1. Overview
  2. Digital logic circuits are constructed from electronic switches (transistors) connected by wires. The digital abstraction allows us to ignore the intrinsically analog nature of these circuits; it consists of two related simplifications of physical reality: a functional abstraction that allows us to transform continuous voltage waveforms into discrete two-valued logic waveforms, and a temporal abstraction that captures the causal relations among logic signals using appropriately-defined propagation delays. In this experiment, you will explore some of the timing aspects of logic circuits. In addition, you will learn how to make "macros" in Quartus (the hardware equivalent of functions).

  3. Preparation
  4. Design Specification
  5. There is very little to design for this lab. Instead, you will mainly study the timing behavior of the two circuits shown in Figures 1 and 2. The first is a five-input XOR gate built out of four two-input XOR gates. It has the interesting characteristic that changing any one bit results in the output changing. The second circuit represents a common digital circuit: the ripple-carry adder. Although you probably have not covered adders in lecture at this point, we will provide you with enough background to do this example.

    Figure 1: 5-input XOR

    Figure 2: 4-bit adder

    You will be creating two different projects, one with the five-input XOR, and one with the ripple-carry adder. You will then examine the propagation delay of the circuit using both a simple abstract model and then using the Quartus tools to provide a "real" model of the FPGA delay. For the 5-input XOR gate you are to use switches SW0-SW4 (in any order) as your inputs and LEDR[0] as the output.

    For the adder SW[3:0] will be "A[3:0]" (in that order), SW[7:4] will B[3:0] (again in that order) and Cin will be KEY3 (recall that the KEY inputs are active low). Your outputs will have S[3:0] mapped to LEDR[3:0] and Cout mapped to LEDG[7].

    Implementation details
    The 5-input XOR gate should be straightforward to implement. The XOR gates needed are found on the symbol tool under "primitives → logic". The ripple-carry adder requires you to learn a few more things about the Quartus tools, so we will step you through it.

    Don't forget to save the project early and often!

    Once you've finished copying the 5-input XOR design, you will need to do the following to get the 4-bit adder working:

    You will now need to edit the .qsf file for both projects to properly set-up the switches. This should be very similar to what you did in lab 1.

  6. Design Notes and Hints
  7. Deliverables
    1. Pre-Lab (30 points)
      1. Hardcopy of schematic and the .qsf files for both circuits. (8 points)
      2. For the 5-input XOR, assume that each XOR gate has a delay of 5ns. Complete the supplied timing diagram. The entries "1", "2", and "3" are to be the intermediate nodes, where "1" is the output of the first XOR (has V and W as inputs) and "2" is the next XOR output, etc. Use a straight-edge to draw your lines. (8 points)
      3. If SW[7:0]=0x3C and KEY3 is not pressed, which LEDs do you expect to see lit? Recall that KEY3 is active low. What if SW[7:0]=0x77 and KEY3 was not pressed? (4 points)
      4. For the 4-bit adder again assume each full adder has a delay of 5ns. Show what would happen to the outputs (S[3:0] and Cout) over time if the inputs of A started at hex "4" and became hex "1" at time 20ns, while B stays at hex "7" and Cin stayed 0. Draw a timing diagram showing each of the five outputs as individual wires as well as showing the hex value output on S[3:0]. Your diagram should be neat (use a straight-edge or a drawing program). (10 points)

    2. In-Lab (15 points)
      Demonstrate that your two circuits work correctly on the board. Also, show that you can perform a timing simulation of the 5-input XOR circuit. You should keep all of the inputs held at zero and have the "V" input be a clock with a 40ns period and a 50% duty cycle. On the screen you should show the output from time 0 to about 100ns.

    3. Post-lab (30 points)
      1. Prepare your lab report as described in the EECS270 Laboratory Overview handout. Make sure you complete and include all parts of the report including the Cover Sheet and the Design Documentation section. (10 points)
      2. Provide a printout of a timing simulation of the 4-bit adder. Use the same inputs that you used in the hand drawing for the pre-lab. (10 points)
      3. Answer the following questions:
        1. If each full adder in the 4-bit adder had a propagation delay of 5ns, what would be the worst-case delay before the adder output the correct answer? (3 points)
        2. If each gate in the 4-bit adder had a propagation delay of 3ns, what would be the worst-case delay before the adder output the correct answer? (3 points)
        3. For your above answer provide an example case which produces that worst-case delay (hint: you will need to say what all the inputs start as and which input(s) are changing). (4 points)