1
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ Your description actually shows the behaviour of a rising-edge triggered flip-flop. Also the schematic symbol also shows a rising-edge clock input. Are you sure, that you have falling-edge triggered flip-flop? \$\endgroup\$ – Martin Zabel Mar 12 '16 at 18:32
  • \$\begingroup\$ @MartinZabel I have exported the xml file here: pastebin.com/4Ety53ic There you can also see: <a name="trigger" val="falling"/> \$\endgroup\$ – Koray Tugay Mar 12 '16 at 18:54
1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your response. However I am already expecting that the D will turn to 1 in "half cycle" already. \$\endgroup\$ – Koray Tugay Mar 14 '16 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.