To run your program, you will want to use one of the following
TOY simulators. We'll grade your programs using the
C TOY Simulator but it may be more convenient to develop
your code with the Visual X-TOY simulator.
Checking your work and hints
|
The most complete way to test your TOY programs is to encode and decode all
possible inputs. Use the files
all4.txt
and
all4.txt.ans
to debug encode.toy: the first file contains all possible 4-bit inputs,
the second contains the desired output.
Use the files
all7.txt
and
all7.txt.ans
to debug correct.toy: the first file contains all possible 7-bit inputs,
the second contains the desired output.
If you are using the Java X-TOY simulator, you can use
Mode -> Load File to Stdin to redirect stdin from a file. If you
are using the C simulator, you can use the following command:
toy encode.toy < all4.txt
As a special bonus, we provide reference implementations in C:
encode.c
and
correct.c.
Here are some debugging hints that may help you out.
Remember that all values, "line numbers", and arithmetic are
in hex. This is by far the most common error. For example,
1A comes after 19.
Comment your TOY code. Also, this may sound silly, but don't
accidentally update your comments and forget to update the
actual code!
All registers are global variables, so be careful.
Watch out for jump statements - if you insert a new line of code
between existing lines, the location that you want to jump to may change.
Submit the following files:
readme.txt encode.toy correct.toy
Do not use different file names.
Comment your encode.toy and correct.toy programs.
The readme.txt file should contain the following
information. Here is a
readme template.
Name, precept number.
High level description of code, any serious problems you
encountered, and whatever outside help that you received.
For each program, include a table indicating what each of the
registers are used for.
Indicate whether you used the C or Java TOY simulator
to develop your code.
Kevin Wayne