Homework 1
Due Thursday, April 16
Note: Instructions for packaging these two problems for submission to the Reader will be given soon.
You will be using Chipmunk frequently in our course. Remember to consult the Chipmunk mini-manual.
Problem I:
(Warmup.) Build the mod/div 5 example from our digital design notes and my Chipmunk mini-manual, with one change: Instead of using a 74138 component, use primitive AND, OR and NOT gates in its place. (Note: Do NOT build a whole 74138-equivalent; simply build the Z4 and Z5 outputs, which are all that are used in our mod/div 5 circuit.)
Problem II:
Build a special kind of selector with the following features: There are two 1-bit inputs, x and y, and one 1-bit output, z. There is also a clock pulse line, p.
The circuit selects one of x and y and copies it to z, and normally this is done by "taking turns." In other words, on the first clock pulse, x is copied to z, on the second pulse y is copied to z, then x, then y, and so on.
However, there are two additional inputs, u and v, which indicate whether x and y, respectively, contain meaningful values rather than just garbage. So, if for example it is x's "turn" but u = 0, then y is copied to z; if it is y's "turn" but v = 0 then x is copied to z. (Assume that it will never be the case that both u and v are 0.) If one of x and y "miss a turn" in this sense, it will be its turn on the next clock pulse.
In summary, we want our circuit to alternate, first copying x to z, then y to z, then x, then y, and so on. But if there is garbage at, say x, we don't want to copy it to z, and will copy y to z instead, and vice versa. On the other hand, say it is x's turn but x is garbage and thus we skip its turn. Then to be fair we want to give x another chance in the next clock cycle, i.e. we want it to still be x's turn then. In fact, we want x to continue having turns until it actually uses one, and similarly for y.
You will not be actually using a clock; you will use a Digital Pulse-Generative Switch. Use Digital Switches for x, y, u and v, and an LED for z. Use a DPOS flip-flop to store q, the "whose turn it is" variable (1 for "x's turn," 0 for "y's turn).
Do this problem in small stages:
a. First just build, in essence, a 2-input multiplexer: x and y will be the inputs, and q the control input (at this point just a Digital Switch, not a flip-flop). To do this, just reason out what the algebraic equation should be for z in terms of x, y and q.
b. Once you get that working, change q to a flip-flop, so now you will have a "multiplexer with turns-taking."
c. Once you get that working, go to the general case. (Of course, you only turn in this one, not the preliminary ones above.)
NOTE: BOTH IN YOUR DEBUGGING AND IN YOUR FINAL PRODUCT, MAY HEAVY USE OF LABELS. THESE PLAY THE SAME ROLE AS COMMENTS DO IN PROGRAMS, VERY IMPORTANT.