SebLague / Digital-Logic-Sim

https://sebastian.itch.io/digital-logic-sim
Other
3.5k stars 429 forks source link

Mutiple outputs but not inputs? #17

Closed MrFaul closed 1 year ago

MrFaul commented 3 years ago

I know this is nitpicking but it would be nice to have the ability to connect multiple inputs to a node. Just treat it as a invisible OR, since that is basically twisting wires together anyways xD

This way it is a more consistent sandbox. Also you can start with only a NOT gate to build the first AND gate ;-)

Broken-Admin commented 3 years ago

I feel this would also be beneficial to ease usage in the program.

Fisch37 commented 3 years ago

think that would make the programs less clear to beginners, which would pose a problem

Broken-Admin commented 3 years ago

This feature would still allow for less efficient designs which are easier to understand. But it would also allow better usage by powerusers.

zenMaya commented 3 years ago

Sadly that's not how real logic gates work. You cannot join two wires without an OR gate. There are issues that the current could flow from IN1 to IN2 instead of to OUT1. This is not possible in the REAL WORLD, so it shouldn't be allowed. You always need infinite impedance between inputs. Otherwise nothing would work.

Hope this clears things out!

EDIT: wired-OR actually exists, but it has a major limitations and MUST use diodes on both inputs, otherwise the backflow will happen: https://en.m.wikipedia.org/wiki/Wired_logic_connection

MrFaul commented 3 years ago

This isn't about replicating real world electronics, this is about understanding logic networks. There are countless possibilities to construct logic, be it mechanically, electric or heck even optical. Non of those options have a ideal "NOT" gate (a gate that inverts it's input without additional power) that is possible in a simulation. This is as already mentioned nitpicking since I personally prefer to start at the simplest possible functions the OR and NOT, you can't reduce it further. An AND gate is a function build out of those to functions so having it as a starting point (and building a OR gate with those) doesn't sit well with me.

zenMaya commented 3 years ago

This isn't about replicating real world electronics, this is about understanding logic networks.

It kind of is. Because every simulation software doesn't allow for joining wires together to form "or".

OR isn't the basic logic block. Logic gates are contructed pretty weird in the real world, as they always increase the 1 to be 5V (in TTL), so they are not just one component, rather a small chip with complicated wiring. In boolean logic you have AND, OR, XOR and NOT, so I don't understand why you should specify that "everything is just constructed as OR + NOT". But, you can just provide NAND and contruct other's from it. Imo you should just provide all the basic gates out of the box.

Yes this isn't a real world, but we should follow the practices of the real world. when we join two wires, we need to use OR. That's how all computers work. We don't specify voltage or current, but we design something that you can place on a breadboard, connect to power and inputs and it will just work. Logic flows one way, joining input wires breaks it.

And well this isn't really nitpicking, this is the most easy, yet closest to reality when possible, and I find weird that you want something that is not possible in logic simulation (and is invalid in boolean algebra) but is possible in the real world with some extensive limitations and isn't used in any computer in the world.

Broken-Admin commented 3 years ago

We don't specify voltage or current, but we design something that you can place on a breadboard

Neither do you specify a certain semiconductor doping, or even a specific type of transistor. In computer science it is necessary to abstract past certain concepts.

and isn't used in any computer in the world.

That's quite anecdotal and I highly guarantee there are cases in which using a wired logic connection was or is necessary.

MrFaul commented 3 years ago

Dude, you realize that there are alternatives to semiconductor logic do you? Using relays it is literally twisting wires together for OR and a connection in series for an AND. Where the relay functions as a not gate.

Tell the ancient lift that he can't work without semiconductors thanks God that the damn thing got a PLC last week. 230V logic without modern safety standards is scary 😂 (but runs since 1973 without a hitch)

That said there are enough programs out there that allow multiple inputs and outputs so that argument is invalid.

zenMaya commented 3 years ago

Using relays it is literally twisting wires together for OR and a connection in series for an AND. Where the relay functions as a not gate.

Not true. The problem are not semiconductors. The problem is flow of current from one input to the other. It's more of a electricity thing. You need to ensure that inputs cannot affect each other. You can twist wires, but you need to add diodes to each input. I searched for realy logic examples and this is an example from google:

Relay OR Gate Making an OR gate can be relatively simple. Some people would argue for simply wiring the output of the two buttons together directly to the LED. However, this can lead to the current flowing backwards through your circuit and can cause problems as you develop more sophisticated logic from these building blocks. So I made a simple OR gate using two DPDT relays:relay-OR-gate.jpg

Pretty much why you don't do this. This is not property of semiconductor logic, this is same if you have valves or relays or anything. And that's why I say: don't allow OR with "twisting wires". Especially when it can make some weird side effects like your input to ADDER is sending one to another adders carry even though it shouldn't.

MrFaul commented 3 years ago

Me: talks about not using semiconductors. You: shows a random example with a LED a f-ing semiconductor. On top your example is absolutely awful even for what it's supposed to teach...

Just some background, I'm a BE and engineer for automation for over a decade, tutoring people in exactly this topic for years and currently studying again to add energy systems to my skill list. And you think I don't know what I'm talking about. A guy who has found a awesome tool for teaching and just wants a tiny change to make his tutorial a tiny bit more frictionless.

Honestly that is just cute...

CursedFlames commented 3 years ago

Putting aside the issues of how it works in reality, I think requiring an OR makes it clearer what's going on - allowing multiple inputs to a single node means that an OR is happening implicitly, which obfuscates things slightly. It's a very minor nitpick, but as this seems to be intended as a learning tool, making it clearer is probably a good thing.

zenMaya commented 3 years ago

Me: talks about not using semiconductors. You: shows a random example with a LED a f-ing semiconductor. On top your example is absolutely awful even for what it's supposed to teach...

Just some background, I'm a BE and engineer for automation for over a decade, tutoring people in exactly this topic for years and currently studying again to add energy systems to my skill list. And you think I don't know what I'm talking about. A guy who has found a awesome tool for teaching and just wants a tiny change to make his tutorial a tiny bit more frictionless.

Honestly that is just cute...

Yeah, I'm glad that you started insulting me. I don't need to prove that "I know what I'm talking about".

And by the way, I really wanted to prove me wrong. I want to help to make this tool better, by adding different opinions and discussing them. I won't post in here anymore.

Fisch37 commented 3 years ago

I have a innovative suggestion: We could just cut the arguing here, since this looks like screaming at each other. Good points were made with the relation to reality and how logic systems work. I myself am trained in nothing regarding this, but such a discussion seems more toxic than an actual feature request.

MrFaul commented 3 years ago

Insulting are you kidding me? This was at best a snide remark.

Granted I'm rude but I get seriously triggered when people stating "that is wrong" and then proceed to ignore their own advice. Only shows me that they have no clue or don't care and I'm not sure what triggers me most of those options.

I'm fully aware that you aren't the author of that example and I never said that. Nevertheless you are the one who brought it up, so you need to own up for it since you selected it to make a point.

You are translating your apparently vast knowledge of semiconductors to a different field but that really doesn't translate that well.

CursedFlames made a real good point that it obfuscates and he is right that is the reason why no tool for designing logic networks allows this.

But my point is that this is a sandbox a tool to play and learn and not for production. It has nothing to do how logic is constructed in the real world. It is a "ideal" representation of logic networks. And that is exactly the reason why this should be allowed.

Broken-Admin commented 3 years ago

Please drop the ad hominem if you wouldn't mind.

MrFaul commented 3 years ago

You are right, you are apparently the only level headed person in this discussion. I apologise for the inconvenience.

To recap, my points are simple: It is a sandbox, a tool to play and learn. It has nothing to do with reality since it is a "ideal" representation of the idea. As such it needs to be as unrestricted as possible and start with the minimum of viable parts.

IMO that is the NOT and the ability to freely connect inputs and outputs without any restriction.

MrFaul commented 1 year ago

Well... This didn't age well.

@zenMaya Anyway it appears that my tone was way more aggressive than I realized back then. That wasn't my intention I apologize for that. I was genuin confused why you felt insulted... go figure me 🙄 Most of the time I replied either very early in the morning or very late in the night. Shouldn't do that when the brain isn't fully "booted". (Also you really shouldn't be browsing Amazon or similar in that state... nothing good come from that.)

Oh about the misunderstanding that apparently derailed the conversation: I'm talking about AC relay logic, it is just "energized" and "0V". It is really just parallel and series wiring in that case. We have a proverb in German for that, it translates roughly to: "Didn't see the forest because all the trees are blocking the view" I think that applies here well.

Also @SebLague you marked it as "completed" does that mean it works now?

SebLague commented 1 year ago

Hi @MrFaul, I closed all open issues when I released v1.0, but marking as completed was unintentional. I do appreciate your suggestion of making inputs that are wired together be treated as an invisible OR. I agree it's probably the most intuitive behaviour, and there are certainly many cases in electronics where it is totally valid to do so. However, this tool is primarily being developed for visualizing stuff in my video series, and in that series I plan to talk about push-pull outputs and tri-state logic. For that reason, the new behaviour as of v1.0 is that you are able to join multiple inputs together, but if they're not properly tri-stated and conflicting signals are received, the output will flicker randomly to show that there is an issue.

MrFaul commented 1 year ago

Welp... you marked a lot as completed. Maybe you should note that somewhere that "completed" wasn't intended. Since changing all that is a pain.

Also nice, that works too. Looking forward to your next production 👍