IKI b-Arithmetic Logic Unit (ALU) Bobby Nazief Semester-I 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 X i and Y i : 1011 AND OR XOR
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 f 8 values of select variables S 3 S 2 S 1 S 0 = 1000 – OR f 14 values of select variables S 3 S 2 S 1 S 0 = 1110 –...
Logic unit implementation
Arithmetic-Logic Units (ALUs) 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.
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 S 1 & S 0 : once arithmetic or logic operations has been selected, these 2 variable will select specific operations to be performed by ALU – M = 1 S 1 & S 0 will select one of Add, Sub, Inc, Dec – M = 0 S 1 & S 0 will select one of AND, OR, PASS, NOT
Arithmetic Extender Functional Table: Implementation: LE’s requirement
Logic Extender Functional Table: Truth Table: satisfy AE Conforms with AE’s output
Logic Extender (cont.) Map & Implementation:
The ALU If M = 1, then – X i = a i, Y i = A(b i ), c 0 = S 1 If M = 0, then – X i = L(a i,b i ), Y i = 0, c 0 = 0
ALU function table
ALU’s summary This ALU is a good example of hierarchical design. – With the 12 inputs, the truth table would have had 2 12 = 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.