Simple ALU Circuit - ECE534 - Fall '04-'05

An arithmetic logic unit (ALU) is a combinational logic component commonly found in a central processor unit (CPU).  This lab provides an opportunity to experiment with a particularly simple ALU structure.  Your design will be implemented using a Digilent Digilab II FPGA board and a matching Digilab IO1 board.

Behavior and User Interface

Your ALU model, illustrated below receives a function code, four-bit input values Ain and Bin, and produces the four-bit result Rx and three status flags Z, C, V.  Based on the function code, the ALU performs one operation, that of addition, subtraction, left shift (LS), or unsigned right shift (RS).  The shift operations always insert a low bit ('0') appropriately.  The addition and subtraction operations operate on inputs Ain and Bin.  The shift operations use Ain as the input.


ALU conceptual diagram

The following is an explanation of the status flags.  Note that the meaning of the signals C and V is not defined in the context of the bitwise-AND operation or shift operation.  Make a decision of the significance of these cases, you will be expected to explain in your report how you handled these details.

The overall user interface provides for the signals in the table below.  It is recommended that you use switches to produce Ain and Bin.  Pushbuttons can be used to produce the function code.  LEDs can be used to display the results Rx and status flag bits.  The switches, pushbuttons, and LEDs all act as positive logic devices so that logical inversion is not required.
 
signal
direction
description
Ain
input
A four bit value
Bin
input
Another four bit value
fnct
input
ALU function code
Z
output
Zero result flag
C
output
Carry-out signal from adder
V
output
2's complement overflow flag
Rx
output
four bit result

For the sanity of the instructor, PLEASE define your bit vectors with the most significant, highest number bit being left-most and least significant, lowest numbered bit (zero) right most.  Thus inputs Ain and Bin will be defined to be of type std_logic_vector(3 downto 0).  The operations will be performed according for the following values in fnct.

In your report you will also describe how the four function codes are expressed in the signal fnct.  The pushbuttons are most convenient for producing the values for fnct.  Be prepared to explain how you use the buttons.  The following outlines the steps a user might follow to operate your ALU circuit:

Implementation Details

This lab provides an excellent opportunity to practice your skills at hierarchical design.  The ALU will be designed using only structural and simple data flow style descriptions.  There is no need to go "overboard," one level of hierarchy is enough.  Warning: I do not want to see the key-word process in use anywhere in your code.  In designing your ALU, you will make use of full-adder components constructed using the data-flow technique. 

The following table lists the cases that will serve to verify that your circuit works correctly.  In this table it is understood that in vector signals, the most significant bit is left-most as least significant bit is the right-most.  Be sure to replace the '?' symbols in the table with the correct 1 or 0 symbol, based on how your circuit handles those specific cases.

Verification Cases

AinBin Operation Rx Z V C
00110101Add10000 1 0
00111111Add00100 0 1
00110011Sub00001 0 1
00011111Sub00100 0 0
0011---- LS01100 ? ?
1100---- LS10000 ? ?
0011---- RS00010 ? ?
1011---- RS01010 ? ?

The Write Up

In performing the write-up for this lab be sure to reread the entire handout so that you don't overlook any points that you are expected to discuss.  Use diagrams and figures along with suitable discussion to make each of your points clear. Make sure to include the following items as content in your report
  1. Introduction along with the conceptual diagram given above
  2. Discussion of the implementation along with system block diagram.  The diagram will show the structure of your circuit.  Use a box to represent each significant component that you instantiate, or circuitry that you use. 
  3. Completed table listing the verification cases
  4. Simulation results showing that your design works
  5. In an appendix include an appropriately brief introduction that provides a list of all the modules as well as the source code for each component.
  6. In an appendix include a suitable discussion and a table of the pin assignments made
  7. The sign-off sheet
A warning; the conceptual diagram at the top of this document is not a complete system block diagram.  To produce the diagram, show how multiplexer(s), full-adders, and other components are used to produce the overall design.
 

Sign Off Sheet

After demonstrating the final version of your project, make sure to have a member of the teaching staff sign and date the following:

Student Name:
 
 

Demonstrated final version of ALU project:
 
 
 
 


Copyright Notice

This lab handout is written for the ECE534 class - VHDL and Application.  Copyright is reserved by the author, but copies of this document may be made for educational use as-is, provided that this statement remains attached.

Original Author: Jonathan Hill (jmhill@mail.hartford.edu)
Last Modified By: Jonathan Hill (jmhill@mail.hartford.edu)
Copyright Date: Thu Sep 9 14:31:10 EDT 2004
Last Modified Date: Thu Sep 9 14:31:10 EDT 2004