Download Arithmetic Logic Units: Understanding ALUs and Their Role in Computer Systems and more Study notes Engineering in PDF only on Docsity! ENGIN112 L33: Arithmetic Logic Units November 21, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 33 Arithmetic Logic Unit (ALU) ENGIN112 L33: Arithmetic Logic Units November 21, 2003 Overview °Main computation unit in most computer systems °ALUs perform a vaiety of different functions •Add, subtract, OR, AND… °Example: ALU chip (74LS382) •Has data and control inputs °Individual chips can be chained together to make larger ALUs °ALUs are important parts of datapaths •ROMs often are usd in the control path °Build a data and control path ENGIN112 L33: Arithmetic Logic Units November 21, 2003 ALU Integrated Circuit °Integrated circuit –off-the-shelf components °Examine the functionality of this ALU chip Performs 8 functions ENGIN112 L33: Arithmetic Logic Units November 21, 2003 Example °Determine the 74HC382 ALU outputs for the following inputs: S2S1S0=010, A3A2A1A0=0100, B3B2B1B0=0001, and CN=1. •Function code indicates subtract •0100 –0001 = 0011 °Change the select code to 101 and repeat. •Function code indicates OR •0100 OR 0001 = 0101 ALUFunction Conditions DataA DataB DataOut Synchronize ALU with a clock ENGIN112 L33: Arithmetic Logic Units November 21, 2003 Expanding the ALU °Multi-bit ALU created by connecting carry output of low-order chip to carry in of high order Eight-bit ALU formed from 2 four-bit ALUs ENGIN112 L33: Arithmetic Logic Units November 21, 2003 Using a Datapath ° Consider the following computation steps 1. ADD A, B and put result in A 2. Subtract A, B and put result in B 3. OR A, B put result in A • Repeat starting from step 1 Determine values for Function, LoadA, LoadB Function A B LoadBLoadA ALU ENGIN112 L33: Arithmetic Logic Units November 21, 2003 Modeling Control as a State Machine ° Consider the following computation steps 1. ADD A, B and put result in A 2. Subtract A, B and put result in B 3. OR A, B put result in A • Repeat starting from step 1 Determine values for Function, LoadA, LoadB S0 S1 S2 Model control as a state machine. Determine control outputs for each state ENGIN112 L33: Arithmetic Logic Units November 21, 2003 Modeling Control as a State Machine ° Consider the following computation steps 1. ADD A, B and put result in A 2. Subtract A, B and put result in B 3. OR A, B put result in A • Repeat starting from step 1 States S0 = 00 S1 = 01 S2 = 10 Present State Next State Function LoadA LoadB 00 01 011 1 0 01 10 010 0 1 10 00 101 1 0 We know how to implement this using an SOP. Can we use a ROM? ENGIN112 L33: Arithmetic Logic Units November 21, 2003 What if we replaced the ROM with RAM? PS NS 0101110 1001001 0010110 00 01 10 RAM Function LoadA A B LoadB ALU 3 Possible to implement different functions! Program the RAM to perform different sequences Looks like software! ENGIN112 L33: Arithmetic Logic Units November 21, 2003 Summary °ALU circuit can perform many functions •Combinational circuit °ALU chips can be combined together to form larger ALU chips •Remember to connect carry out to carry in °ALUs form the basis of datapaths °ROMs can form the basis of control paths °Combine the two together to build a computing circuit °Next time: more data and control paths