170 likes | 188 Views
Create a 4-bit ALU with various operations using Full-Adders, AND/OR/XOR gates, Inverters, and MUX. Operations include addition, subtraction, increment, decrement, multiplication, division, bitwise-AND, and bitwise-OR.
E N D
Design a 4-bit ALU that implements the following set of operations with only the following components (assume 2’s complement number representation, no need to implement overflow circuit) • 1-bit Full-Adders (FA) • 2-input AND/OR/XOR gates • Inverters • 2:1 MUX M2 M1 M0 Function Name F = 0 0 0 Add A + B 0 0 1 Subtract A – B 0 1 0 Increment A + 1 0 1 1 Decrement A – 1 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B
M2 M1 M0 Function Name F = 0 0 0 Add A + B 0 0 1 Subtract A – B 0 1 0 Increment A + 1 0 1 1 Decrement A – 1 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B
M2 M1 M0 Function Name F = 0 0 0 Add A + B 0 0 1 Subtract A – B 0 1 0 Increment A + 1 0 1 1 Decrement A – 1 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = 0 0 0 Add A + B 0 0 1 Subtract A – B 0 1 0 Increment A + 1 0 1 1 Decrement A – 1 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B A * 2 = left-shift e.g. 3 * 2 = “011” * 2 = “110” = 6 A / 2 = right-shift e.g. 3 / 2 = “011” / 2 = “001” = 1 0 1 MUX M1 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = 0 0 0 Add A + B 0 0 1 Subtract A – B 0 1 0 Increment A + 1 0 1 1 Decrement A – 1 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 A * 2 = left-shift e.g. 3 * 2 = “011” * 2 = “110” = 6 0 1 MUX M0 A / 2 = right-shift e.g. 3 / 2 = “011” / 2 = “001” = 1 0 1 MUX M1 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = 0 0 0 Add A + B 0 0 1 Subtract A – B 0 1 0 Increment A + 1 0 1 1 Decrement A – 1 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 0 1 MUX 0 1 MUX M0 M0 0 1 MUX M1 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = 0 0 0 Add A + B 0 0 1 Subtract A – B 0 1 0 Increment A + 1 0 1 1 Decrement A – 1 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 0 1 MUX 0 1 MUX M0 M0 0 1 MUX M1 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = 0 0 0 Add A + B 0 0 1 Subtract A – B 0 1 0 Increment A + 1 0 1 1 Decrement A – 1 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 0 1 MUX 0 1 MUX M0 M0 Ai 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = C0 0 0 0 Add A + B Bi 0 0 0 1 Subtract A – B NOT(Bi) 1 0 1 0 Increment A + 1 “0” 1 0 1 1 Decrement A – 1 “1” 0 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 0 1 MUX 0 1 MUX M0 M0 Ai 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = C0 0 0 0 Add A + B Bi 0 0 0 1 Subtract A – B NOT(Bi) 1 0 1 0 Increment A + 1 “0” 1 0 1 1 Decrement A – 1 “1” 0 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 Bi M0 0 1 MUX 0 1 MUX M0 M0 Ai 0 1 MUX M1 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = C0 0 0 0 Add A + B Bi 0 0 0 1 Subtract A – B NOT(Bi) 1 0 1 0 Increment A + 1 “0” 1 0 1 1 Decrement A – 1 “1” 0 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 Bi M0 0 1 MUX 0 1 MUX M0 M0 Ai 0 1 MUX M1 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = C0 0 0 0 Add A + B Bi 0 0 0 1 Subtract A – B NOT(Bi) 1 0 1 0 Increment A + 1 “0” 1 0 1 1 Decrement A – 1 “1” 0 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 Bi M0 0 1 MUX 0 1 MUX M0 M0 M0 Ai 0 1 MUX M1 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi
M2 M1 M0 Function Name F = C0 0 0 0 Add A + B Bi 0 0 0 1 Subtract A – B NOT(Bi) 1 0 1 0 Increment A + 1 “0” 1 0 1 1 Decrement A – 1 “1” 0 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 Bi M0 0 1 MUX 0 1 MUX M0 M0 M0 Ai 0 1 MUX M1 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi
M1 M0 M2 M1 M0 Function Name F = C0 0 0 0 Add A + B Bi 0 0 0 1 Subtract A – B NOT(Bi) 1 0 1 0 Increment A + 1 “0” 1 0 1 1 Decrement A – 1 “1” 0 C0 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 Bi M0 0 1 MUX 0 1 MUX M0 M0 M0 Ai 0 1 MUX M1 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi
M1 M0 M2 M1 M0 Function Name F = 0 0 0 0 C0 1 1 Ai Bi Ai Bi 1 1 Ai-1 Ai+1 Bi M0 0 1 MUX 0 1 MUX M0 M0 M0 Ai 0 1 MUX M1 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi
M1 M0 M2 M1 M0 Function Name F = 0 0 0 0 C0 1 1 Ai Bi Ai Bi 1 1 0 Bitwise-AND A AND B 1 1 1 Bitwise-OR A OR B Ai-1 Ai+1 Bi M0 0 1 MUX 0 1 MUX M0 M0 M0 Ai 0 1 MUX M1 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi
M1 M0 M2 M1 M0 Function Name F = 0 0 0 0 C0 1 1 0 0 Multiply by 2 A * 2 1 0 1 Divide by 2 A / 2 Ai Bi Ai Bi 1 1 Ai-1 Ai+1 Bi M0 0 1 MUX 0 1 MUX M0 M0 M0 Ai 0 1 MUX M1 0 1 MUX M1 FA Ci+1 Ci 0 1 MUX M2 Fi