Some sequential circuit problems

I strongly recommend against looking at the answers for the problems below until you have attempted the problems. (That's why I put the answers on separate web pages.)


1. Design a three-bit "counter" which counts 0, 3, 6, 1, 4, 7, 2, 5, 0, 3, ... .

(Note: This can be multiple problems, with different design constraints. E.g. use D flip-flops (probably most obvious), use JK flip-flops with both inputs the same, or use SR flip-flops.)

sample solution


2. Design a three-bit "counter" which counts 0, 1, 2, 4, 5, 7, 0, ... .

(Also can be considered to be several different problems.)

sample solution


3. To turn any counter into a "count-down" counter (i.e. a two-bit "count-down" counter will count 11, 10, 01, 00, 11, ...), you can XOR each of the output bits with 1, thus inverting them.

XORing with 0, of course, doesn't change the output.

Draw a two-bit counter with inputs "up" and "down" (in addition to the common clock). A third flip-flop stores whether or not the counter should currently be counting up or down; the "up" input makes the clock start counting up and the "down" input makes the clock start counting down. (The "up" or "down" input will be held at 1 for at least a clock cycle, and it doesn't matter what happens while it's being held at 1.)

sample solution


4. Here's a cute one:
Change an n-bit counter (a normal one, which counts in order) to one which counts down rather than up, just by rewiring it, adding no additional circuitry of any kind (no additional gates).

(This problem is a "trick", obviously; it's ok if you don't get it, and there's no way I could ask something like this on a midterm or exam.)

solution


5. Design a hardware stack to hold a maximum of four values, each consisting of one bit. The stack has the following input lines:

and a single output line. The output line always reports the current top of the stack.

(Recall that a stack pushes data onto the top of the stack, and pops data from the top of the stack. In other words, last in, first out. If more than four values are pushed on, older values are discarded.)

You may use AND, OR, XOR, and NOT gates, etc; flip-flops of any kind; and/or decoders, multiplexers, etc.

Optional hint: There is no need to keep track of how many items are on the stack. Just keep four D flip-flops for the up-to-four items on the stack. The initial values won't matter unless more things are popped off the stack than are pushed, and this is not allowed.

sample solution


6. Design a hardware queue. This question looks rather similar to question five above, and I admit that it is quite similar in some ways; on the other hand, it has some notable differences.

The queue has the following input lines:

and a single output line. The output line always reports the current front of the queue. CLEAR is used to set the queue to empty.

(Recall that in a queue, data is added to the end of the queue, and data leaves from the front of the queue. In other words, first in, first out.)

Your queue will hold a maximum of two values, each consisting of one bit. If there are already two values in the queue and another is added, we don't care what happens, as this is a prohibited action. Similarly, we don't care about the output value when there is an empty queue, nor about what happens once more LEAVEs than ADDs have been asserted since the last CLEAR; finally, you needn't be concerned with what will happen when your circuit is initially powered on, as the first operation will be a CLEAR, and you can assume that no more than one of the control lines will be asserted at a time. (These are just examples; in general, we don't care what happens if the queue is used incorrectly.)

You may use AND, OR, XOR, and NOT gates, etc; flip-flops of any kind; and/or decoders, multiplexers, etc.

Optional hint: In addition to the data-holding flip-flops, use two JK flip-flops to form a two-bit counter which keeps track of how many items are in the queue.

sample solution


7. For this question your client is a radio DJ. At this radio station, they want to use a circuit you will design to help them remember to announce the time on the radio at least every 30 minutes.

There will be two time displays: one is the current time, in the form HH:MM; the other is the number of minutes since the time was last announced. There is also a single output LED which blinks when the amount of time since they last announced the time is greater than 25 minutes. It should go on and off with a period of two seconds (i.e. on for one second, off for one second, repeat).

The input consists of a single line, which comes from a button they press when they announce the time. That is, this resets the second time display to zero. There is also a clock pulse which runs at the rate of 16 cycles per second.

For the purposes of this assignment question, suppose that the time on the main display coincidentally happens to have the correct time when the circuit is first powered on. Also, someone will press the push-button soon, and they know that the second time display is not reliable before then.

Use high-level components in answering this question. For example, don't draw a four-bit counter using JK flip-flops; draw a box and label it "four-bit counter".

You must include six seven-segment displays (four for the HH:MM display and two for the second display which shows the number of minutes), and they will be connected to the output of seven-segment decoders.

(This question is rather open-ended, so I have less to say on the matter of a sample solution, and I won't be posting one. If you have a solution you want me to look at, please feel free to bring it by during office hours. You can also ask me questions about the problem, or about a "correct" answer.)


[CSC 258 additional problems] [main course page]