In electronics a logic gate is a physical block of digital circuits. These devices are used in computers to perform different calculations. There are AND gates, XOR gates, NAND gates, NOR gates, XNOR gates, EOR gates, NOT gates, etc.. In this article I will talk about the OR gate.
How to build a OR logic gate
Have two currents in parallel, and two transistors (A) and (B) and an output.
If the current is flowing (meaning the computer is on and has power), then that current can only flow to the output if either (A) transistor or (B) transistor is on. If both transistors are off, then no current can flow and therefore no current will go to the output. In computers if the output has a current (sometimes specifically high) then we equate that to the symbol “1”, if the output has no current (sometimes specifically low) then we equate that to the symbol “0”. Now we can abstract this to another layer of just a box with two inputs (A) and (B) and a single output where “1” means the transistor is on, and 0 means the transistor is off.
How does the OR Logic gate work ?
If the transistor A is on meaning it equals 1, then the current flows through and the output equals 1. If the transistor B is on meaning it equals 1, then the current flows through and the output equals 1. If both transistors are off meaning A and B equal 0 then the output equals 0 (meaning no current). We can look at this in something called a truth table.
To get the resulting value in the Truth Table all we have to do is something called Boolean addition. Boolean is a word named after a mathematician George Boole who invented Boolean algebra. Since there can only be two symbols (0) and (1) the addition works as follows:
→ 0 + 0 = 0
→ 0 + 1 = 1
→ 1 + 0 = 1
→ 1 + 1 = 1 (That’s the weird part)
We can think of this now as A+B= Output to create our Truth Table. So you may be wondering why we called this a Truth Table when clearly we are using only binary numbers (0) and (1). Well we can think of 1 to be equal to True (T) and we can think of 0 to be equal to False (F). Using the same Boolean addition logic let’s make a few statements.
A= If it’s Sunny today I will visit randerson112358 YouTube channel
B= If it’s cold today I will visit randerson112358 YouTube channel
Now let’s rewrite the above statements using ‘OR’ (A OR B).
If it’s Sunny today I will visit randerson112358 YouTube channel or f it’s cold today I will share this article. Well today it was cloudy not sunny and the temperature got pretty cold, so this means the first statement is FALSE, it wasn’t Sunny, but the second statement is TRUE it was cold so it looks like I (You) will visit randerson112358 YouTube channel ! (Crossing my fingers ).
But seriously you can see that we have A=0, and B=1 our output or current is “I will visit randerson112358 YouTube channel”.
Check out some of my videos and content on Computer Science Topics:
Video Tutorials on Recurrence Relation: