Computing help CPT4

Associate
Joined
11 Apr 2006
Posts
1,858
Location
London
I've looked all through my notes and searched on google and cannot find the binary Add, and, or, xor rules. I know add. eg 10+11=101 Can anyone help with and, or and xor. Or a link if they have better luck searching.
 
and 11 + 01 = 100 , straight binary and
or 11 + 01 = 11 , if a bit is set to one then that bit in answer is 1
xor 11 + 01 = 10 , bit in answer is set ONLY if bits are different


//edit// if using a adder for the And otherwise as below
 
Last edited:
0 AND 0 = 0 0 OR 0 = 0
0 AND 1 = 0 0 OR 1 = 1
1 AND 0 = 0 1 OR 0 = 1
1 AND 1 = 1 1 OR 1 = 1

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

Edit: Ah you mean like that (See above).
 
Have a look at this:
http://en.wikipedia.org/wiki/Binary_arithmetic

AND and XOR are very simple operations; you simply go through each bit and compare them. For an AND operation, the resultant bit is 1 if both operand bits are 1, 0 if otherwise. For XOR operation, the resultant bit is 1 if only one operand bit is 1. If either both are 0 or both are 1, the resultant bit is 0.

Edit: beaten, and with truth tables :p
 
Back
Top Bottom