Homework 1
Problems I and II are due Thursday, October 15; problem III is due Monday, October 19.

Note: Instructions for submission of the homework to the Reader will be given soon.

You will be using Chipmunk (diglog) for all the digital design problems in our course. Use any components in the diglog catalog you like, except when otherwise specified.

NOTE: BOTH IN YOUR DEBUGGING AND IN YOUR FINAL PRODUCT, MAKE HEAVY USE OF LABELS. THESE PLAY THE SAME ROLE AS COMMENTS DO IN PROGRAMS, VERY IMPORTANT.

Note: In all digital design problems, add enough input and output mechanisms, typically hex keypads and hex displays, so that your circuit can be tested by the Reader.

Note: You are never responsible for error handling unless specifically asked for it.

Problem I:

Build the mod/div 5 example from our digital design notes and my Chipmunk mini-manual, with two changes: (a) 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 Zi outputs which are used in our mod/div 5 circuit.) (b) Have the circuit do mod/div 6 instead of 5. (Turn in ONE circuit that includes both changes.)

Problem II: Build a circuit which converts a 7-bit ASCII character, consisting of a single hex digit (`0'-`9', `a'-`f') to the corresponding 4-bit integer. Example: If the input is 0110100 (`4') then the output will be 0100. Example: If the input is 1100001 (`a') then the output will be 1010.

As with all projects, I recommend starting out by just doing a piece of the project. First design the circuit to handle only the case of '0'-'9'.

Problem III:

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 "pseudocode" form:


turn = x
top:   if turn = x and u = 1 
          z = x
          turn = y
	  go to top
       if turn = x and u = 0
          z = y
	  go to top
       if turn = y and v = 1
          z = y
          turn = x
	  go to top
       if turn = y and v = 0
          z = x
	  go to top

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). Note carefully: The "user" here (in reality, other parts of a larger circuit in which this circuit is a part) is allowed only to set values of x, y, u, v and the "clock," nothing else.

I suggest that you 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.)