Logic Gates & Bitwise Operators Discussion

Archive of the first decade of Off Topic Posts
Locked
User avatar
Blast!10
Rainbow Star
Posts: 1739
Joined: Thu Nov 02, 2006 7:26 pm
Location: New Hampshire

Logic Gates & Bitwise Operators Discussion

Post by Blast!10 » Mon Apr 12, 2010 7:00 pm

In this topic we talk about everything related to logic gates, bitwise operators (AND/OR/XOR/NAND/NOR/XNOR/NOT), boolean algebra and digital electronics. You can give riddles, ask for help, give information, share your circuits and more.

Here's a simple puzzle:

(A AND B) XOR (A AND B) = Z

No variables are defined. What is Z? This puzzle is 100% possible. 8)
Emerald141
Rainbow AllStar
Posts: 4548
Joined: Fri Dec 26, 2008 4:56 pm

Post by Emerald141 » Mon Apr 12, 2010 8:13 pm

It is A and B, but it isn't A and B? I don't understand. *shot*
User avatar
Blast!10
Rainbow Star
Posts: 1739
Joined: Thu Nov 02, 2006 7:26 pm
Location: New Hampshire

Post by Blast!10 » Tue Apr 13, 2010 2:35 pm

Do you know all seven bitwise operators? If not, you won't understand anything in this topic.

Each operator performs a different action on one or two bits (BInary digiTs). Each bit can be either 0 or 1.

A AND B returns 1 only if A and B are both 1. In all other cases it returns 0.
A OR B returns 1 if one or both of the inputs are 1.
A XOR B returns 1 if the two inputs are different.

All operators above have "inverse" counterparts. They are basically the complete opposite.

A NAND B returns 0 only if A and B are both 1. In all other cases it returns 1.
A NOR B returns 0 if one or both of the inputs are 1.
A XNOR B returns 1 if the two inputs are equal.

The NOT operator inverts the input. This operator is used as a logic gate for these lamps that only go on during a power failure - if the power is 1, the lamp is 0. If the power is 0 (failure), the lamp is 1.

Here are the full truth tables, in case you didn't understand the explanations above:

0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1

0 OR 0 = 0
0 OR 1 = 1
1 OR 0 = 1
1 OR 1 = 1

0 XOR 0 = 0
0 XOR 1 = 1
1 XOR 0 = 1
1 XOR 1 = 0

0 NAND 0 = 1
0 NAND 1 = 1
1 NAND 0 = 1
1 NAND 1 = 0

0 NOR 0 = 1
0 NOR 1 = 0
1 NOR 0 = 0
1 NOR 1 = 0

0 XNOR 0 = 1
0 XNOR 1 = 0
1 XNOR 0 = 0
1 XNOR 1 = 1

NOT 0 = 1
NOT 1 = 0

For everyone else, don't get scared by this just because it's algebra. This is actually a much more interesting and far easier form of algebra.

Here's an example of a monster getting reduced to nothing: (each step is in a new line)

{(1 NOR 1) OR [0 NAND (NOT 1 OR 1)]} XNOR {(0 AND 1) XOR [1 AND (0 OR 1)]} =
{(1 NOR 1) OR [0 NAND (0 OR 1)]} XNOR {(0 AND 1) XOR [1 AND (0 OR 1)]} =
{(1 NOR 1) OR [0 NAND 1]} XNOR {(0 AND 1) XOR [1 AND (0 OR 1)]} =
{0 OR 1} XNOR {(0 AND 1) XOR [1 AND (0 OR 1)]} =
{0 OR 1} XNOR {(0 AND 1) XOR [1 AND 1]} =
{0 OR 1} XNOR {0 XOR [1 AND 1]} =
{0 OR 1} XNOR {0 XOR 1} =
1 XNOR {0 XOR 1} =
1 XNOR 1 = 1
User avatar
dlcs18
Rainbow MegaStar
Posts: 3282
Joined: Sun Jul 09, 2006 9:44 pm

Post by dlcs18 » Tue Apr 13, 2010 3:45 pm

Figure out what this equals. :P
((1 and 0) xor (1 xor 1)) or ((1 nand 1) xor (0 xnor 1)) = ?
dlcs18
User avatar
Blast!10
Rainbow Star
Posts: 1739
Joined: Thu Nov 02, 2006 7:26 pm
Location: New Hampshire

Post by Blast!10 » Tue Apr 13, 2010 4:56 pm

It's 0.

(1 and 0) xor (1 xor 1) = (1 nand 1) xor (0 xnor 1) = 0 xor 0.

(0 xor 0) or (0 xor 0) = 0 or 0 = 0.
Locked