[MUSIC] We already know what are the basic memory elements, namely latches and flip flops, and now we are going to see how to use them to implement sequential circuits. First remind the structure of a sequential circuit. It is made up of a Combinational Circuit, and a set of Memory Elements. The Combinational Circuit generates the Outputs and the Next State in function of the Inputs and of the Current State, and the memory, consisting of bistable components, store the Current State. Here is an example. It's a Moore model, and actually it's the Sequential Circuit that controls the robot that we have seen before. It has four states, and these are the corresponding next State Table and Output Table. A first point is: will we use flip-flops or latches? Latches are smaller circuits. They use roughly half the number of transistors over flip-flop. Nevertheless, flip-flops are more reliable circuits. In the case of a flip-flop the inputs are sampled on an ledge of the synchronization signal, while in the case of a latch, it is in transparent state while the synchronization signal is equal to 1. So D flip-flops will be used. This is the symbol of a D flip-flop. It's equation, when CK is equal to 1, is simply that the next state is equal to the value of its input D. Thus, we get the following circuit structure. A combinational circuit, that we already know how it can can be synthesized, and a set of D-type flip-flops. Then, two questions. First: how many flip-flops do we need? And second question: what are the functions that the combinational circuit must implement? It must implement the functions that correspond to the inputs of the flip-flops. It's a function of the inputs, and of the current state and it must synthesize (or implement) the outputs of the circuit as a function of the inputs and of the current state, in the case of a Mealy model. If it's a Moore model, it's a function of only the current state. This sequential circuit has 4 internal states. Thus in order to binary encode and store 4 states we need 2 flip-flops. The chosen encoding is shown in this stable: SAR is represented by 00, SRR by 01, SAL by 10, SRL by 11. Then we can redefine the next state table and the output table using the encoded states. So, SAR is replaced by 00, SRR by 01, SAL by 10, and SRL by 11. Now the next state SAR is replaced by 00, SRL by 11, SAR 00, SRR 01, SAL 10, SRR 01, SAL 10, and finally SRL 11, and the output table is this. After encoding the internal states we get these new tables. And now, it's just a matter of synthesizing the corresponding combinational functions. D1 is the same as the next value of the output of flip-flop 1, and it is defined by this column of the table, and you can check that it can be expressed under this Boolean form. The same for D0. It is defined by this column, and you can check that D0 is equal to input OB. And we can also define the output functions, as defined by the two columns of this table, and we get these expressions. Once we have Boolean expressions of the D0, RR and RL, we can synthesize a circuit that implements the sequential circuit. This part of the circuit corresponds to equation D1, D0 is equal (here) is equal to the input OB, and these AND gates correspond to the output functions. In the case of a Mealy model, for example this sequential circuit, both tables can be merged: to every pair (current state, input) corresponds a next state and an output. An important comment: In the latest lesson, we had analyzed the following circuit with these input signals, and we had observed that while there is no RESET pulse, we do not know the state of the circuit. In some cases, this seems not to be so important; nevertheless, if you are not able to define the initial state, it will probably be very difficult to test the working of the circuit. So - this is the comment - in most cases a RESET signal is necessary to put the circuit in a known initial state. Now a quiz. Summary: we have seen which are the steps that must be followed to synthesize a sequential circuit from its next state table and its output table. First: compute the number of necessary flip-flops. Encode the states with 0's and 1's. Compute the next value of the flip-flop outputs in function of the inputs and of the current state. In some cases: compute Di in function of the next value of Qi. Nevertheless, in the case the D-flip-flops Di and the next value of Qi are the same. Compute also the output functions in function of the inputs and of the states, or only in function of the states if it's a Moore model, and design the combinational circuit and don't forget to add a synchronization signal and a RESET signal.