Author: Zack Kurmas, with very minor modifications by Andrew Kalafut
Objective: Gain a better understanding of an ALU throught building one. Additionally, gain experience with the JLS simulator.
Deliverables:
jls
files that includes
.jls
files, bug reports, and test
scripts to the assignment on Blackboard by 11:59 PM on 2/6/2013. (Attaching your test scripts allows
me to determine how well you tested your code, and assess partial
credit if necessary.)
.jls
file.). These are due in lab 2/7/2013.
This project should be done in groups of 2. A group of 3 may be acceptable with permission of the instructor if there are an odd number of students.
For this project, you will use JLS to implement a simple ALU. In
particular, your ALU must be able to add, subtract, and multiply two
16bit signed integers. Notice that you will not be
implementing the ALU described in the textbook. Your ALU will be able to
multiply and detect overflows, but you need not implement logical
operations (and
, or
, etc.), shifts, or
compares.
You should make an effort to complete the background section in Lab on Thursday Jan 17 if there is sufficient time.
Before doing the rest of this project, please work through the steps on the JLS Intro page. This page explains how to set up and useJLS
, as well as use the JLSCircuitTester
testing suite.
You will build the following four components:
Component  Instructions  Interface  

Adder  Implement a 16bit signed adder using any algorithm you
wish, provided the circuit has a reasonable running time and size.
Faster adders will receive more points. (See Grading
section below.) Your adder must report overflow conditions when they
occur. Notice that this circuit must have an input named CarryIn .
You will use this input when building your Adder/Subtracter. For
addition, CarryIn will always be 0.



Adder / Subtracter  This component must perform both signed addition and signed
subtraction. Surround your adder with additional gates so that it
performs both addition and subtraction, thereby avoiding duplicating
the adder in order to perform subtraction. (Be sure to ask for
clarification if you don't understand this requirement.) Use the Op
input to specify subtraction (1 means subtract, 0
means add). Again, this component must report overflow when it occurs.



Multiplier  This component must perform signed 16bit multiplication. The product of two 16bit numbers can be as large as
32 bits. Your circuit must have two 16bit outputs named high and Output that
contain the high and low 16 bits from the 32bit product. Your component must also have an
Overflow output indicating whether the answer fits entirely in the low 16bits.
You may implement any algorithm you like, provided it runs in polynomial time (with respect to the number of
bits). You may also use as much hardware as you like. Most students implement a version of the multiplier
shown in Figure 5.18 on page 252 of the Harris and Harris text. See hint below.



ALU  This component must perform 16bit signed addition, subtraction, and multiplication. It takes as input two
16bit signed integers, and a 2bit opcode (00 for addition, 01 for subtraction, and
10 for multiplication). It will produce as output two 16bit integers and a onebit overflow
indicator. When doing addition and subtraction, high should be 0. Remember to use the same physical hardware for
addition and subtraction.


JLSCircuitTester
can range from
very simple to very complicated. If you don't see how to write a simple
test file by looking at the examples above, I'll be glad to help you.
JLS
and JLSCircuitTester
. It is in your best interest to start
early in case problems arise. Also, please email me with any bugs you
find or feature requests you have. If JLS crashes, please email me the
JLSerror
file.
This assignment will be scored out of 100 points.
Component  State of Code  Maximum Score 

Adder  
Not attempted  0  
Substantially complete, but passes no tests  6  
Passes a few tests  14  
Correctly adds positive integers only  20  
Correctly adds positive and negative integers (but overflow does not work correctly) 
24  
Passes all tests  30  
Adder / Subtracter  
Not attempted  0  
Substantially complete, but passes no tests  2  
Can do some addition and subtraction  4  
Correctly subtracts positive integers  6  
Correctly subtracts all numbers, but overflow doesn't work  8  
Passes all tests  10  
Multiplier  
Not attempted  0  
Substantially complete, but passes no tests  6  
Passes a few tests  14  
Correctly multiplies positive integers  20  
Correctly multiplies all numbers, but overflow doesn't work  24  
Passes all tests  30  
ALU  
Not attempted  0  
Substantially complete, but passes no tests  2  
Passes a few tests (at least one per operation)  3  
Passes all tests  5 
Other factors in grade:
Speed  points 

≤75  9 
≤125  8 
≤175  7 
≤225  6 
>225  5 