For this homework, you will use DigSim to build a simple programmable circuit. Your circuit will take as input two binary numbers, each two bits long. Let's refer to the two input numbers as a and b. Then a will be represented by two input switches (one wire for each digit of a), and similarly, b will be represented by two input switches. Your circuit will have a single output. Your circuit should be able to perform each of the following operations, depending on how it is programmed:
Begin by building each of the following subcircuits:
Once you've built this circuit, you can save it and then use it later as a sub-circuit. After you've built the circuits to perform each of the 4 operations above (i.e., the circuits that test whether a = b, whether a is not equal to b, whether a > b, and whether a >= b), you can hook the outputs of these circuits to the inputs I1 - I4 of the MUX, and then set the switches C1 and C2 to determine which of the four above operations will be sent to the output wire.
Hint: In lab 6.1, you built a 1-bit comparator which tests whether two inputs, each a single bit long, are equal. (If you don't have this circuit anymore, you can get a copy of it from the "6.1 solutions" folder in the module 6 folder on the classes server). Use this 1-bit comparator as a subcircuit in the two-bit comparator. Since a is two bits long, it is represented by two input wires, say A1 and A2. Similarly, b will be represented by two input wires, say B1 and B2. Now a = b only in the case when both A1 = B1 and A2 = B2. You can use 1-bit comparators to test whether A1 = B1 and whether A2 = B2
One way to get started is to first build a circuit which takes two inputs, P and Q, and has 1 output which is 1 only in the case where P > Q. That is, the output will be 1 only in the case where P = 1 and Q = 0.
Once you have this circuit, you can use it, along with the 1-bit comparator from lab 6.1, to determine whether input a is greater than input b. Since inputs a and b are both two bits long, they will each be represented by two input wires. Let's call these wires A1, A0, B1, and B0, where a = A1A0 and b = B1B0. Now a is greater than b when either
or
When you've finished building this circuit, save it so that you can use it as a subcircuit later.
When you've built and saved each of the above subcircuits, as well as the 4-way MUX, then your final job is to connect these circuits together into one circuit that performs each of the four operations above, and which uses the 4-way MUX to select which of the four operations the output will represent. This final circuit should have 1 output, and 6 input switches-- 2 input switches which represent the number a, two input switches which represent the number b, and 2 input switches which set the MUX. The two switches which set the MUX are used to determine which of the four operations that are performed will be sent to the output. So in setting these two switches, you're programming your circuit to perform either a test for equality, a test for inequality, a test for greater than, or a test for greater than or equal to.