Untitled Document Chapter 7. - State Assignment Next Page of this Chapter This chapter of the course will discuss how to start using flip-flops to satisfy less trivial circuits. The first stage of this process is one of state assignment from a specification we have been given to a combination of flip-flops and combinational logic. When we talk about states, we refer to the number of present states in a particular circuit (as discussed in Chapter 4 - State Diagrams and Tables). For example this state diagram has 4 internal states. As a general rule, any circuit with 2 internal states will need 1 flip-flop in its implementation. If 3 to 4 internal states are needed, then 2 flip-flops are required to satisfy the requirements. 3 flip-flops will have to be used if there are between 5 and 8 internal states. Between 9 and 16 states, 4 flip-flops. Between 17 and 32, 5 flip-flops etc. Lets consider an example to help us learn about the start of this process. Consider the state table shown below. The system is a vending machine and has two inputs X1 (say for 10p) and X2 (say for 20p). The inputs are input pulses and come from a coin sensor that will NOT produce X1 and X2 pulses at the same time (Note: no clock signal is present). There is also an output to the system that releases some crisps, this is a singular level output Z. Once the crisps have been released, there is an automatic reset to the system that we do not have to worry about. We can immediatly observe that there are only four internal states, meaning that we require two flip-flops of some description. Let us see what the circuit actually does before moving on any further: State When 10p (X1) is inserted into the machine, the next state will be state 2. However if 20p (X2) is deposited, then we jump to state 3. If 20p (X2) is deposited in the machine, we jump to state 4. If only 10p (X1) is inserted then we move to state 3. If either 10p (X1) or 20p (X2) is reconised, then we move to state 4. At this state the crisps are released and the system is reset. The general operation of this circuit is that someone will pay 30p for a bag of crisps. No change is given as the system is reset, so users can pay 50p instead of 30p. This state transition diagram should clarify our problem. As we are using two flip-flops (as discussed above) there will be two main outputs, one from each flip-flop. The two outputs from the flip-flops must then be dealt with to send the release signal to the rest of the system. We shall assign each output as Y1 and Y2 for flip-flop 1 and flip-flop 2 respectfully. The outputs Y1 and Y2 can have output combinations Y2Y1 = 00, 01, 10, and 11. Y1 and Y2 will of course be used to send the release signal, we will need some additional logic for this. In the scope of the course we shall only use this method of labelling as there are others (One hot, Almost one hot). Using the output combinations we can convert the state table into a state table with secondary assignments. Lets walk through one of the lines of information above: The present state 2 has now been relabelled as '01'. If an X1 (10p) pulse is recieved then the next state must be 3. or as its now relabelled '10'. '10' actually means that the next state output of Y2 should be 1, and the next state output of Y1 should be 0. So however the combinational logic is organised, the sequential logic (i.e. the flip-flops) must produce Y2=1 and Y1=0 at the next state for the circuit to function properly. The process of understanding this second state table is exactly the same for every other state. If you can understand the above explanation, then you will be able to interpret the whole table. Once you have understood this part of the chapter then you are more than ready to move on. Do not worry too much if the method of state assignment is unclear at this stage. Complete the example, and then re-read sections that you are unhappy with. There will be another example to follow just incase you are still not understanding the theory. Next Page of this Chapter