V22.0436 - Prof. Grishman

Assignment 2:  Comparator

0.  Read the Logisim documentation about Libraries and Subcircuits by clicking on "Help>Help Contents".  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". 

1.  Build a 1-bit comparator.  Using Logisim, construct a device (from AND, OR, XOR, NOT, NAND, NOR, and XNOR gates) that has two inputs, a and b, and two outputs, a=b and a>b.  Output a=b is a 1 if a and b are the same (both 0 or both 1);  output a>b is a 1 if a is greater than b (in other words, a is a 1 and b is a 0).

Be sure to click on "Projects>Add Circuit" before creating the 1-bit comparator.  It will ask you for a name for the circuit.  Call it "one bit comparator".

2.  Build a 3-bit comparator from 1-bit comparators.  Using Logisim, construct a circuit which has two 3-bit inputs, A = a2a1a0 and B = b2b1b0, and one output, greatergreater should be 1 if A > B when A and B are interpreted as unsigned binary integers.   The circuit should be built from 3 of your 1-bit comparators, connected together with AND and OR gates.  Save this as the "main" part of your circuit (double-click on "main" before entering this circuit).

To see how they should be combined, consider the simpler case of 2-bit inputs, A = a1a0 and B = b1b0
Then greater should be 1 if a1>b1 OR ((a1=b1) AND (a0>b0)).
You should use the same approach, but extended to the 3-bit case.

Due in one week: September 23rd.

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