CS61C Homework 6

ALU in Logisim

Due:01.11.2006 (little-endian!)@ 2359
HW TA:David P <cs61c-tp at imail dot eecs dot berkeley dot edu>



In this assignment, you will implement a 16 bit ALU in logisim (the image above is for a 4 bit ALU).


The seven functions that you will implement are: add, subtract, OR, AND, shift left logical, shift right logical, and shift right arithmatic. The ALU will perform a desired function on two 16-bit inputs (X and Y, where x0 is the lowest order bit for x, etc...) and output the result (RESULT). The function will be determined by the value of a control signal (S), as listed below. In addition to the 16 bits of output provided in RESULT, two additional outputs will be provided: unsigned overflow, and signed overflow. Unsigned overflow will have a high value iff the command was an add and unsigned overflow occured. Signed overflow will have a high value iff the command was an add or a subtract, and signed overflow occured. (You need not worry about unsigned overflow for subtractions.)

Here's what occurs for each operation:

S opp Result
000 add X + Y (signal if either type of overflow occurs)
001 sub X - Y (signal if signed overflow occurs)
010 or X | Y
011 and X & Y
100 sll X << Y (but logically, don't sign extend!)
101 srl X >> Y (but logically, don't sign extend!)
110 sra X >> Y (but arithmatically, do sign extend!)

But wait, there's more!

Think about intuitive ways to test your ALU. If the grader can look at your logisim file and immediately see that everything is in working order, it will be to your advantage. You might consider some method for automatically testing your ALU, such as a counter. Perhaps you should add testing logic that signals an error if an incorrect value is seen. Think about this, we want to see some form of testing suite in your outter-most circuit design.

Not Allowed On This Assignment

You may only use tools from the "Base" and "Gates" libraries in Logisim. Do not use any items from the Memory, Plexers, Arithmetic, or Legacy libraries. Any ALU pieces built using any of these illegal components will be given no credit.

Details & Hints

  • Logisim can be run on instructional machines using the following unix command: logisim
  • You can download logisim for yourself as well as view more documentation at the logisim website: http://ozark.hendrix.edu/~burch/logisim/
  • Please use subcircuits! They make it easier for you, they make it easier for us. Give your subcircuits appropriate labels as well. Keep in mind that this won't be autograded, and humans will have to look at your schematics (and grade them!).
  • The key to your sanity on this project is modularity. Don't be afraid to build subcircuits that are multiple levels deep.

Submission Details

Create a directory named 'hw6' containing a README, alu.circ, and any additional files needed for your submission. While in that directory, run 'submit hw6'. If you included an image, make sure to say "yes" when the submit script prompts you about it.