eugenelepekhin / LogicCircuit

LogicCircuit – is free, open source educational software for designing and simulating digital logic circuits.
https://logiccircuit.org/
62 stars 16 forks source link

Logic gates AND #9

Closed xXHakaseXx closed 1 year ago

xXHakaseXx commented 1 year ago

When i have one input for example const and logic gate AND shows always true when only one input is true. obraz

eugenelepekhin commented 1 year ago

The AND function is only defined on two inputs, so if you provide only one it's behavior is undefined.

xXHakaseXx commented 1 year ago

LogicCircuit_oskAvvHzfm LogicCircuit_8UXXrGlSIw LogicCircuit_B5spNf1z6x

xXHakaseXx commented 1 year ago

But in this case i think this is real problem. :/

xXHakaseXx commented 1 year ago

try it yourself

xXHakaseXx commented 1 year ago

in larger projects this can be irritating

eugenelepekhin commented 1 year ago

I am sorry I don't quite follow you. You are building full adder. and instead of connecting your circuit to actual number input you partially connect some of the inputs. I am sure if the AND gate will behave differently then, in some other circuits partially connected it will produce other strange results. If you want your circuit behave correctly when not all the inputs are connected you should design, it that way. In your case just connect all your inputs and it will work correctly. I hardly imagine why you just partially connect your adder. What are you trying to get? If you want to verify correctness of your adder you can use truth table and filter expression: https://logiccircuit.org/TruthTable.html

xXHakaseXx commented 1 year ago

In my opinion, it is difficult to read anything from this table and it is easier to connect something in the right place, the slightly strange operation of the program meant that I did not quickly find an error in my system and I consider it a minus. I understand that it's hard to program an idiot-proof program, but apart from these flaws in my opinion, the program is great.

eugenelepekhin commented 1 year ago

Whell, it's not about idiot proof. The AND function is not defined when only one argument is provided. Here is an example of how it defined by Microsoft Excel. In your case all conditions in test are true. You just have one condition. But still all of them are true, so by this definition the function should be true. Or course you can come up with different definition, but it would not be any better than this one. As I mentioned with other implementations you can build different circuit that behavior is irritating.