The Test Vector window

The Test Vector window is similar to the Table tab of the Logging window. You can load a test vector from a file, and Logisim will start running tests on the current circuit. Like the logging window, there 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.

Any incorrect outputs will be flagged in red. Hover the mouse over the red box to see what the output should have been, according to the test vector. Rows with incorrect outputs are sorted to the top of the window.

The file format is simple. You can use the Logging module (with "Include Header Line" selected in the file output tab) to get started, since in most cases the Logging module outputs the same format as used by the Test Vector module.

Here is an example test vector file:.

# my test vector for add32
A[32] B[32] C[32] Cin Cout
00000000000000000000000000000000        00000000000000000000000000000000        00000000000000000000000000000000        0       0
-2       0x00000005    3       0       0
0        0o0003        3       0       0

Blank lines are ignored. Anything following a '#' character is a comment. The first non-blank, non-comment line lists the name of each circuit input pin and its width (if > 1), separated by whitespace.

The remaining lines list each value separated by whitespace. The values can be in hex, octal, binary, or signed decimal. Hex values must have a '0x' prefix. Octal values must have a '0o' prefix. Binary 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.

For hex, octal, and binary values, a digit of 'x' specifies four, three, or one "don't care" bits. So the value 101xx is a five bit binary value, with the last two bits unspecified, and 0x1ax5 is a hex value with four unspecified bits. Such "don't cares" 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:
logisim -test <circuitname> <vector.txt> <project.circ>

Next: User's Guide.