<p style="font-size: 14px;text-align:center"> The Islamic University of Gaza </p> <p style="font-size: 14px;text-align:center"> Computer Architecture Lab - 2023 </p> <p style="color:#000033;font-weight: bold;text-align:center"> LAB (2) || Arithmetic Logic Unit </p> <p style="text-align:right"> Eng: Amal I. Mahfouz , Eng: Hassan Sammour </p> <p style="font-size:20px;color:#000066;font-weight: bold;"> Objective </p> 1. Understanding behavior of arithmetic logic unit from working module and the module designed by the student as part of the experiment. 2. Designing an arithmetic logic unit for given parameter. --- <p style="font-size:20px;color:#000066;font-weight: bold;"> What is an arithmetic-logic unit (ALU)? </p> An arithmetic-logic unit is the part of a central processing unit that carries out arithmetic and logic operations on the operands in computer instruction words. In some processors, the ALU is divided into two units: an arithmetic unit (AU) and a logic unit (LU). --- <p style="font-size:20px;color:#000066;font-weight: bold;"> How does an arithmetic-logic unit work? </p> Typically, the ALU has direct input and output access to the processor controller, main memory (random access memory or RAM in a personal computer) and input/output devices. Inputs and outputs flow along an electronic path that is called a bus. --- <p style="font-size:20px;color:#000066;font-weight: bold;"> What type of functions do ALUs support? </p> In computer science, ALUs serve as a combinational digital circuit that performs arithmetic and bitwise operations on binary numbers ![](https://i.imgur.com/uZGNWIf.png) A 1-bit ALU Operation: - Operation = 00 implies AND - Operation = 01 implies OR - Operation = 10 implies ADD ![](https://i.imgur.com/8jfx1Vw.png) ![](https://i.imgur.com/2Imxs99.png) :small_blue_diamond: Understand how this circuit works. :small_blue_diamond: Let us add one more input to the mux to implement slt when the Operation = 11 --- <p style="font-size:20px;color:#000066;font-weight: bold;"> Converting an adder into a subtraction: </p> A - B (here - means arithmetic subtraction) = A + 2’s complement of B = A + 1’s complement of B + 1 ![](https://i.imgur.com/uc9VQIe.png) *__For subtraction, B invert = 1 and Carry in = 1__* --- ### 1-bit ALU for MIPS: Assume that it has the instructions add, sub, and, or, slt. ![](https://i.imgur.com/H6b7As9.png) Less = 1 if the 32-bit number A is less than the 32-bit number B. We now implement slt (If A < B then Set = 1 else Set = 0) ![](https://i.imgur.com/cGAaVMj.png) --- ### Test plan: - Set inputs 0101 and 0011 and check output for all possible select input combinations. - Set any two 16-bit number and check output for all possible select input combinations. Use Display units for checking output. Try to use minimum number of components to build. The pin configuration of the canned components are shown when mouse hovered over a component. --- <div style="page-break-after: always;"></div> <p style="font-size:20px;color:#000066;font-weight: bold;"> Assignment Statements </p> 1. Design a 4 bit ALU comprising only the AND, OR, NOR and Add operations. 2. Design a 16-bit ALU with capabilities similar to 74181. By using Logisim.