Lab two questions and answers

Here are some notes about lab two (some in Q&A format, some not). Suggestions for additions to this list are welcome (via e-mail).


Q: I really can't picture this crosswalk.

A: This is a pedestrian crosswalk without an associated automobile intersection. So there is only one dimension of automobile traffic flow (two directions along one line). The pedestrians are crossing the street. No intersection.

Note that the system doesn't have a 'walk' signal. The only light described is the car-facing light. Consider the walk signal to be on iff the light is red.


Q: Can I assume that the pushbutton won't be pressed when the light is yellow or red?

A: No. There is a pushbutton there. There are all sorts of crazy people walking by. Some of them want to cross the road; some of them don't care about the traffic light but think that pushing buttons is fun.

Now, if someone does push the button when the light (which is directed at the cars) is already red, or is yellow and hence will soon be red, it's not exactly clear what they mean by this. If it has no effect, that is fine. If it causes the light to go red again in the future as soon as possible (i.e. after the next state 0 will immediately come a state 1), this is also fine. But something reasonable has to happen. (It's also ok if it is effectively randomly one or the other of these two possibilities.)

I think that if you ignore this issue and just design your circuit, you'll find that it does something or other acceptable in the case where the pushbutton is pressed at an inopportune moment. But indeed you do have to worry about this, in the sense that you should go back and verify that nothing too strange will happen in this case, after you design your circuit.


Q: Don't we have to worry about the possibility of S and R both being set to 1 for PW?

A: It depends upon how you wire up your circuit, but you may be surprised to find that the answer is probably "no". Ignore this issue and design a circuit, and then you will probably find that it is ok if you end up attempting to clear the PW latch at the same time that a passing pedestrian presses PB. In this case, it's really not clear whether the cycle should immediately repeat after this cycle ends (if the pedestrian had pressed it a moment sooner, it wouldn't; a moment later, it would); so long as your circuit is sure to do one or the other behaviour properly, this is fine.

Q: But we labelled S=R=1 as "don't use" when discussing the SR latch.

A: True. But you are also in a position to be able to figure out what happens if you do put S=R=1 in an SR latch. When you set them both to 0 again, Q and Qbar will stabilize as opposites. That's all we need in this case; it doesn't matter which way they go.

This is, of course, an unusual situation. We normally do care whether Q is true or false after a given input! But we also don't normally have set and reset operations happening near-simultaneously.


Q: Can you give me a hint for the "non-five detector" for part A?

A: The three output bits have the pattern 000, 001, 010, 011, 100, 101, 110, or 111. Precisely one of these numbers is the number five! (Namely, 101.) So, the output is five iff x2 and not x1 and x0.

So the output isn't five if the negation of this; I'd tend to use a deMorgan's law immediately to say that it's not five iff not x2 or x1 or not x0.

For a further optimization, you should use the expression not x2 or not x0 instead. If you think about it, perhaps drawing truth tables, you will see that the values of these two expressions differ only when the three digits of x are 111. And that won't happen.


[all CSC 258 labs]
[main course page]