Electrical – Why can’t I make flip-flops in logic simulators

digital-logicflipflopsequential-logicsimulation

I've been playing with a few logic simulators and don't understand why flip-flops are not working. I'm trying to implement a T flip-flop with NAND gates:

enter image description here

All the simulators I've tried give the same result. Either Q or Q' takes the state of the clock rather than toggling on the rising edge, depending on the timing of the internal updates. Given the symmetry of the circuit I'm not that surprised, but wonder how it's meant to work in practice.

Is this even possible, or do these imulators provide flip-flop components because it's not possible to do with basic parts? If so, why and what is missing?

Simulators:

NAND gate circuit compared to a provided T flip-flop (circuitverse.org):

enter image description here

The same in simulator.io (using AND+NOT as there's no NAND):

enter image description here

Best Answer

Because from this page, the style that you show only works if the width of the clock pulse is tuned to be long enough for the output stage to react, yet short enough for the thing to not oscillate. A logic simulator that doesn't model propagation time may not be able to cope.

To simulate your circuit, you'd need a circuit simulator that 'understands' propagation delay, or you'd need to simulate your circuit at the transistor level.

That same page shows this circuit for a fully synchronous J-Kflip-flop (just connect J & K together for a T f-f):

enter image description here

You may want to try that in your simulator, see what happens.