Test Vector File Format

Here is an example test vector file:

# my test vector for add32
A[8]      B[8]      C[8]      Cin Cout
0000_0000 0000_0000 0000_0000 0   0
-2        0x05      3         0   0
0         0o3       3         0   0

First and foremost, the file format is simple. Headers match the circuit's input/output pins. Under that are the values to test against.

The first non-blank, non-comment line lists the name of each circuit input pin and its bit-width (if > 1), separated by whitespace.

One thing that often confuses people starting out is that the bit-width must be specified in the header any time it is not 1 bit.

NOTE: Bit width is not necessarily the same as the number of characters in the value. For example, a 4-bit value of 13 can be represented as 1101, 00001101, 0x0d, 0o15, 15, or 0b1101, etc.

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 improved readability, you can use underscores (_) anywhere in numeric values. Underscores are ignored during parsing. Examples: 0x0000_1111, 0o1234_5670, 1111_0000, 1_234, or -5_000.

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.

Previous: Test Vector Window | Next: Special Values.