2
\$\begingroup\$

Problem

Circuit Diagram Of the Memory Bit

I am trying to simulate a circuit that acts like a memory bit in Logisim Evolution but for some reason the NAND gates don't turn on with both outputs set to 0. I suspect that the problem might be that the gates are not connected to any source of power but if that is so how can I fix this?

Weird Debugging

Buttons Work

It works perfectly when connected to buttons

But Switches Don't Work

Switches don't work.

Update

This is the final circuit that worked: Final Circuit

\$\endgroup\$
5
  • \$\begingroup\$ This thing requires some transition time to stabilize the outputs. Not sure if Logisim has a special way to simulate it. \$\endgroup\$
    – Eugene Sh.
    Commented Sep 22, 2022 at 14:30
  • 4
    \$\begingroup\$ When the switches are at 0 the inputs are disconnected from GND. This is what I assume. If that's the case then the gates might have seen the "floating" inputs as "undefined". What happens when the switches are at 1? \$\endgroup\$ Commented Sep 22, 2022 at 14:34
  • \$\begingroup\$ @RohatKılıç Except for when both switches are on there is no change in the output wire, when both are on it shows a 0 value. \$\endgroup\$ Commented Sep 22, 2022 at 14:36
  • \$\begingroup\$ What logic family? With some logic families, it's what Rohat Kılıç said: a "floating" input is undefined. With some other logic families it's worse than that: A floating input is a definite logic "1." If you want to "set" an input to "0," then you must connect it to ground. \$\endgroup\$ Commented Sep 22, 2022 at 14:57
  • 1
    \$\begingroup\$ @SolomonSlow I just connected it to ground and that fixed the problem! Thanks. (I don't know how to check what logic family it is, new to this stuff) \$\endgroup\$ Commented Sep 22, 2022 at 15:00

2 Answers 2

6
\$\begingroup\$

The switch is passing the 1 signal through when it is pressed, but when it is not pressed, it's not passing a 0 through - it's passing nothing through. A blue wire in Logisim indicates a wire with nothing outputting a signal to it.

Logisim treats them as unused inputs (configurable in preferences), but if all of a gate's inputs are unused, you haven't wired it up properly and so it outputs a red error signal which propagates everywhere else.

If you are looking for a toggle-switch input (click for on, click again for off) use a digital input pin - not a switch.

\$\endgroup\$
1
  • \$\begingroup\$ Finally something that works perfectly!! I was putting ground pins here and there which worked fine for one gate but when I tried to put it in the memory circuit, weird things were happening. Will mark this as the solution. \$\endgroup\$ Commented Sep 22, 2022 at 15:46
4
\$\begingroup\$

Logisim (original or evolution) doesn't simulate the signal propagation with delay. Anything more complicated than SR latches may not work, as you have seen.

It works perfectly when connected to buttons

Switches don't work.

From the wire colors, notice that if the switches are three-state the inputs are not determined.

\$\endgroup\$
4
  • \$\begingroup\$ Do you happen to know any software that might be better for simulating CPU (something visual like logisim)? \$\endgroup\$ Commented Sep 22, 2022 at 14:38
  • 2
    \$\begingroup\$ If you use the sequential/memory building blocks from the program, Logisim will be able to handle simple CPUs, but, as the project grows it will become more difficult to drive it with meaningful test cases. For these projects, you might seriously consider dropping schematics and switching to some HDL. \$\endgroup\$
    – devnull
    Commented Sep 22, 2022 at 14:42
  • \$\begingroup\$ Would HDL be preferable even for a simple enough 8 bit cpu? The book I'm reading has an example where someone has simulated the same CPU in logisim. \$\endgroup\$ Commented Sep 22, 2022 at 15:02
  • 1
    \$\begingroup\$ @Sujal HDL is the professional tool, but Logisim is definitely easier to understand for beginners. \$\endgroup\$ Commented Sep 22, 2022 at 15:19

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.