CIS 351 |
Project 2: Subtract and SLT |
Fall 2018 |
Extend your signed adder from the previous project to build
You will need your signed added from the previous project.
Build a circuit that can do both addition and subtraction. Specifically, surround your adder with additional gates so that it performs both addition and subtraction. This circuit should contain one adder only. Be sure to ask for clarification if you don't understand this requirement.
Your inputs must be named InputA
, InputB
, and Op
. If not, your
circuit won't work with my tests. The Op
input specifies whether to perform addition or subtraction.
(1
means subtract, 0
means add).
Your outputs must be named Output
, CarryOut
, and Overflow
.
CarryOut
is the carry out from the last full adder. It is also, in effect, the overflow indicator for unsigned
addition. Unsigned subtraction cannot overflow. (Subtraction that generates a negative result is not considered
"overflow".) Overflow
is the overflow indicator for singed operations. Remember,
CarryOut
and Overflow
will not necessarily have the same value.
You may use this test file (
) as a
basis for your own tests. Warning! This test class is incomplete. Don't assume that a circuit that
passes this sample test will pass all of my tests.
SampleSigned16BitAddSubtractTest.java
Build a circuit that can compare two integers (either signed or unsigned).
Use your adder/subtractor as a starting point and leverage the fact that
A < B
, then A - B < 0
, andA ≥ B
, then A - B ≥ 0
.
Be aware, however, that this algorithm works only as long as A - B
doesn't overflow. You'll need to
think about the conditions under which A - B
might overflow, and use alternate techniques for comparing
A
and B
in this case.
Your inputs must be named InputA
, InputB
, and Signed
. If not, your
circuit won't work with my tests. The Signed
input specifies whether to perform a signed or unsigned
comparison
(1
means signed, 0
means unsigned).
Your output must be named LessThan
You may use this file (
) as a
basis for your own tests. Warning! This test script is incomplete. Don't assume that a circuit that
passes this sample test will pass all of my tests.
SampleSlt16BitTest.java
JLS
and JLSCircuitTester
. It is in your best interest to start
early in case problems arise. Also, please e-mail me with any bugs you
find or feature requests you have. If JLS crashes, please e-mail me the
JLSerror
file.
This assignment will be scored out of 50 points.
Category | Rubric | Maximum Score |
---|---|---|
Adder/Subtracter | ||
Not attempted | 0 | |
Substantially complete, but passes no tests | 3 | |
Passes a few tests | 5 | |
Correctly adds and subtracts (but overflow does not work correctly) |
8 | |
Passes all tests | 10 | |
Sltu | ||
Not attempted | 0 | |
Substantially complete, but passes no tests | 4 | |
Passes a few tests | 6 | |
Passes all tests | 12 | |
Slt | ||
Not attempted | 0 | |
Substantially complete, but passes no tests | 4 | |
Passes a few tests | 6 | |
Passes all tests | 12 | |
Date 100% correct | ||
Two days early | 12 | |
One day early | 11 | |
On time | 10 | |
One day late | 8 | |
(-2 per day) | ... | |
Five or more days late | 0 | |
Presentation | ||
Documentation and Neatness | 6 |
Penalties
To submit your project:
jls
files that includes
.jls
files, bug reports, and test
scripts using Assignment Manager. (Attaching your test scripts allows
me to determine how well you tested your code, and assess partial
credit if necessary.)
kurmasz
) as a collaborator to your GitHub or BitBucket project and send me a pull
request.