2P12 Lab 3
2P12 Lab 3
Building an ALU
Welcome Back. In this lab we will replicate what was done in class. The goal is to create a functional 4 Bit ALU with
5 functions, ADD, SUB, NOT, AND, OR. We will build it in functional units.
Part 1.
Part 2
Before we can create an ALU we need to create a component called a 3 to 8 decoder. This will be used to select
the functions of our ALU. In terms of tedious this implementation rings all the bells. One AND gate will become
active for each unique 3-bit input. Once you have created the decoder, put it into a test circuit to ensure it does
what it was intended to do. This is very similar to debugging code, write a little code, write a small test method. DO
NOT PROCEED UNTIL IT WORKS.
Page 1
Part 3.
Here is a 1-bit ALU with all 5 functions implemented. There are 3 main units to this ALU: the adder, the OR section
and the AND section. The ADDER implements 1) A ADD B, 2) B SUB A, and 3) NOT A. Note: B must be set to 0 for
NOT A to function Properly. Notice that the decoder generates the appropriate functions for each. The XOR on the
input to A will provide the bit inversion for SUB and NOT. The AND gate exiting the ADDER acts as an ON/OFF
switch and is enabled in the on position when any of the 3 above functions are selected. 4) and 5) the AND and OR
functions are implemented as parallel functions, both connecting to the A and B inputs. The AND gates on their
outputs are switches which are enabled appropriately depending on which function we want. When you package
the ALU do so as below, this makes the next part much cleaner. You can select which side of the chip the pins
appear on.
Part 4
Page 2