Digital Design Laboratory

Johnson Counter

(Use of Flip-Flops and design of counters)


Purpose:

The purpose of this lab is:


Problem Statement:

The goal is to design a Johnson counter that can count up or down, depending on the setting of a control input UP/DOWN. The block diagram of the counter is given in Figure 1.
 
 


Figure 1: Symbol of the 3-bit up/down Johnson counter.

The counter has an asynchronous reset (or clear) input which brings the outputs to 0 as soon as the RESET signal is asserted. The counter counts at the negative edge of the clock. When the UP input is high, the counter counts in one direction and when UP is low, it counts in the other direction, as shown in the state diagram of Figure 2.

Figure 2: State diagram of the UP/DOWN Johnson counter.


Pre-lab Assignment:
  1. Review the design procedure in your class notes or the textbook for counters.
  2. Use the standard counter design process to design this up/down Johnson counter with D flip-flops (do not use the state editor).  Notice that the asynchronous reset will bring the counter in a known and allowed state (000).
    1. Give the State transistion table (hint: consider the UP signal as an input together with the three present states). You should make use of don't cares (for unused states) in order to reduce the amount of logic required for the flip-flop inputs.
    2. Draw the K-maps for the three D inputs: DA, DB and DC.
    3. Give the logic expression and logic diagram of each function DA, DB and DC. Can you see similarities between these three functions?
    4. This state machine will have unused states.  In case you get stuck into one of these unused states,e.g. state (010), what will the  the next two states be, assuming that you do not use the reset switch to get back into the starting state: (010) -> (???) -> (???). Is this a self-starting counter?
    5. Based on the similarities (or symmetries) of the three functions DA, DB and DC,  can you extend the design to more bits? When drawing the schematic of the counter, you will easily see how to extend the counter from a 3-bit to a 4-bit counter. Give the expressions of  DA, DB, DC, and  DD for a 4-bit Johnson counter. Also draw the schematic in your notebook.
  3. On-line pre-lab Questions. Submit your answers to the above questions online using Blackboard.
  4. Sketch the full diagram of the 4-bit Johnson counter (logic and FF) using negative edge triggered D flip-flops with an asynchronous reset. Assume that the D flip-flops are available as building blocks (you do not have to design your own flip-flop).
  5. Divide by 8 circuit. You will display the state of the counter the  7-segment LEDs. In order to be able to read the displayed  numbers  you need to slow down the clock signal by a factor of 8. Design a divide by 8 circuit, using D or T (made from D flip-flops) and write it down in your lab notebook.

In-lab assignment:

A. Parts and Equipment:

B. Experiments

The goal is to enter the schematic of the Johnson counter, to simulate, implement and test the counter on the FPGA demoboard. Figure 3 schematically shows the test set up on the demoboard.


(a)

b.                                                              c.                                                d.
Figure 3: Schematic test set up of the counter using the  (a) Digilab board, (b) FPGA demoboard,  (c) XS40 or (d)  the CPLD XS95 board

  1. Create a new project in the Schematic Flow mode and name it MYCOUNT. Place this project in your folder  (C:\users\your_name) on the C:drive .
  2. Create the schematic of the Johnson counter according to the design of the pre-lab. Keep the schematic as simple as possible. If you can use a macro for the logic for the D inputs, you should do so to keep the schematic from being cluttered with too many gates and wires.
  3. Functional simulation of the Johnson counter. Check that the counter works properly.
  4. Implement your design on one of  the FPGA boards.
  5. Configure your design into the FPGA or CPLD.
  6. Test your design by observing the LEDs. Have the lab instructor check it out.



Hand-in

You must hand in a lab report that contains the following:

The lab report is an important part of the laboratory. Write it carefully, be clear and well organized. It is the only way to convey that you did a great job in the lab. It is preferred (but not necessary) that you type the lab report.


References:
 
  1. M. Mano and C. Kime, "Logic and Computer Design Fundamentals", 2nd edition, Prentice Hall, Upper Saddle River, 2001.
  2. R. Katz, "Contemporary Logic Design", Benjamin/Cummings Publ., Reading, MA, 1994.
  3. J. F. Wakerly, "Digital Design," 3rd Edition, Prentice Hall, Upper Saddle River, NJ, 2000.
  4. A. Dewey, "Analysis and Design of Digital Systems with VHDL," PWS Publishing Company, Boston, 1997.



Go to the Xilinx Foundation Tutorial

Copyright 2000,  Jan Van der Spiegel; Created October 31, 1997; Updated October 25, 2001.