11-ALU - Arithmetic-logic units An arithmetic-logic unit,...

This preview shows pages 1–8. Sign up to view the full content.

Arithmetic-logic units 1 Arithmetic-logic units An arithmetic-logic unit, or ALU, performs many different arithmetic and logic operations. The ALU is the “heart” of a processor—you could say that everything else in the CPU is there to support the ALU. Here’s the plan: We’ll show an arithmetic unit first, by building off ideas from the adder-subtractor circuit. Then we’ll talk about logic operations a bit, and build a logic unit. Finally, we put these pieces together using multiplexers. We show the same examples as from the book (pp. 360-365), but things are re-labeled to be clearer in LogicWorks. C in and S 0 are also treated a little differently.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Arithmetic-logic units 2 The four-bit adder The basic four-bit adder always computes S = A + B + CI . But by changing what goes into the adder inputs A, B and CI, we can change the adder output S. This is also what we did to build the combined adder-subtractor circuit.
Arithmetic-logic units 3 It’s the adder-subtractor again! Here the signal Sub and some XOR gates alter the adder inputs. When Sub = 0 , the adder inputs A, B, CI are Y, X, 0, so the adder produces G = X + Y + 0, or just X + Y . When Sub = 1 , the adder inputs are Y’, X and 1, so the adder output is G = X + Y’ + 1, or the two’s complement operation X - Y .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Arithmetic-logic units 4 The multi-talented adder So we have one adder performing two separate functions. “Sub” acts like a function select input which determines whether the circuit performs addition or subtraction. Circuit-wise, all “Sub” does is modify the adder’s inputs A and CI.
Arithmetic-logic units 5 Modifying the adder inputs By following the same approach, we can use an adder to compute other functions as well. We just have to figure out which functions we want, and then put the right circuitry into the “Input Logic” box .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Arithmetic-logic units 6 Some more possible functions We already saw how to set adder inputs A, B and CI to compute either X + Y or X - Y. How can we produce the increment function G = X + 1? How about decrement: G = X - 1? How about transfer: G = X? (This can be useful.) This is almost the same as the increment function! One way: Set A = 0000, B = X, and CI = 1 A = 1111 (-1), B = X, CI = 0 A = 0000, B = X, CI = 0
Arithmetic-logic units 7 The role of CI The transfer and increment operations have the same A and B inputs, and differ only in the CI input. In general we can get additional functions (not all of them useful) by

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/19/2011 for the course CS 231 taught by Professor - during the Spring '08 term at University of Illinois at Urbana–Champaign.

Page1 / 24

11-ALU - Arithmetic-logic units An arithmetic-logic unit,...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online