JLSCircuitTester is an extension to the JLS
digital logic simulator that allows users to automatically test
circuits (including CPUs) constructed using JLS. Our
main goals for this project are to
To test a circuit, users run a command-line program named jlsCircuitTester that
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, jlsCircuitTester
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.
JLSCircuitTester has several features
that make it easy to quickly write a thorough set of tests:
JLSCircuitTester also
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.
JLSCircuitTester allows 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.JLS in the classroom, and all the
resulting assignments. Therefore, we designed
JLSCircuitTester to 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 JLSCircuitTester framework
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:
jlsCircuitTester.jar:
The jar file containing all our code.
jlsCircuitTester or 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 or jlsCPUTester.bat:
scripts to simplify the launching of the CPU tester.
Alternately, JLSCircuitTester.tar contains
all of the aforementioned files.
JLS.jar, jlsCircuitTester.jar, and
jlsCircuitTester all 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:
JLS.jar, Mars.jar, jlsCircuitTester.jar, and
jlsCPUTester all 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 JLS to make it integrate better with
JLSCircuitTester.
MARS MIPS Simulator, for
his efforts making MARS integrate better with JLSCircuitTester.
JavaCC.