Appendix B: The User's Manual for Arctic's Functional Testing System

This manual was first prepared before Arctic's functional testing system was implemented, and it has been updated over the life of the project. Its purpose is to define all the details of the original testing system that a user might ever need to know. The first few sections give an overview of the system and describe exactly how to run it. The later sections explain every detail of how to manage data structures and how to format the test files. Note that this manual does not cover the randomized testing system at all. Also note that ``test groups'' were originally called ``test sequences,'' which is why the word ``sequence'' is used so often in this manual.

The original document begins with a short introduction and the following list of sections. From this point on, very little has changed from the original document.

  1. Directories
  2. General Structure
  3. Running the System
  4. Data Structures
  5. Files

B.1 Directories

The following directories are needed by this testing system.

B.2 General Structure

In this testing system, the Arctic module will be instantiated once, and several modules will be created to connect to it. One module will be connected to each input port and will be capable of doing anything necessary to insert packets, cause link errors, and generate an independent clock. One module will be connected to each output port and will be capable of detecting link errors, receiving packets, and storing information about received packets in a log file. It will also check received packets against the packet sent to make sure the packet was not changed (if it was changed, the packet will be stored in a log file). Another module will be connected to the maintenance interface which will facilitate communication with Arctic's configuration/control bits and test rings. The top level module will contain Arctic and connections to all these modules. It will also contain a list of test sequences.

Testing will be accomplished by running a number of test sequences. Each sequence will test a few functions of the chip, and, hopefully, nearly all functions of the chip will be tested thoroughly by at least one of these test sequences. At the end of every simulation (i.e. every set of sequences) the errors detected during that simulation will be written to a file, Simulation_Errs_File (specified in the test_template.h file).

Each sequence will be divided into three parts:

Starting the test sequence is done with the function
start_sequence("configuration_file_name", "packets_log_file_name",
               "stats_log_file_name", "errs_contr_log_file_name", 
               <quick>, <fast_ins>)
which will do two things. First, it will put Arctic in configuration mode and set it up according to what is specified in the file "configuration_file_name", or it will skip configuration altogether if "configuration_file_name" has a value of zero. The <quick> argument is a flag that will ``cheat,'' i.e. configure Arctic without using the maintenance interface, if set to 1. Secondly, the task opens all the files to which data will be written during the test sequence. These files will be accessed with three Verilog ``Multi Channel Descriptors.'' There will actually be three other MCDs. The <fast_ins> bit configures the system to insert as fast as it can, or based on timing information given in the packet insertion file. Each packet insertion command begins with a number specifying when the packet is to be inserted into the system. If <fast_ins> is set to 1, the system will ignore these times and insert packets as fast as it can, in the order they appear in the insertion file.

Running the test will involve alternating run and store procedures. A number of actions will take place, and then the current state of the system will be stored. After that, new actions can take place and the current state will be appended to the files created before.

``Actions'' refer to any data or information sent into the chip after configuration. Each action in this system is performed with a Verilog function call. Some of these actions have prefixes such as `` mn'' or `` in'' because they are defined within a Verilog module by that name. At this time, there are seven different kinds of actions:

Storing state will be done with one of two functions; one stores statistics information, and the other stores errors, control and any other information. The received packets must also be stored, but that is done without making an explicit call to a function. A log entry is is also stored for every buffer free signal received from every input port. This is also done automatically. Each output port module continually stores a Packets Log File entry for every packet received. Also, any packet received is checked against the packet that was sent into the system to make sure it emerged unadulterated. If the packet was modified, the packet itself is stored in another log file. Each packet will have a text header giving a little information about when the packet was received. There will be no further specification of this file, because it will not be read again by the system. To end the current sequence, call the function end_sequence. This function will close the necessary log files (packets, stats, and errs), and will compare all these logs with corresponding ``check'' files that are created before the test is run. There is a check file corresponding to each log file. Each piece of information in the log files must have a corresponding piece in the check file or at least a ``don't care'' field must appear in an appropriate place.

If any log file does not correspond exactly with the appropriate check file (ignoring don't care fields), error messages explaining the error will be printed to the screen and to a file, Simulation_Errs_File (which is specified in the test_template.h header). When errors are detected, the simulation may halt. If HALT_ON_ERR (also defined in test_template.h) is set to 1, execution of the simulation will halt at the end of a sequence when errors are detected. If it is 0, the simulation will continue.

Also note that this HALT_ON_ERR bit determines whether or not the system will halt when link errors are detected. These errors can occur at any time, not just at the end of a sequence. Error messages caused by link errors will also be written to Simulation_Errs_File.

One additional function remains. Stop_sim ends the simulation. Hopefully, this structure will be sufficiently general to test most of the chip. It will continue to be updated. One thing not mentioned is the function that will load all the packets in the Packets Library and how information in that file will be accessed. This is addressed in Section 4 of this document.

B.3 Running The System

Executing the command run_test <filename> (where run_test is found in the run_test directory and <filename> is the name of a test description file) will start the system running whatever tests are specified in <filename>. The system will stop when all tests are finished or an error is found. The test description files will have the following format.

There are two parts to the file. The first part is a list of Packet Library Files. Each Packet Library that is to be used in the test needs to appear in this file. These libraries must appear as filenames given relative to the test_drv directory. After all packet libraries are given, the keyword sequences must appear. This word must be at the beginning of a line, and it must be on the line by itself. An arbitrarily long list of test sequences will follow. Please note, while the system allows sequences to be run without specifying Configure Files (if the user wants to run a sequence without re-configuring), the system will not be able to run unless the first sequence in the list configures Arctic.

Each test sequence is specified by number as in test001 or test999 or any other number. We have specified how the sequences will appear on disk. The program run_test will enter each test sequence directory and splice the appropriate code into the right location in test_drv.v, and then run the simulation. The code for each test sequence is assumed to be in the file test***.code (i.e. for the test sequence test004, the code should be in /sequences/test004/test004.code). The format for a test sequence is given above.

Just to add a little sugar, all white space will be treated equally in the test description files, so the actual text format does not matter. Just list the packet libraries, then write the word sequences, and then list all the sequences. Also, on every line, all text following the symbol `` #'' will be treated as a comment and will be ignored.

There is a single command line option. The -b switch tells the system to use a compiled and back annotated description of the chip rather than a Verilog behavioral description.

B.4 Data Structures

As has been stated, the packets will be read into an array where they can be accessed by any part of the system. At the beginning of the simulation the function read_in_packets will read the packets contained in the packets files into an array called packet_arr[]. this is an array of 16 bit words. to find where the data for a particular packet begins, use the packet's 32-bit identifier and the function get_packet_adder(<packet_id>) in the following way.
integer     packet_word_addr, packet_id;
reg [15:0]  packet_word0, packet_word1;

//Assume packet_id has been set to some known value.
//Remember integers function as 32 bit registers in Verilog

packet_word_addr = get_packet_addr(packet_id);
packet_word0 = packet_arr[packet_word_addr];
packet_word1 = packet_arr[packet_word_addr+1];
In this way, all words in a packet can be accessed. It is up to the module or task calling get_packet_addr to keep track of how long the desired packet is. get_packet_addr will return 0 if the given <packet_id> is invalid.

B.5 Files

This lists all the files needed for each test sequence and the format each will be stored in. All numbers are written left to right, most significant bit to least significant bit. The symbol [31:0], for example, refers to a 32 bit number where the left most bits are the most significant bits and the right most bits are the least significant bits.

At many places in this section the file names themselves will be specified. Usually, these are of the form test*.<ext> where `` *'' is an identifier unique to each test sequence and `` <ext>'' is some extension. Here, we specify that this unique identifier, `` *'' must be a three digit decimal number ranging from 000 to 999. This is required because the length of the filenames (in characters) must be kept constant.

B.5.1 Packet Library

These files will contain all the packets to be used in the system. Everything will be stored in textfiles as hexadecimal numbers. The file will begin with two 32-bit numbers, each split into two 16-bit parts followed by newlines. The first number indicates how many 16-bit words are contained in the file (including the header) and the second indicates how many packets are in the file.

After these two words come the packets themselves. Each packet begins with a newline followed by a 32-bit packet identifier (also split into two 16 bit parts followed by a newline) and then the 16 bit words of the packet are given one by one with a newline after each one. Each new packet follows immediately after the previous one. No restriction is placed on the what form the packet itself must take, except that the first 2 data words (the first 32-bit word in the payload) must be the 32-bit identifier given before. Finally, after the last packet, a 32-bit trailer will follow. This trailer is also split into 16 bit parts. It is guaranteed to be different from every possible packet identifier. The format is further detailed below.

It must be stated that the specified fields in the packet identifier are used only to aid the programmer in differentiating between packets. The only requirement on the packet identifiers that is needed to make the program work is that all identifiers must be unique each time the program is compiled.

Following is the exact format of this file with each type of word defined exactly.

[31:16] header 0 \n
[15:0]  header 0 \n
[31:16] header 1 \n
[15:0]  header 1 \n
\n (added for readability)
[31:16] packet identifier  \n
[15:0]  packet identifier  \n
[15:0]  packet word 0 (uproute) \n
[15:0]  packet word 1 (downroute) \n
[15:0]  packet word 2 (partid & len) \n
[31:16] packet identifier (first data word) \n
[15:0]  packet identifier (second data word) \n
[15:0]  third data word \n
.
.
.
(next packet)
\n
[31:16] packet identifier  \n
[15:0]  packet identifier  \n
[15:0]  packet word 0 (uproute) \n
.
.
.
(after last packet)
[31:16] trailer \n
[15:0]  trailer \n


header0 [31:0]
        [31:0]  - Total number of 16-bit words in the file


header1 [31:0]
        [31:0]  - Total number of packets stored in the file


packet_identifier [31:0]
        [31]    - Unused.  Should be set to 0 unless needed for some 
                        reason
        [30:29] - Output port number (0-3) out of which the packet is
                        to leave (or 0 if not needed)
        [28:24] - The size of the whole packet in # of 32 bit words.
                        Note that this is not the number of 16 bit
                        words.  The length field is kept this way to
                        be consistent with the length field in the
                        actual packet.
        [23]    - 1 iff the packet is a priority packet
        [22]    - 1 iff the packet should generate a crc error
        [21]    - 1 iff the packet should generate a length error
        [20:15] - Identifier saying which packets file this packet's in
        [14]    - Always 0
        [13:4]  - Identifier saying which configuration file was used 
                  to generate this packet (This will be the number of 
                  the first test sequence where this configuration 
                  appears).  Alternatively, if this is being used in a 
                  packet library where this field is not needed, it 
                  can be used simply as a generic field to 
                  differentiate packets in any way.
        [3]     - 0 if this packet was designed to go into a 
                        particular input port.
                  1 otherwise
        [2]     - Unused.  Should be set to 0 unless needed for some 
                        reason
        [1:0]   - The input port this packet is meant to be sent into 
                        if one needs to be specified, or 0 otherwise.


trailer [31:0]
        [31:0]  - Always one value (1f00_0000)

B.5.2 Packet List File

These files contain the lists of packet identifiers telling the system when and where it inserts packets. There will probably be at least one for every test sequence. The name of this file will be test*.#.pkts where `` *'' is a number unique to each test sequence and `` #'' is a letter (a-z) separating this list from others in the same sequence.

This file is also stored as a sequence of hexadecimal numbers, starting with a 68-bit header, a newline, and a list of 68-bit words (each followed by a newline), one for every packet to be inserted into the system. Packet insertion commands must be listed in order of increasing time.

[67:0] header \n
[67:0] packet insertion command \n
[67:0] packet insertion command \n
[67:0] packet insertion command \n
.
.
.


header [67:0]
	
        [67:32] - Always zero
        [31:0]  - The number of packets to be inserted into the system


packet insertion command [67:0]

        [67:36] - Time (in # of cycles) after starting that the packet
                        should be sent in.
        [35:4]  - Packet identifier
        [3]     - Always zero
        [2:1]   - Input Port the packet is inserted into
        [0]     - Always zero

B.5.3 Packets Log File and Packets Check File

There will be one Packets Check File and one Packets Log File for each test sequence. Both of these files will also be stored as hexadecimal numbers. Their names will be test*.log.pkts and test*.chk.pkts where `` *'' is again a unique number identifying this test sequence. The Packets Log File will be a list of 72-bit words (one for each received packet or buffer free signal received, each followed by a newline), followed by a 72-bit trailer (guaranteed to be different from every other word in the file).
[71:0] - received packet record or buffer free record
[71:0] - received packet record or buffer free record
.
.
.
[71:0] - received packet record or buffer free record
[71:0] - trailer

received packet record [71:0]

        [71:40] - Packet identifier
        [39:38] - Always 0
        [37:36] - Output Port packet was sent from
        [35:33] - Always 0
        [32]    - 1 iff received packet matches the transmitted packet
                        bit for bit
        [31:0]  - Time in # of cycles after the beginning of a sequence
                        that the packet was finished being transmitted 
                        from ARCTIC

buffer free record [71:0]
	
        [71:35] - The number 1e0000000 (37 bits)
        [34]    - Always zero  
        [33:32] - The input port the buffer free signal came from
        [31:0]  - Time in # of cycles after the beginning of a sequence
                        that the buffer free signal was given.

trailer [71:0]

        [71:0]  - The number 1f_0000_0000_0000_0000
The corresponding check file has nearly the same format. Major differences are as follows:
  1. The buffer free records will not be in the check file. The system will make sure that there are the same number of buffer free records and received packet records, but will make no other use of these records.
  2. Received packet records may be out of order and may contain x's in certain fields to indicate that some values are not important. These x's can appear anywhere except bits [31:0] which indicate the timing/order of the packet.
  3. Bits [31:0] of a received packet record will not contain timing information. Instead, this field should hold a number indicating the order the packets are supposed to emerge from each output port. All packets labeled ``1'' for an output port must emerge before any packets labeled ``2'' and so on. This gives the ability to check that one group of packets emerges before another. There is one exception. When the number 0 appears, it is assumed the user does not care when the packet emerges (it can come out at any time). It is also important to note that, for each output port, all packets numbered ``1'' in this fashion should precede those numbered ``2'' and so forth, and any 0's should appear at the beginning.
The trailer must be in the same place and must be left unchanged.

B.5.4 Stats Log File and Stats Check File

There will be one Stats Check File and one Stats Log File for each test sequence. Their names will be test*.log.stats and test*.chk.stats where `` *'' is again a unique number identifying this test sequence. The stats log file is stored as a textfile with hexadecimal numbers and contains any number of reports of all the statistics information in Arctic. Each report consists of a newline, followed by a 36 bit value set to 1, followed by 24 36-bit words (one corresponding to each piece of statistics information in Arctic, each followed by a newline). These 36-bit words will be arranged starting with output port 0 and moving through to output port 3. The 6 words for each output port will be arranged in the following order: packets, priority, up, down, idle wait. At the end of the last report, there will be a newline followed by a 36 bit 0.
\n
[35:0] - header (0_0000_0001) \n
[35:0] - Port 0 packets statistic \n
[35:0] - Port 0 priority statistic \n
[35:0] - Port 0 up statistic \n
.
.
.
[35:0] - Port 3 down statistic \n
[35:0] - Port 3 idle statistic \n
[35:0] - Port 3 wait statistic \n
(If a second report follows..... these lines are added)
\n
[35:0] - header (0_0000_0001) \n
[35:0] - Port 0 packets statistic \n
[35:0] - Port 0 priority statistic \n
.
.
.
\n
[35:0] - trailer (0_0000_0000) \n
Again, the check file is the same format, except that x's may be inserted into fields that are not important.

B.5.5 Errs&Control Log File and Errs&Control Check File

There will be one Errs&Control Check File and one Errs&Control Log File for each test sequence. Their names will be test*.log.errs and test*.chk.errs where `` *'' is again a unique number identifying this test sequence. The Errs&Control Log File is stored in a textfile with binary numbers. It contains any number reports of Arctic's errors and control information and buffer free counters.

Each report consists of a newline, followed by a 17 bit value set to 1, followed by 4 17-bit words (each corresponding to the errors information for one port and each followed by a newline), followed by two 17-bit words giving the status of the control register (in a weird format), followed by a single 17-bit word holding the buffer free counters.

The 4 error words will be arranged in port order, starting with port 0 and continuing to port 3. The control word format is just plain strange because of the move from an 8-port to a 4-port arctic. The first 2 bits appear at the beginning of the first word and the last 16 appear at the end of the second. The format for the buffer free count word is given in the Arctic user's manual. Since this word is only 16 bits long, we add a 0 in bit location 17. After the last report there is a newline followed by a 17 bit 0.

\n
[16:0]  header (0_0000_0000_0000_0001) \n
[16:0]  error word for port 0 \n
[16:0]  error word for port 1 \n
[16:0]  error word for port 2 \n
[16:0]  error word for port 3 \n
[33:17] control status report \n
[16:0]  control status report \n
[16:0]  buffer free report\n
(If a second report follows..... these lines are added)
\n
[16:0]  header (0_0000_0000_0000_0001) \n
[16:0]  error word for port 0 \n
[16:0]  error word for port 1 \n
.
.
.
\n
[16:0]  trailer (0_0000_0000_0000_0000) \n


error word [16:0]

        [16:15] - Always set to 0 (unused)
        [14:13] - Buffer free error count
        [12]    - ICLK error
        [11:10] - Route error count
        [9:8]   - Idle error count
        [7:6]   - Length error count
        [5:4]   - Frame error count
        [3:2]   - Overflow error count
        [1:0]   - CRC error count


control status report [33:0]
	
        [33:32] - Control Status word bits [17:16]
        [31:16] - Always zero
        [15:0]  - Control Status word bits [15:0]
The format of the control status word is given in the Arctic user's manual as it is too lengthy to detail here.
buffer free report [16:0]
	
        [16]    - Always set to 0 (unused)
        [15:0]  - Buffer Free Counter Word
The format of the Buffer Free Counter word is given in the Arctic user's manual as it is too lengthy to detail here.

Again, the check file is the same format, except that x's may be inserted into fields that are not important.

B.5.6 Configure File

This optional file contains all the information necessary to configure an arctic. The file name will be written as test*.config where `` *'' is a number unique to each test sequence. It is stored in ASCII as hexadecimal numbers, and can have one of two formats. Both formats begin with a 32-bit header telling which format the file is in. If the 32-bit header number is 0, then format 0 is used. In this format, configuration information for each port is given in port order (from 0 to 3). For each port, the five configuration words are given in order (0 to 4).
[31:0] header (0000_0000) \n
[31:0] Port 0 configuration word 0 \n
[31:0] Port 0 configuration word 1 \n
[31:0] Port 0 configuration word 2 \n
[31:0] Port 0 configuration word 3 \n
[31:0] Port 0 configuration word 4 \n
[31:0] Port 1 configuration word 0 \n
[31:0] Port 1 configuration word 1 \n
.
.
.
A definition of the bits in each of these configuration registers is given in the Arctic user's manual and is too lengthy to detail here.

If the header contains the value 1, then the file contains only 5 configuration words. These five words will be broadcast to the entire chip.

[31:0] header (0000_0001) \n
[31:0] configuration word 0 \n
[31:0] configuration word 1 \n
[31:0] configuration word 2 \n
[31:0] configuration word 3 \n
[31:0] configuration word 4 \n