Lab 12 A 4-bit ALU

In this experiment, you will design and build an Arithmetic Logic Unit, which is at the heart of any computer system. A block diagram for the circuit is shown below. The ALU uses the register file from lab 11 as its "on-board" memory, and is capable of performing a variety of logical and arithmetic functions. In each case, the ALU takes up to two 4-bit inputs, and produes a single 4-bit output. The particular function implemented by the chip is selected by the 6 input lines shown on the left of the ALU block in the figure. The remainder of the circuitry is responsible for accessing the register addresses, providing the proper inputs to the ALU, and displaying the input and output.

Part I: Preliminary Considerations

  1. Examine the block diagram for the ALU. Describe the purposes of the MUX and 4-bit latch components.

  2. Draw a design for the 4-bit latch using 4 D flip-flops and no gates.

  3. Read the data sheet for the 74LS181 ALU chip in your laboratory manual.

    1. Make sure you understand how to manipulate the control inputs M,Cn, and S0-S3 to implement the various arithmetic operations and logic functions.

    2. Examine Figures 1 and 2 of the data sheet. The 182 components shown in these figures are used when combining the outputs of several 181 ALU's to produce an 8-bit or 16-bit ALU. We will not be using the 182 chip in this lab.

    3. Compare Figures 1 and 2, as well as Tables 1 and 2 on the data sheet. What is the difference between the signal designations shown in Figures 1 and 2? Considering the associated tables, does it make any difference whether one assumes the signal designations in Figure 1 or Figure 2? Why or why not?

  4. Assume that you have built the circuit shown in the figure, and that the register file is initially empty. Describe in detail the steps necessary to add two numbers. The addends must be stored in two addresses of the register prior to addition, and the sum must be stored in a third address. Show your list of steps to the lab instructor or a TA before proceeding.

Part II: MAX+plus II Simulation

  1. Implement your design for the 4-bit latch in MaxPlus. Run a simulation to test the latch, then print copies of the schematic and test waveform.

  2. Use the Graphic Editor to design the circuit shown in the figure. You can build on the 4 x 4 register circuit form Lab 11, or start from scratch.

    1. Note that CLEAR inputs for the two counters and the latch (as well as several other input signals) are not shown in the figure, but will be necessary in your Graphic editor schematic.

    2. Also note that the following ALU outputs will not be used: AEQB, CN4, GN, and PN. Because the carry outputs are unused, all arithmetic operations will be performed modulo 16.

    3. When you have completed your schematic, prepare a list of all the signals (i.e., labled nets) in your circuit. Write a description of each signal.

  3. Use the Waveform Editor and Simulator to simulate 4 different operations, 2 logical and 2 arithmetic, each on unique data. In each case, the operands should be loaded into separate register addresses prior to performing the operation, and the result should be stored in a third address.

    1. Prepare a vector file to initialize the circuit and implement the operations. All four operations should be included in a single vector file. Add plenty of comments to this file so that the purpose of each group of commands is clearly stated.

    2. Important: In order to properly initialize the ALU, both the A and B inputs must have valid data (no X's). If either the A or the B input is undefined (X), then the output will also be undefined, regardless of which function you select. Ask for help if you have trouble with this.

    3. Run the Simulator using your schematic and your vector file, showing the implementation of your four operations. Group signals as much as possible to make your waveform display easier to interpret. You should depict all signals that are relevant to the operation of the circuit.

  4. Write a vector file to add four hex digits, and store the result in one of the registers.  At the end of this operation, three of the four operands must be stored in registers, and the fourth register will contain the sum.  One (and only one) of the four operands will be overwritten.

    1. Begin by storing the operands in four addresses, then implement the operations necessary until the sum is stored in any address. Remember that this circuit will perform all operations modulo 16.

    2. When you are finished, one of the operands should appear on the inputs to one of the 7-segment display decoders, and the sum should appear on the inputs of the other decoder.

    3. Prepare a vector file, complete with comments, for the summation operation. Generate a waveform, as instructed in part B above. Show all relevant signals in the waveform display.

Part III: Proto-Board Construction

  1. Build the ALU circuit according to your Graphic design.

    1. Remember that the register file from Lab 11 can be reused. It will probably require two proto-boards to complete the circuit.

    2. Use switch circuits to provide the various input signals. Use push button switches for inputs like latch enable and the UP inputs of the counters. Use DIP switches for inputs such as the DATA_IN.

  2. Test the operation of your ALU.

    1. Test your circuit by implementing all of the operations that were simulated in Part II. You should implement the same operations on the same data as in your simulations.

    2. Connect the logic analyzer to your circuit. Connect probes to all relveant signals, including inputs, outputs, and other intermediate signals that are inportant to the circuit operation.

    3. Generate a timing diagram, showing the implmentation of your operations, for comparison with the Waveform diagrams from Part II.

Part IV: Write a Report

  1. Purpose
  2. Method
  3. Results
  4. Conclusions - Acknowledgments