and / or Assembly Commands

Started by doomkaiber001, November 26, 2010, 05:29:45 PM

Previous topic - Next topic

doomkaiber001

Thanks... So where do you use NOT anyway?

Romaap

Quote from: dcx2 on November 30, 2010, 07:01:31 PM
Quote from: doomkaiber001 on November 30, 2010, 06:17:36 AM
De Morgans law. I've looked it up, and this is what I've found;

(A & B) C'      then becomes
A' | B' & C'


De Morgan's is, roughly,

!A & !B == !(A | B)

Where ! is the NOT operator, & is the AND operator, | is the OR operator, and == means they're logically equivalent.

Think of it like words.  " if it is (not rainy) and (not sunny), then it is not (rainy or sunny)"
Also this:

!A | !B == !(A & B)

So in words: " if it is (not rainy) or (not sunny), then it is not (rainy and sunny)"


Quote from: doomkaiber001 on November 30, 2010, 07:06:17 PM
Thanks... So where do you use NOT anyway?

NOT is used to tell that something is the opposite of something. (true becomes false and false becomes true)
Or did I misunderstood your question?

doomkaiber001

You answered part of the question :) . The other part is what I could use it for.

dcx2

It's hard to just explain when you need something like that.  It's more like...you should understand what a unary operator is, as opposed to a binary operator.  Or ternary operator, but there aren't very many of those!  It's a concept that is used elsewhere as a building block.  For instance, there's a NAND operation; NOT AND.  !(A&B)  It flips the output of the truth table for an AND.  (BTW, we typically use Q for output)

A B Q = NAND
0 0 1
0 1 1
1 0 1
1 1 0

NAND is very important with computers because you can make any operation out of NAND gates and it's very easy to make bits of silicon calculate NAND operations.

doomkaiber001

Oh, so does not (if in a truth table with or) only when there is a zero;

A  B  C
0  0  1
0  1  1
1  0  1
1  1  0

dcx2

NOT is a unary operator.  That is, it takes *one* operand, and inverts it, and makes it the output.

NOT A = Q

A Q
0 1
1 0

AND, OR, XOR, NAND, etc are binary operators.  They take *two* operands.

A AND B = Q

A B Q
0 0 0
0 1 0
1 0 0
1 1 1

In some higher level programming languages, there is also a ternary operator that takes three operands.  But they're rarely used.

Here, use this digital logic page.  It has pretty pictures you can click on to make it do stuff.

http://www.play-hookey.com/digital/basic_gates.html

http://www.play-hookey.com/digital/derived_gates.html

doomkaiber001

#21
Oh! So its the opposite of that it would usually become? It's Inverted!