Test vector builder and checker
| Name (exact label) | Bits | Direction | Number format | Remove |
|---|---|---|---|---|
Type values in any form Logisim accepts, or plain decimal numbers: the builder writes them in each column's number format. Use <DC> for an output you do not care about and x digits only in outputs.
Fill expected outputs from expressions
| A | B | Cin | S | Cout |
|---|---|---|---|---|
# Made with the logisim.dev test vector builder A B Cin S Cout 0 0 0 <DC> <DC> 0 0 1 <DC> <DC> 0 1 0 <DC> <DC> 0 1 1 <DC> <DC> 1 0 0 <DC> <DC> 1 0 1 <DC> <DC> 1 1 0 <DC> <DC> 1 1 1 <DC> <DC>
The file format, line by line
Our passing vector for a full adder:
# full adder, all 8 rows (logisim.dev lab)
A B Cin S Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1Everything below was measured on 5.0.0 (F107). Where the upstream guide and our measurement differ, we follow the measurement.
0101 | Binary, because it has exactly as many characters as the column is wide |
01_01 | Binary: underscores are ignored before counting |
0x5, 0xF, 0x00F | Hex, checked by value, so leading zeros are fine |
0x1F | Rejected: too many bits (the value needs 5) |
0b101, 0o7 | Binary and octal with a prefix |
7, -8 | Signed decimal: a 4-bit column takes -8 to 7 |
15, 8, 101 | Rejected: decimal is signed, and 101 is not binary because it has 3 characters, not 4 |
1x01, 0xx5, xxxx | Binary, hex and binary with don't-care bits |
x alone | Rejected in a 4-bit column; accepted in a 1-bit column |
0X5, 0B101, +3 | Rejected: prefixes are lower case, and there is no plus sign |
<DC>, <float> | Don't care and floating, in any letter case |
No rows match.
Header rules: a bus is Name[width] with width 1 to 64 and no space before the bracket. A row may have tabs or several spaces between values, a comment after the values, blank lines between rows, and CRLF line endings. A byte-order mark at the start of the file is not removed, so the first column then matches no pin.
Sequential circuits: set and seq
Add <set> and <seq> columns, in any position. Rows with the same set number run in seq order and keep their state; the first step of a set starts from a reset. Set 0 means “no sequence” and needs seq 0; a step in any other set needs a seq number from 1; set numbers cannot go down and seq numbers must increase within a set. A row may leave out trailing set and seq values. Our counter example:
CLK Q[4] <set> <seq>
0 0x0 1 1
1 0x1 1 2
0 0x1 1 3
1 0x2 1 4
0 0x2 1 5
1 0x3 1 6A Clock component can be named <clk> in the header when it has no label, or left out of the file (then each step moves it half a cycle). The upstream guide’s own example puts seq 1 in set 0, which 5.0.0 rejects with <Set> is 0 but <Seq> is 1, not 0 (F38). Full guide: test vectors.
Run it in Logisim
Open the circuit
The test uses the circuit that is current, so select the circuit your header was written for.
Check: The circuit is current in the project window.
Simulate, Test Vector…
It starts empty with “Passed: 0 Failed: 0”.
Check: A window with Load Vector, Run, Stop, Reset and Close Window.
Load Vector
Pick your file. Logisim runs the rows as soon as it loads, lists a failing row first and shades the wrong output cell red.
Check: The counts appear at once.
The Test Vector window with the header Passed: 7 Failed: 1. The first row says fail and its S cell is shaded red with the value 1 while Cin, A, B are all 1; the other seven rows say pass.
We did not press the Show and Set buttons or hover over a red cell. The guide inside the jar describes them; see test vectors.
Run it from the command line
java -jar logisim-evolution-5.0.0-all.jar --no-splash -w main vectors/full-adder-pass.txt full-adder.circ
Output: Loading test vector “vectors/full-adder-pass.txt”…
Output: Running 8 vectors…
Output: 1 2 3 4 5 6 7 8
Output: Passed: 8, Failed: 0
exit: 0
java -jar logisim-evolution-5.0.0-all.jar --no-splash -w main vectors/full-adder-fail.txt full-adder.circ
Output: Loading test vector “vectors/full-adder-fail.txt”…
Output: Running 8 vectors…
Output: 1 2 3 4 5 6 7 8
Output: Error on test vector 8:
Output: S = 1 (expected 0)
Output:
Output: Passed: 7, Failed: 1
exit: 0
For all options see command line; for grading a class see test vectors and teachers.
Error messages and how to fix them
Each message below was printed by 5.0.0 for a file in our batteries (F107). The window shows the same text.
Column a has no matching pin | The header name is not a pin label. Labels are case-sensitive; read the pins from your .circ. |
Column A has width 3 but pin has width 4 | Write the width: A[4]. A clock column must be 1 bit. |
Test Vector header format error: bad spec: A[4]x | The column is not Name or Name[width]. Remove spaces before the bracket and anything after it. |
Test Vector header format error: bad width: A[65] | The width must be a whole number from 1 to 64. |
Test Vector data format error: too many values / not enough values | The row has a different number of values than the header has columns. |
Test Vector data format error: Too many bits in "15" expected 4 bits did you mean A[5]?? | Decimal is signed. Write 0xF or four binary digits. |
Test Vector data format error: Unexpected character 'X' in "0X5" | Prefixes and x digits are lower case. |
Test Vector data format error: expected digits | A 0x, 0o or 0b prefix with nothing after it. |
<Set> is 0 but <Seq> is 1, not 0 | Use set 1 for a sequence. |
TestVector format error: empty file | Only comments or blank lines. Add the header. |
Error on test vector 8: | Not a format error: row 8 ran and an output was wrong. |
No rows match.
Worked examples
Each vector below passed in Logisim with its circuit (F17, F104):
- Full adder, all 8 rows: circuit, vector.
- 4-bit counter with set and seq, 41 steps: circuit, vector.
- Controlled buffer with
<float>and<DC>: circuit, vector. - 4-bit ALU with
<DC>on the overflow flag: circuit, vector.
Vector won’t load
Limits
The tool checks syntax and pin names. It does not simulate your circuit, so it cannot tell you whether the expected outputs are right: it can fill them from expressions for 1-bit pins, and the truth-table tool makes expected outputs from a table. Pins are read from the circuit you choose, not from subcircuits. Classic Logisim 2.7.1 has no test vectors. We did not test the grid editor on a phone keyboard or with a screen reader beyond automated checks.
Privacy
Files are read in your browser and are not sent anywhere. Reloading the page forgets them.