150 likes | 416 Views
IKI10201 05b-Arithmetic Logic Unit (ALU). Bobby Nazief Semester-I 2005 - 2006. The materials on these slides are adopted from: CS231’s Lecture Notes at UIUC, which is derived from Howard Huang’s work and developed by Jeff Carlyle;
E N D
IKI10201 05b-Arithmetic Logic Unit (ALU) Bobby Nazief Semester-I 2005 - 2006 • The materials on these slides are adopted from: • CS231’s Lecture Notes at UIUC, which is derived from Howard Huang’s work and developed by Jeff Carlyle; • Prof. Daniel Gajski’s transparency for Principles of Digital Design.
Adders/Subractors: Arithmetic Unit • When Sub = 0, the XOR gates output B3 B2 B1 B0 and the carry in is 0. The adder output will be A + B + 0, or just A + B. • When Sub = 1, the XOR gates output B3’ B2’ B1’ B0’ and the carry in is 1. Thus, the adder output will be a two’s complement subtraction, A - B. • Arithmetic Unit that is capable to do addition & subtraction can be constructed using Full Adders.
Logical Unit • In addtion to arithmetic operations, most computers also support logical operations like AND, OR and NOT, but extended to multi-bit words instead of just single bits. • To apply a logical operation to two words X and Y, apply the operation on each pair of bits Xi and Yi: 1011 AND 1110 1010 1011 OR 1110 1111 1011 XOR 1110 0101
Defining a logic unit • Boolean functions of 2 variables have 2 inputs, 1 output, and 4 minterms • We can generate 16 Boolean functions using 4 (select) variables: the Truth Table: • Boolean Functions: • AND f8 values of select variables S3S2S1S0 = 1000 • OR f14 values of select variables S3S2S1S0 = 1110 • ...
Arithmetic-Logic Units (ALUs) • An arithmetic-logic unit, or ALU, performs manydifferentarithmeticandlogicoperations. The ALU is the “heart” of a processor—you could say that everything else in the CPU is there to support the ALU.
One of ALU structures • AE = Arithmetic Extender (Add, Sub, Inc, Dec) • LE = Logic Extender (AND, OR, PASS, NOT)
Additional variables for AE & LE • M: select arithmetic or logic operations • M = 1 ALU will perform arithmetic operation • M = 0 ALU will perform logic operation • S1 & S0: once arithmetic or logic operations has been selected, these 2 variable will select specific operations to be performed by ALU • M = 1 S1 & S0 will select one of Add, Sub, Inc, Dec • M = 0 S1 & S0 will select one of AND, OR, PASS, NOT
Arithmetic Extender • Functional Table: • Implementation: LE’s requirement
Logic Extender • Functional Table: • Truth Table: Conforms with AE’s output satisfy AE
Logic Extender (cont.) • Map & Implementation:
The ALU • If M = 1, then • Xi = ai, Yi = A(bi), c0 = S1 • If M = 0, then • Xi = L(ai,bi), Yi = 0, c0 = 0
ALU’s summary • This ALU is a good example of hierarchical design. • With the 12 inputs, the truth table would have had 212 = 4096 lines. That’s an awful lot of paper. • Instead, we were able to re-use components that we’ve seen before to construct the entire circuit from a couple of easy-to-understand components. • As always, we encapsulate the complete circuit in a “black box” so we can reuse it in fancier circuits.