 Hello everyone. Myself Prithviraj Pithambay working as an assistant professor in Department of Electronics Engineering at Valgination of Technology, Swalapur. Let us learn today, finite state machines. At the end of this session, you will be able to examine the structures of finite state machines and their state diagrams and mainly we will discuss the structures of Moore state machine and Mill state machine. So what are the state machines? So state machines are composed of some conventional and sequential logic circuits. State machines represents a digital system as a set of states. So state machines are associated with some inputs and they give some outputs. The states transits from one state to another states depending upon the input and the present states. So this state transitions are totally controlled or synchronized by a clock signal. So machine always has some finite number of states. A machine is defined by specifying the number of inputs and outputs, initial states from where the state machine starts, the present state and the next state because of the applied input. So this is the general structure of a state machine. So you will see here a next state combinational logic circuit and output combinational logic circuit. So these two blocks are pure combinational logic blocks. The state machine whereas sequential circuit, the output of the state machine is synchronized by a clock signal. So external inputs are applied to the next state combinational circuit as well as the present state is also applied to this next state combinational logic. So output of a combinational circuit are the excitation inputs to the state machine. So that state machine changes its current state to the next state. Input combinational logic sometimes accepts external inputs but always accept the present state as another input. So in some state machines you may find that the external input is not present but the present state is always there. So let us calculate the number of distinct states this state memory can have. So state memory is nothing but a set of n flip-flops which are used to store current state of the machine. So obviously the number of states are related to the number of flip-flops used. So the relation is 2 raised to n. So for example with the 2 flip-flops total number of distinct states can be maximum 4. So state machine with n number of flip-flops can be used to store 2 raised to n distinct states. So now let us concentrate on the next state combinational logic output. So next state excitation inputs are totally depends on the present state and the external input applied. So these excitation inputs to the state memory are a totally function of present state and external input whereas this output of the state machine is a function of present state and external input. State machine state diagram. So you can represent the state diagram for state machine by drawing state transition diagram. So if you observe particularly for this example we have 4 states and state transit from one state to another state depending upon the number depending upon the external input applied. At the same time the output also changes. So state machine is made up of states and their transition because of the external inputs. So let us learn the structure of Moore state machine. So here again we have next state combinational logic circuit and output combinational logic circuit with state memory to store the current state of the state machine. So here the next state excitation inputs are functions of present state and external inputs whereas the output of a combinational circuit only depends on the present state. So instead of external input the output of combinational logic only depends on the present state. This is how you can draw the state diagram for a Moore state machine. So if we observe the output of Moore state machine is totally depends on the present state. So in the state diagram you will observe that each state has its own output. So here the state transition depends on the external input and whenever there is a state change output may change. So on the arrows you will see that only inputs are mentioned whereas the outputs are mentioned inside the state itself. Next state machine is a Milestate machine. So again the next state excitation inputs in the Milestate machines are depends on external inputs as well as present state whereas the output of a Milestate machine is now depends on present state as well as on the external inputs whereas in Moore state machine the output only depends on the present state. So that is the difference between these two state machines. So let us see one example. So the state diagram of a mod 4 counter is shown here. So mod 4 counter with a reset input and one output which shows that the end of the count. So mod 4 means we have total four total distinct states. So this counter starts counting from zero zero as a initial state then it goes to zero one then one zero then one one then again back to zero zero. So whenever the external input that is reset is zero the counter is always incrementing. When the external input reset is one counter goes back to the reset state from the state zero one one zero and one one. Also observe the output whenever the counter is in the counting phase the output is always zero but when counter changes from one one to zero zero that is the last transition output changes from zero to one which indicates that counter will start again from zero zero. So here you can observe that the output depends on the present state and the applied input. So instead of showing the output inside the state the outputs are shown on the transition. So this is an example of Millistate machine for a four bit two bit counter. These are the textbooks you can refer for the further reading. Thank you.