COS 111 Assignment 5 Spring 2005 Due 03-23-2005 In this Problem Set, you will design a digital system from beginning to end. The system you will design is a "digital combination lock," a digital analogue of the kind of combination lock found on most lockers, or bike locks. The combination lock should basically work as follows: The lock should have two input bits, and one output bit which becomes 1 only if the user has succeeded in opening the lock. The combination of the lock is 01-10-01. * What that means is that the output of the lock should become 1 only if the user first enters 01 on the inputs, then enters 10, and finally enters 01 again. * Assume that the system clock beats at 1 Hz, and that this gives the user enough time to change the input as needed for the lock to work. * If the user ever enters the wrong bit sequence, then the lock should reset, and the user should have to start entering the combination from the beginning. -- For example, if the user enters 01-11-10-01, the lock should NOT open. On the other hand, if the user enters 01-11-01-10-01, the lock should open, since the last six bits entered were the correct combination. * Once the lock is open, it should stay open until the user enters 00, at which point the lock should reset to being closed (i.e. output=0), and the user should have to enter the correct combination again to open the lock. (Part 1) Carefully write down what the inputs and outputs of the system are, and draw the state diagram describing the State Machine for the combination lock (just as we did in class for the traffic light). Clearly indicate on the arrows between states what the inputs need to be in order to change from one state to the other. Don't forget to include arrows from a state back to itself if it should stay in the same state. (Part 2) How many bits do you need to represent your states? Write down your representation for each state. (Part 3) Write down the multiple-output truth table corresponding to the next state and output, given the current state and inputs to it. (Part 4) Finally, draw the final structure of the circuit for the combination lock. You can use memory and the Universal Method as "black boxes" -- you don't need to draw every gate. Be sure to specify where the system clock figures in to your circuit. (Extra Credit 1 - a funny lock) Can you modify your state machine above (you only need to do Part 1 again) to make a lock that opens only if the user enters 01 an ODD number of times? The lock should ignore all other inputs. For example, any of the following input sequences should cause the lock to be open at the end: 01 11-01 11-01-10-01-01 etc. On the other hand, any of the following should have the lock closed at the end: 00-11 01-01 11-01-10-01 (Extra Credit 2) Can you modify the lock so that it opens only if the user enters 01 an odd number of times AND 10 an even number of times?