Electronic – Is the understanding of D-Flip Flop wrong

flipfloplogisimmemoryregister

So I am working on: http://www.nand2tetris.org/ and I am having a hard time understanding the D-Flip Flop, or maybe I should say, how Logism represents it.

I have this circuit and this is the current state I am in. The D Flip-Flop I have in my circuit has the property Trigger: Falling Edge.

enter image description here

Now I will click on load and in inputs:
enter image description here

And I will tick once
enter image description here

At this moment, it is ok that out = 0. I can understand it. However, my expectation is D should already be loaded, and should be showing 1, not 0.

Only after I tick one more time, I the D will be loaded:
enter image description here

If I cover the value shown by D, everything makes sense, how the Flip Flop works etc.. But as long as I am seeing the value in the D – Flip Flop itself, I get confused.

Is my understanding wrong or something wrong with Logisim?

Best Answer

What you're running into here is a quirk of Logisim. Each simulator "tick" is resulting in half of a clock cycle, not a whole cycle. (You can see this in the screenshots: the clock input goes from dark green to light green after the first tick, and back to dark after the second tick.)

Since the D flip-flop is set to trigger on the falling edge of the clock, the output only updates after the second tick because that tick is the one in which the falling edge occurs.

Hooking the clock input up to another digital input (like you've got for "load" and "in") may make it easier to play around with this circuit.