Overview#

To verify your single cycle implementation of the QuAC ISA we have provided tests which you can run. There are two files, cpu-tests.dig is a digital file containing the tests which are run, and single-cycle-test.py which will run the tests against your CPU. Links to these files are below. You can download them directly. Ensure that both files (the script and the .dig file) are in the same directory.

To run the testing script Python 3.8.10 is required and is available on all CSIT lab computers. Other versions will likely work, particularly later versions, but we cannot guarantee support. If you have questions please post them on the class forum.

Step-by-Step#

In order to run the tests you need to run the script single-cycle-tests.py using the command python3 single-cycle-tests.py ... where ... is replaced by the script arguments as documented below.

usage: single-cycle-test.py [-h] [-d DIGITAL | -l] [-t TESTS] [-v] cpu

positional arguments:
  cpu                   Path to .dig file containing the CPU to test

options:
  -h, --help            show this help message and exit
  -d DIGITAL, --digital DIGITAL
                        Path to Digital.jar file. Default assumes script is
                        being run in the directory containing Digital.jar
  -l, --lab             Use this flag when running in the ANU CSIT environment
                        to find the path to Digital.jar. Using this flag
                        outside of this environment will have unpredictable
                        results
  -t TESTS, --tests TESTS
                        Path to .dig file containing tests. Defaults to cpu-
                        tests.dig in the same location as this script
  -v, --verbose         Print detailed error messages on test failure.

The arguments -d, -l, -t and -v are optional. The script assumes that Digital.jar is in the current directory. If it is not you can specify the location using -d. If you are running the tests in the CSIT lab environment (either on the lab computers or on partch) you can use the -l flag to automatically find the location of Digital. The script assumes the file containig the tests is in the same directory as the script and is named cpu-tests.dig. This is the case where the script is included in the assignment repositoy. If you have moved the file containing the tests you can specify it’s location using the -t flag. You must always provided the path to the file containing your cpu.

Debugging#

To assist with your debugging you can view a detailed error message using the -v flag. This will contain the instruction that executed incorrectly, the state of the registers before execution, and the expected and actual states after execution.

Troubleshooting#

Below are answers to FAQs. If you have questions or problems running the script not addressed below please post them on the class forum and they can be added to this page. Likewise, if you had a problem and found a solution please let us know so we can add it below.

Test signal not found in the circuit!#

Make sure that all measurement values are named correctly. The tests depend on measurement values with specific names to compare against. Registers must be named R1, R2, R3 and R4, Flags (R5) must be FL, the program counter (R7) must be PC and the clock component must be labeled CLK.

bars search times arrow-up