1
\$\begingroup\$

This may be simply a logic.ly issue. I'm trying to simulate a JK flip-flop in logic.ly/demo using two AND gates and 2 NOR gates, but the simulation does not work when both inputs are high and the clock is high (i.e. Q and Not Q does not toggle). I've set an initial state, so the S and R are working fine working, but once the J and K are high and the clock is H, the circuit goes haywire? Is it a logic.ly issue (level of complexity not quite there)?

enter image description here

\$\endgroup\$
3
  • 2
    \$\begingroup\$ "Combinatorial loops" are a challenge to simulate - without really delving into your question in specific to see if there is another issue or misunderstanding, it's worth realizing that its not safe to assume that a simulation tool will be able to do this unless the documentation specifically says that it can. In contrast it does make a fun breadboard experiment with real parts. Generally in real programmable logic design constructing flip flops from gates is considered improper; if you want stateful behavior you use one of the supplied flip-flop, register, or memory primitives. \$\endgroup\$ Nov 13, 2018 at 16:23
  • \$\begingroup\$ That said, the tool vendor seems to offer a flop made of gates as one of their examples, so perhaps there is an intent to support this. However, that example at present generates a fatal error when you try to open it. And there's no obvious documentation for the tool. So who knows. \$\endgroup\$ Nov 13, 2018 at 17:39
  • \$\begingroup\$ Thanks Chris. Logic.ly has a JK Flip Flop IC already built, and it does the toggle nicely, but it has the Preset and Clear input. I was trying to build it here without a Preset and Clear and just set it myself before-hand... maybe going about it the wrong way, or as you said, not really something for this software \$\endgroup\$ Nov 13, 2018 at 18:10

1 Answer 1

1
\$\begingroup\$

The reason why the circuit is freaking out like this is because of the S/R flip-flop on the right-hand side. You might recall that an S/R flip-flop is not completely stable, because the inputs and the outputs are supposed to be either/or: Either S can be active or R, but not both, and similarly, Q or not-Q can be active, but not both. The effects you're seeing are the results of a feedback loop created in which this rule is not upheld: Both outputs turn on, creating an unstable state in which the circuit keeps "flickering" between two states.

I do not know how J/K flip-flops are really structured in the real world, but I believe you are partly suffering from the effects of computer simulation rather than working with physical devices. In the real world, a J/K flip-flop structured in this way would have some real-world propagation time as the signals pass through the gates, which might prevent this state from occurring. (This is similar to the problem inherent in the classical "bistable multivibrator" circuit, which cannot work on paper because it has two inputs which are electrically identical, but which always works in the real world because in reality, you will never have exactly the same voltage on both inputs during power-up.) - Answered by Adam Luoranen

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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