How do logic gates calculate their output?

3.60K views

Do transistors calculate the output? If so, wouldn’t transistors be the most fundamental logic of computers?

Thanks.

In: Technology

12 Answers

Anonymous 0 Comments

It’s like playing red rover and keeping score. When a player breaks through, it’s a 1. When a player doesn’t, it’s still 0. Each turn you add up the score and that’s your output.

Transistors have no logic though. They’re simply in a simple state of yes, no, or maybe. They *enable* logic by storing states, but they themselves are simply flag posts: the CPU turns it into logic via binary and higher level code.

Anonymous 0 Comments

I would say yes, transistors are the **most basic** fundamental building blocks of electronics.

They are usually constructed of pure silicon or a mix with germanium, both with semiconductor properties. A semiconductor is a material that has conductive properties between those of a conductor and an insulator. This means that regions of a semiconductor material can be “doped” — the creation of impurities in the silicon wafer.

In short, adjacent differently-doped regions can form “p-n junctions” (p for positive, n for negative). The positive side will lack electrons (as electrons are negative, an absence is represented as positive), while the negative side will have an abundance of electrons. Because of the potential to fill the empty electron positions in the positive side, electrons flow from the negative to the positive side — one direction only. This is, essentially, a diode. A common transistor consists of either a PNP or NPN junction.

A transistor is simply a “digital switch”. They have “terminals” for power (think of a battery) and one input. If this input is used, electricity will flow. Otherwise, the internal circuit will not complete, and no electricity will be outputted.

To create logic gates, the outputs of some transistors are tied to the inputs/power of others.

Anonymous 0 Comments

Transistors do ultimately calculate the output. It would be fair to say they are the most fundamental logic element in a computer.

Using methods described by other people ITT you can build basic gates like OR, AND, NOR, NAND, XOR, etc. The next step is to chain multiple gates together to come up with something more useful. You can implement a lot of surprisingly complex calculations by doing this. Addition, subtraction, multiplication, and a lot more are possible using only basic logic gates. This is called combinational logic.

To take it to the next level you need *sequential* logic. You use a *flip flop* (which itself can be implemented using transistors) to store the output of one calculation. Then you can feed that output into another combinational circuit to do the next step of your calculation. This allows you to chain multiple calculations together. That’s essentially what a program is. A list of operations which are calculated sequentially.

Anonymous 0 Comments

[I can’t believe this hasn’t been posted yet. It is Matt Parker(not South Park) showing logic gates with dominoes.](https://youtu.be/lNuPy-r1GuQ)

Anonymous 0 Comments

You can make some gates with just diodes, but you’d need a transistor to get the voltage back up near the input voltage.

For example diodes in parallel, plus a resistor can make an OR gate or an AND gate. A transistor and a resistor can make an inverter. An AND gate and an inverter is a NAND gate. NAND gates can be used to make all the other gates.

Anonymous 0 Comments

If you’re interested, I highly recommend trying this online game: http://nandgame.com/

You start with a nand gate, and combine them for form new gates, and eventually create a basic working CPU (in a digital sandbox).

Anonymous 0 Comments

I would highly recommend checking out Ben Eater’s channel on YouTube. He has great videos that explain how computer hardware works, and he does so by building them out on a breadboard, accompanied by diagrams, etc.

For your particular question, his 13 minute video ‘Making Logic Gates From Transistors’ (https://youtu.be/sTu3LwpF6XI) takes you through each logic gate in a simple to follow format, and he builds them out with transistors.

Other videos of his include building a basic 8-bit computer, RAM modules, and even a video card from scratch with explanations. He’s also now selling kits so you can follow along with his builds.

Anonymous 0 Comments

A transistor basically has three connections. Input. Control. Output. (This isnt totally correct but works for this purpose)

The input can be a very large amount of electrons compared to the control. So the control is used to tell the transistor that it is ok to switch on and pass that high power from the input to the output.
They can also take that control input and instead use the transistor to amplify and output the amplified control signal. By varying how they are used and connected you can create very complicated computational “chips.”

A transistor needs to have an input in able to produce an output.

In the old days you needed almost 5 volts for the transistors to switch. Now I’m sure that is much smaller. But that’s there 1 and 0 came from 1 being on or 5 volts and 0 being off or anything below 5 volts.

In electronics when we used to troubleshoot at board level we would have a schematic that we could follow and understand. Using calculations and by measuring various points for the high and low we could find the problem if say a 1 bit was only 3.2 volts.

Once you understand the basics of electronics, computer programming becomes a hell of a lot easier and makes sense.

Anonymous 0 Comments

Let’s define a transistor as a 3 pin device that uses a signal at one pin to control the current flowing between the other two pins. In digital electronics that control signal would either be 1 or 0. With multiple transistors we can connect the transistors in such a way that only certain combinations of inputs at the control pins will allow current to flow through the load. I recommend looking up CMOS gate circuits to get a better picture of how this works.

Anonymous 0 Comments

To understand computers you have to understand that everything is built upon layers and layers (and layers and layers) of abstraction. Just like a computer language like C is an abstraction of a more low level form like Assembly (which is itself an abstraction of the pure binary), logic gates are an abstraction of groups of transistors that together do a simple operation.

So, if I’m going to design a circuit that adds two numbers together, yes I could go down to the very lowest level and map out every circuit and transistor involved, but doing so would be complicated and difficult to troubleshoot. Sticking an abstraction layer of logic gates in there makes it a much more human tractable problem.

In reality a ton of chip design is done by computers these days with even higher level abstractions on top for human readability and input. Verilog for instance more closely resembles computer code than what you might expect chip design to look like.

But none of that is a very good ELI5, so let me try again.

Logic gates are like Lego blocks, the simple old fashioned ones. You **could** build the exact same models out of only flat Lego pieces and not using blocks at all, just stick the flat plates together until you get the shape of the larger blocks. But no one would want to do that, it would be tedious and you’d likely mess it up somewhere along the line. If you really had to build a whole set out of only flat pieces, you’d probably start by putting flat pieces together into the shape of the larger more friendly blocks that the instructions actually call for.

Transistors are the flat pieces, by themselves it doesn’t look possible to make much interesting out of them. But when you think about a collection of flat pieces as a bigger block it’s easier to imagine making a huge castle from them.

So what’s more fundamental, the shapes that people build with every day or the shapes that deep down make up those shapes? It’s just a matter of semantics.