Window Text Vector

From the Test Vector Window you can load a test vector from a file, and Logisim will start running tests on the current circuit. is only one test vector window for the project, and the table will change to reflect whichever circuit is being simulated in the project window. Note, however, that the Test Vector module runs a separate copy of the circuit simulator, and so does not interfere with, and is not influenced by, the simulation in the project window.

For the example we will test the circuit below. This circuit gives the results of five logical functions from two inputs. It has an error the bottom NAND gate should be an AND port.


The vector test file looks like this.

A B O_Nor O_Nand O_Xor O_Or O_And O_AB[2]
0 0 1 1 0 0 0 00
0 1 0 1 1 1 0 01
1 0 0 1 1 1 0 10
1 1 0 0 0 1 1 11

To start the test, select the menu |  Simulate  ||  Test Vector  | then use the button Load Vector. Select the file of vectors that you have built. The simulation is executed immediately and a table is displayed with the result.


Any incorrect output will be indicated in red. Lines with incorrect outputs are sorted at the top of the window.

The file format is simple. The first line contains column headers that correspond to the names of the signals. If the bit width is greater than 1 then it is necessary to specify it in square brackets. Example C[8]. The data for each test situation is in the following lines. Blank lines are ignored. Anything following a "#" character is a comment.

The remaining rows list each value separated by a space or tab. Values can be in hexadecimal, octal, binary, or signed decimal. The hexadecimal values must have the prefix < tt="">. Octal values must have the prefix "0o". inary and decimal are be distinguished by the number of digits: binary values must always have exactly as many digits as the width of the column; decimal values must always have fewer, should not have leading zeros, and may have a negative sign.

Here is an example of a test vector file:

#test vector for adder 4bit 
A[4] B[4] O[4] C_in C_out
0000 0000 0000 0 0
0000 0000 0001 1 0
0xf 0xf 0000 1 0
0xf 0xf 0001 1 1

Depending on the representation of values in hexadecimal, octal or binary, the lowercase "x" is used to specify four, three or one "unimportant" bits. For example 101xx is a binary value of five bits, with the last two unspecified bits, and 0x1ax5 is a hexadecimal value with two unspecified four-bit bits. Such wildcards can not be used in decimal notation.

Command line: To facilitate automated testing, the test vector feature can be run from the command line as follows:

java -jar logisim-evolution.jar -testvector <circuitname>
   <vector.txt> <project.circ>

Next: User's Guide.