Bibliotheken austauschen

Now suppose we have two Logisim circuits that are supposed to do the same thing. As an instructor, you might have had students complete an assignment: You have one file containing your solution, but you have several student files containing their work. Maybe the assignment was to build a two-bit adder.

I'll imagine that we have two files, named adder-master.circ and adder-query.circ. Each file contains a circuit named 2-bit adder (it's important that the circuit to test be named exactly the same), whose appearance is the following.

adder-master.circ adder-query.circ

As you can see, the master circuit uses Logisim's built-in adder, while the query circuit uses two subcircuits representing a half adder and a full adder (which themselves are built up of simple gates). For the purpose of our example, the query circuit has a stupid error: The carry from the half adder is not connected into the full adder.

We build our testing circuit into a different file. There, we load adder-master.circ as a Logisim Library (Project > Load Library > Logisim Library…), and we insert its 2-bit adder as a subcircuit. We could execute this circuit directly to get the desired output for a perfect solution.

java -jar logisim-filename.jar adder-test.circ -tty table

But we want to execute the circuit using adder-query.circ rather than adder-master.circ as the loaded library. The naive approach would be to open Logisim and load that library instead; or you might simply remove the adder-master.circ file and rename adder-query.circ to be named adder-master.circ instead. But Logisim includes a handy -sub option that temporarily replace one file by another during that session — without making any changes on disk.

java -jar logisim-filename.jar adder-test.circ -tty table -sub adder-master.circ adder-query.circ

The output you would see from this is shown below; it is of course different from what we saw in the previous section since now it is executing using the erroneous adder-query.circ.

a  b sum
00 00 000
00 01 001
00 10 010
00 11 011
01 00 001
01 01 000
01 10 011
01 11 010
10 00 010
10 01 011
10 10 100
10 11 101
11 00 011
11 01 010
11 10 101
11 11 100

Next: Other verification options.