Jump to content

Four bit adder: Difference between revisions

→‎{{header|C}}: xor operator will work correctly on two one-bit operands
m (moved Four bits adder to Four bit adder: The phrase is without the s. I'm in the chip design & verification field and use the phrase regularly. (Or just http://www.googlefight.com/index.php?lang=en_GB&word1=%22bits+adder%22&word2=%22bit+adder)
(→‎{{header|C}}: xor operator will work correctly on two one-bit operands)
Line 29:
 
#define NOT(X) (~(X)&0x01)
#define XOR(X,Y) ((NOT(X)&(Y)) | ((X)&NOT(Y)))
 
void halfadder(IN a, IN b, OUT s, OUT c)
{
V(s) = XOR(V(a), ^ V(b));
V(c) = V(a) & V(b);
}
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.