# Deriving the circuit of Flip flop

DERIVING THE CIRCUIT OF FLIPFLOP (from digital components):

To understand the logic let’s consider a basic circuit of an inverter with a feedback as below:

Now what would be the output of the circuit?

We know what ever is at input, we’ll get inverse of that at output and as output is fed back to input so again it would be inverted and this way we’ll have a pulse oscillating between 0 and 1. Hence the output is as follow:

And width of the pulse (either LOW or HIGH) would be equal to the total delay of the gate and wires. Hence we have the clock period equal to 2*(gate delay + wire delay).

But basic function of a sequential element is to hold the value but in the above circuit we have an oscillating value and hence no permanent value is stored.

To store a value what we can do is use 2 inverters and hence only one value would be stored in the value as net effect of 2 inverters is same output as input. So we are able to store one bit in the cell.

But even there is a problem associated with this circuit as we don’t know the value stored in the circuit, as soon as we complete this circuit a value is stored immediately and circuit becomes stable.

Let the stable value is 0 in the circuit as shown:

Now if we try to input a 1 to the circuit from the input as:

It would be of no use as providing a +5v (high) and a 0v (low) would result in sinking the whole voltage and hence net input as zero voltage. We’ll not be able to change the value stored as input would still be zero and hence value stored would be zero.

And hence there is no provision that we can set a value in the circuit.

To make this provision we make a change in the circuit as follow:

We have place an OR gate with one input as S and the other input being the feed back input. So in this circuit initial value stored is 0.

Role of S: what ever is the value of S, that value is stored in the circuit. Now if we make S=1 then we’ll get a 1 as output of OR gate and hence 1 is stored in the circuit. Now the situation of the circuit is as follow: Another problem in the circuit –

How to make it zero now:

now 1 is stored in the circuit and if we want to store a 0 again in the circuit then we make S=0. But when we make S=0, we are not able to change the value from 1 to 0. So we find that there is another problem with this circuit that we are not able change value to 0. What now..?

Now we make another change in the circuit as follow so that we can change the value to 0 or 1 as we want: As we have seen that we can put a 1 on the line using OR gate but we need to put a 0 at the input of first inverter to store a 0 in the circuit. So what do we do now?  Let’s see values at different points in the circuit if a 0 is stored.

And we see that if we can place a 1 in the middle of two inverters we can change the value stored to 0 and hence we include an OR gate in the middle of inverters as follow: We can represent the above circuit as follow (replacing OR & NOT with NOR):

In the middle of two NOR gates we have the invert of what we have at the output. hence we can represent the middle point with Q bar.

And with little adjustments we can represent the above circuit as given on the next page:

This circuit is called RS latch and we can store either a 0 or a 1 in this circuit depending upon the value of R & S as discussed on next page.