Half Adder

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

I need to write some C code that implements a "half adder". Looking at the [URL=http://en.wikipedia.org/wiki/Adder_(electronics)#Half_adder]wikipedia page[/URL], it looks fairly straight forward. But what I don't get is where it tells you how to get the sum.

sum = a (+) b

What's that circle with a plus in it? I don't even know what it's called so I can't google it.

Quote: Essentially the output of a half adder is the sum of two one-bit numbers, with C being the most significant of these two outputs.

Does that mean the "sum" is just the biggest number out of the set?

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

That symbol is for bitwise XOR (exclusive OR).

Quote: S is the two-bit XOR of A and B, and C is the AND of A and B.

teammatt3;215473 wrote:

Quote: Essentially the output of a half adder is the sum of two one-bit numbers, with C being the most significant of these two outputs.

Does that mean the "sum" is just the biggest number out of the set?

Not quite. It means there are two outputs, C and S. C is the leftmost digit (most significant) and S is the rightmost digit (least significant).

Significance refers to place value of a digit. The digit 1 in 51 is less significant than the digit 1 in 190. In 25, 2 is more significant than 5. (Assuming big-endianness.)

Smiling

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

You're the man Abhishek. Thanks!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.