### Building the Hack Computer Hardware in Logisim - Part - 2

..and my notes...

This is Part - 2.

All of the gates in Part - 1 were Combinational Gates. Here we have Sequential Gates.

R-S Flip Flop:
(R for Reset and S for Set)

What is happening here is that, even though we have the same state on the inputs, we have a different state at the output in the images seen above.

This R-S Flip Flop, actually tells us which of its inputs were last turned on.

Level Triggered Flip Flop:

While the Clock is 0, this Gate will constantly output, what ever the last value of Data was, during the Clock was 1.

So lets say you make the Clock Input = 1. And during this time, if you make the Data Input=1, this gate will be outputting 1 in Q. When the Clock = 0, the modifications you make in Data will not affect the output. So when Clock goes to 0, whatever you have in Data, you will have it until the next time Clock = 1.

The thing is: If during Clock = 1, you play with the Data, Output will constantly change as well.

This is a Level Triggered Flip Flop. It stores the Data value at all times while Clock = 1.

Edge Triggered Flip Flop:

An Edge Triggered Flip Flop will only store the Data Input at the instant Clock changes from 0 to 1. And it will start outputting this value at this time as well.

So let 's say Data = 0 and Clock = 0. You make Data = 1 at this point, and hit Clock = 1. out will be 1 at this same instance. Now when you play with Data, the output will not change. This was different in Level Triggered Flip Flop. And when Clock goes to 0, output will stay in 1. Only the next time, when Clock goes from 0 to 1, if Data is 0, you will start getting 0. If Data changes to after Clock has already been turned to 1 (even if it still is 1..) you are too late! So you better set Data to whatever value you would like to have stored for the period Clock = 0 before Clock turns to 1.

Master - Slave Flip Flop:

A Master Slave Flip Flop resembles the Level Triggered Flip Flop. There is only one catch: the output is not instantaneous like the Level Triggered Flip Flop.

So while Clock = 1, you are free to play with the Data Input. You can set it to 0, or 1 as you wish.. You do not have to set it before clock turns to 1 from 0 (as in Edge Triggered Flip Flop..)

However, in a Level Triggered Flip Flop, you would get the output at the instance you changed the Data while Clock was = 1. In a Master - Slave Flip Flop, the stored data, (whatever the Data Input was when Clock turned from 1 to 0..) will only be outputted when clock turns to 0.

So assume current output = 0. You set Data = 1. You turn Clock from 0 to 1. (You are free to set the Data to 1 after Clock is 1 too, because this is a Level Triggered Flip Flop..) Data is stored. Output at this moment is still 0... You turn Clock to 0 again, now you are getting the Data you stored, which is 1.

16 - Bit Master Slave Flip Flop:
This is a... mess. This is just a 16 - Bit Master Slave Flip Flop. You set 16 bits of information before (or while..) the Clock is 1. You set Clock to 0, you start getting whatever value you have stored..

You turn Clock to 1, you play with Data, you are still getting the value from the previous state actually. Only after you turn the Clock to 0 again, you get the new value.

Let 's see this step by step, what we have in the middle here is a 16 - Bit Master Slave Flip Flop:

Now I will set the Clock Input to 1, and set the Data to 0x2.
Yes, I am a man of my word. I have done what I said as you see above..

Now, let 's turn the clock to 0:

As you see, we are getting the output we just set before. If we play with the data at this moment, nothing will happen. Also, when we turn clock to 1, the output will not change... Only after Clock goes to 0 again, the new value in the Data will be outputted.