Logic circuits are responsible for arithmetic operations in a computer. All numbers are converted to binary for the logic circuit to work. A binary number is a number system that consists only of the numbers '1' and '0'.
In general, the number '1' logically means 'true' and means that current is flowing in the circuit, and the number '0' means 'false' and means that there is no current flowing in the circuit.
The logic circuit of a computer is made up of many logic elements called logic gates. Representative logic gates include AND, OR, NOT, NAND, NOR, XOR, and XNOR gates. Logic gates use the switching action of transistors.
The above simulation shows AND, OR, and NOT gate circuits, respectively.
In the AND gate, two transistors are connected in series, and current flows to the output terminal only when current flows through the bases of both transistors. That is, the output becomes '1' only when both inputs are '1'.
An OR gate is two transistors connected in parallel, and when a current flows to the base in either of the two transistors, a current flows to the output terminal. That is, if only one of the two inputs is '1', the output becomes '1'.
The NOT gate uses the switching function of the transistor in reverse. When current flows through the base of the transistor, no current flows through the output terminal. Conversely, when no current flows through the base, current flows through the output terminal. In other words, it outputs the opposite value to the input.