Sequential Logic

Preparation

Start Logisim with the following command:

$ java -jar /home/curtsinger/shared/logisim.jar

Background

For combinational logic, which is a simple mapping of logical inputs to outputs, we can talk about the truth table as the function specifying the input/output mapping. For sequential logic, the outputs become inputs. However, we can still talk about how the state maps to updated values in something we call the characteristic table, sequential logic’s analog to the truth table of combinational logic.

Other than listing the current value of an output on the left (with the inputs), and the updated/next value of the output on the right (as an output), there is no clearly identified standard for distinguishing these before/after values. We will use QQ and QnextQ_\text{next} to refer to the current and next states of an output QQ for this lab.

Helpful Tips

Some circuits can oscillate their assertion status (with regular stability, as in a clock, or wildly in other cases). We do not want our latches and flip-flops to oscillate, but Logisim sometimes has trouble dealing with the loopy connections correctly.

If you end up with all red wires you can sometimes resolve the issue by selecting the “Reset Simulation” option from the “Simulate” menu. Some errors stop the simulation, so selecting “Simulation Enabled” is occasionally necessary.

Exercise 1: S-R Latch

  1. Use Figure B.8.1 from your text to complete the characteristic table for an S-R latch. Record your answers on paper or computer.

    SS RR QQ Q\bar{Q} QnextQ_\text{next} Qnext\bar{Q}_\text{next}
    0 0 0 1
    0 0 1 0
    1 0 0 1
    1 0 1 0
    0 1 0 1
    0 1 1 0

    Note that we don’t include any rows for S=R=1S=R=1 because bad things can happen (see Section B.11 of Patterson & Hennessy) .

    In order for your characteristic table to stabilize without infinite oscillation, you must perform your “updates” to QnextQ_\text{next} and Qnext\bar{Q}_\text{next} asynchronously. For example, when calculating Qnext\bar{Q}_\text{next}, use the updated value QnextQ_\text{next} for QQ. In other words, perform only one update (either to QnextQ_\text{next} or Qnext\bar{Q}_\text{next}) at a time, and use the updated value of one to then calculate the updated value of the other.

  2. Create a Logisim project, then build an S-R latch in a subcircuit called “s-r latch”. For your latch to work (avoiding oscillations), you will need to build your circuit in this specific order:

  3. Test the various configurations of S and R to verify your characteristic table

  4. Save your Logisim project (and save frequently!)

Exercise 2: D Latch

  1. Complete the characteristic table for a D latch:

    CC DD QQ QnextQ_\text{next}
    0 0 0
    0 0 1
    0 1 0
    0 1 1
    1 0 0
    1 0 1
    1 1 0
    1 1 1

    I recommend labeling the R and S inputs of the S-R Latch component and using your table from Exercise 1.a to help you.

  2. In the same Logisim project, create a subcircuit called “d latch”. Drop your “s-r latch” subcircuit into this circuit and add the additional inputs, outputs, and wires to implement a D latch.

  3. Test the various settings of CC and DD to verify your characteristic table; you may want to consult Figure B.8.3 as well.

  4. Save!

Exercise 3: D Flip-Flop

  1. In the “main” subcircuit, build a D flip-flop with two D latches (see Figure B.8.4).

  2. Test the various configurations of CC and DD to verify your flip-flop is behaving correctly as a memory element; you may want to consult Figure B.8.5.

  3. Without using your Logisim circuit, predict what will happen if you raise DD, then raise CC, but then lower DD before lowering CC? Verify your prediction with Logisim.

Extra: Rising Edges

The D flip flop in the textbook is designed to update on a falling edge. Suppose we wanted a system that updated on a rising edge.

  1. Discuss how the D flip flop would need to change in order to update on the rising edge.

  2. Copy the falling edge D flip flop from your “main” subcircuit into a new subcircuit called “risingDFF”.

  3. Implement the changes you discussed in part a in your new subcircuit.

  4. Test the various configurations of CC and DD to verify your flip flop still behaves as a memory element, but with a rising-edge trigger.


Copyright © 2018 Charlie Curtsinger and Jerod Weinman

CC-BY-NC-SA This work is licensed under a Creative Commons Attribution NonCommercial ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.