JLSCircuitTester is an extension to the
digital logic simulator that allows users to automatically test
circuits (including CPUs) constructed using
main goals for this project are to
To test a circuit, users run a command-line program named
takes (1) the file name of the
JLS circuit under test and (2)
the name of a script describing one or more input sets. (A
input set lists the desired input for each input pin, register, and
memory object.) For each input set,
simulates the circuit under test, compares the observed results
(output pins, registers, and memory) to the expected results, and
reports any discrepancies.
For CPUs, users run a command-line program named
jlsCPUTester that takes (1) the name of the
.jls file under test and (2) the name of a MIPS assembly
file. The program then assembles and simulates the assembly file and
compares the final states of the registers and memories to those of
the simulated CPU.
JLSCircuitTesterhas several features that make it easy to quickly write a thorough set of tests:
JLSCircuitTesteralso provides some "programmed" lists of common test cases including ranges, "corner cases" (e.g., values around powers of 2), "templates" (e.g., the eight values that match the pattern
1???0), and random values.
JLSCircuitTesterallows users to specify a Java class to compute the expected results. This technique is especially useful (1) in combination with input sets specified using value lists, and (2) when testing CPUs.
JLSin the classroom, and all the resulting assignments. Therefore, we designed
JLSCircuitTesterto be easily extensible. We expect the most common extension will be the addition of new Java classes to compute a circuit's expected result (e.g., a counter, or a new textbook's pedagogical CPU). In addition, we provide for the addition of new input formats (i.e., different syntax for specifying a circuit's inputs and initial state). We plan to eventually support the addition of new programmed value lists. Finally, we believe that the
JLSCircuitTesterframework is designed well enough that instructors could even write their own "main" program, if desired. (This extensibility will be useful, for example, if an instructor wanted to be more precise about the order in which tests are run, or wanted to allow for one of several possible outputs for a given input.)
JLSCircuitTester, download the following components:
jarfile containing all our code.
jlsCircuitTester.bat: scripts to simplify the launching of the circuit tester.
You can also use
JLSCircuitTester to test MIPS-like CPUs (i.e.,
the CPU simulated by SPIM and MARS). To test CPUs you must also download
jlsCPUTester.bat: scripts to simplify the launching of the CPU tester.
all of the aforementioned files.
jlsCircuitTesterall in the same directory.
jlsCircuitTester circuitName.jls inputSetFile, where circuitName.jls is the name of a JLS circuit, and inputSetFile is the name of a text file describing the sets of inputs to test. (An "input set" is a set of initial values for the circuit's input pins, registers, and/or memory.)
To test MIPS-like CPUs:
jlsCPUTesterall in the same directory.
jlsCPUTester circuitName.jls assemblyCode.a, where where circuitName.jls is the name of a JLS circuit, and assemblyName.a is the name of a file containing MIPS assembly code (the same code you would give to SPIM or MARS). Notice that SPIM and MARS will handle code that most student-written CPUs won't (because time constraints will prevent most students from implement every MIPS feature); therefore, make sure the code will work with the CPU being simulated.
JLS-related assignments for Fall 2007:
JLS, for his advice and for his work modifying
JLSto make it integrate better with
MARSMIPS Simulator, for his efforts making
MARSintegrate better with