# How do I transition from one state to another with d-flip-flops? (digital lock)

I am currently trying to make a digital lock for an assignment, the code in this example is hardcoded 1-2-3. This is what I have so far: x0,x1,x2 are the BCD input for the lock. I am trying to make the circuit go from state q0 = 0 and q1 = 0, to state q0 = 1 and q1 = 0, when the input x0 = 1 and x1 = 0 and x2 = 0. I am trying to implement this with dflip flops, but I am having a really hard time, and cannot for the life of me figure out how to do this right. Out is the signal to open the lock. It will only open if q0 = 0, q1 = 1 AND x0 =1 and x1= 1 and x2 = 0.

The circuit behaves like I expect it to, but I can't figure out the memory aspect of it at all. Any help would be greatly appreciated!

Your combinatorial circuit has Q0 and Q1 inputs, representing the current state, and NEXT0 and NEXT1 outputs representing what the next state should be.
It is the role of the FFs to hold the current state, so their outputs should be connected to Q0 and Q1.
You want the next state to become the current state on the next clock edge, so connect NEXT0 and NEXT1 to the inputs of the FFs.