



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




In order to construct a CPU, we need to perform arithmetic and logical operations. Basic arithmetic operator: addition What's involved in adding binary numbers? carry 0 1 1 0 decimal 0 0 1 1 3 0 1 1 0 6 result 1 0 0 1 9 In each column: input: add 2 bits, along with a carry bit from the previous result output: 1 bit result, 1 bit carry Half-adder adds 2 bits ( x, y ), generates sum ( s ) and carry ( c ) (note that previous carry is being ignored)
Truth table Boolean expressions: x y s c 0 0 0 0 s = \xy + x\y = x XOR y 0 1 1 0 c = xy 1 0 1 0 1 1 0 1
s = \xy + x\y = x XOR y c = xy Circuit: Black box:
adding k-bit values ripple-carry adder: combine k 1-bit full adders 3-bit ripple-carry adder
Notice that 0 is hard-wired as carry-in for rightmost full adder (could have used half adder)
Ripple-carry adder is logically correct, but may be slow. Each circuit requires a finite amount of time to give stable outputs when inputs change. Circuits are working in parallel, but it takes a finite amount of time before the carry-in from one circuit is available for the next one to use. Assume time T for each FA to generate output. n-bit ripple carry adder has O(n) delay: nT
Speed can be improved by using "carry-lookahead": compute carries in parallel