###
CSCI-UA.0436 - Prof. Grishman

###
Assignment 2: Ripple-Carry Adder and Subtracter

0. Read the Logisim documentation about Libraries and
Subcircuits
by clicking on "Help>User's Guide". This describes how to
build small devices and save them for future use in building larger
devices. Note that each time you want to create a new
subcircuit
that you will use later on, you should click on "Project>Add
Circuit".

Also read the documentation on Wire bundles, needed for the last
part of this assignment.

1. Build a 1-bit full adder using Logisim (from AND, OR, XOR,
NOT, NAND, NOR, and XNOR gates) that has inputs **a**, **b**,
and **CarryIn** and outputs **Sum** and **CarryOut**
[see Appendix C, section 5].

Be sure to click on "Project>Add Circuit" before creating the
1-bit full adder. It will ask you for a name for the
circuit. Call it "fas".

2. Modify your circuit to have an additional input **Subtract**.
If **Subtract** = 0, the circuit adds **a** + **b** + **CarryIn**
as before. If **Subtract** = 1, the circuit adds **a**
+ not(**b**) + **CarryIn**.

3. Build a 4-bit adder/subtracter from 4 of your 1-bit
adder/subtracters. Save this
as the "main" part of your circuit (double-click on "main" before
entering this circuit). We suggest that you save the circuit in
a file whose name includes both your name and "asgn2".

The final circuit should have two 4-bit inputs **A** and **B**
and a 1-bit input **Sub**; it should have a 4-bit output **Sum4**
and a 1-bit output **CarryOut4**. Note that **A**, **B**,
and **Sum4** are wire bundles. If **Sub** = 0, **Sum4**
should be the 4-bit sum of **A** and **B**; if **Sub**
= 1, **Sum4** should be the 4-bit difference **A** - **B**.

####
Due in one week: September 26th.

Mail your homework (the .circ file) to grishman@cs.nyu.edu
and smj340@cs.nyu.edu and
mark
the mail CompArch -- Asgn 2.