0xC0DE - Logic Gates to Microarchitecture
Transistors, along with resistors, capacitors, wires and clock crystals, make up the majority of a computer's CPU (Central Processing Unit) and GPU (Graphics Processing Unit), which are what deal with most of the calculations that a computer needs to do. Perhaps the most important elementary part of a computer is the transistor. The reason why I say this is that transistors are what actually do all of these complex calculations, while all of the other components just "help" the transistor.
In simple words, a transistor is a special kind of electrical switch, which does something to an input based on the state of the "switch". This "switch", or gate, is controlled by either sending voltage down the gate, or not.
In most modern digital circuits, a specific type of transistor is used, called a MOSFET. In a MOSFET (metal-oxide-semiconductor field-effect transistor), the "input", or where the electrons come from, is called the Source (S), the "output", or where the electrons exit, is the Drain (D), and what controls the output is the Gate (G).
There are two main forms of a MOSFET transistor: the NMOS (Negative-MOS) and PMOS (Positive-MOS) transistors.
In NMOS, when 0, or close to 0 voltage enters the source, the drain outputs a high voltage. When a high voltage is applied, a negligible voltage comes out of the drain.
In PMOS, when 0, or close to 0 voltage enters the source, the drain outputs a negligible voltage. When a high voltage is applied, a high voltage comes out of the drain.
Together, NMOS and PMOS transistors are used to create what are called "Logic Gates".
There are many different types of logic gates. The truth tables for some of them are listed below:
These logic gates in turn can create more complex systems, such as half-adders and full-adders as shown below: