Digital-Logic-Sim icon indicating copy to clipboard operation
Digital-Logic-Sim copied to clipboard

[Feature Request] RS NOR Latch

Open erich-m opened this issue 2 years ago • 3 comments

Due to the mechanics of the simulator, RS nor latches do not have an "unstable" state, and so memory chips cannot be created. image

erich-m avatar Feb 14 '23 02:02 erich-m

You can do them with NAND's:

Animation

If you want to make SR flip flops you can use a falling-edge-triggered SR design, see https://github.com/SebLague/Digital-Logic-Sim/discussions/156

You might also look at D flip flops and JK latches.

JC3 avatar Feb 23 '23 17:02 JC3

Would someone mind explaining why you would need this, and what the difference between a memory chip and the registers we've made is?

crispeeweevile avatar Jul 10 '23 20:07 crispeeweevile

In digital logic, states are either 0, 1 or undefined (X). The feature request is not so much a request for a feature but to highlight a critical flaw in the design of the program. If you have a NOT gate and you put a 0 into the input, you will get a one as an output. If you have a 1 as an input, the output will be a 0. This can be done in the software. If you take two NOT gates and connect them in series, the actual state of both wires should be undefined, as it is in just about every other circuit simulator software. Some of the later figures demonstrate what happens in Digital Logic Sim, and it does not have the same results. fig3-other softwares When creating memory latches, having an undefined state is actually very important for making registers. The problem with an RS NOR latch on its own is the fact that it has this instability and undefined state, caused by two inverting logic gates feeding into the other. When both inputs to the latch are 0, the output should be undefined...that is why there is a D flip flop. The extra digital logic actually fixes it and does not allow for an undefined state. fig1-not gate properties-rs outside fig2-build of rs nor latch Since the Digital Logic Sim software does not have an undefined, the two inputs to the latch can both be 0, and there will be an output that is not undefined, but in fact, is 1 (or 0 depending on how the outputs are linked together). This means that there is actually no need to build a D flip flop at all. The flip flop though, is a crucial component in several types of registers that ultimately cannot be built. fig4-truth table for rs nor latch I will be happy to answer more questions as needed.

erich-m avatar Jul 10 '23 21:07 erich-m