 Classic List Threaded 6 messages Open this post in threaded view
|

 Im not sure what the carry is supposed to be for a 16 bit adder. the textbook says overflow is neither detected nor handled, does that mean that carry is NULL everytime? or is carry one of the inputs in the next add?
Open this post in threaded view
|

 Carry and overflow are two separate things. Consider adding the two numbers 333 + 999 by hand. In the rightmost column (least significant digits) we add 9 and 3 to get 12, and "1" is the carry into the next column. To get the next column's sum, we add 9 and 3 plus the carry, to get 13, etc. When the book states that we're going to ignore overflow, it means that we don't have to do anything with the carry result of the most significant digits.
Open this post in threaded view
|

 Administrator In reply to this post by dmoeller Add16 implements 16-bit binary addition. This works similarly to ordinary decimal addition: ``` 1 1 4567 + 1825 ------ 6392 ```In binary, the carry into the adder for bit 0 is always 0. In fact, you can save a little hardware by using a half adder for bit 0. The carry into all other bits n is the carry output from the bit n-1 adder. Since you are generating a 16-bit result, the carry output from the bit 15 adder is discarded. --Mark
Open this post in threaded view
|

 So, use a half adder for bit 0, full adder for bits 1-15.  Should the carry of the last call to full adder be null? FullAdder (.... sum=sum carry=NULL) ? or just ..... sum=sum carry=W0 and have W0 go nowhere?