This is a group project. Groups of size 1 or 2 are acceptable.
Implement the interface declared in x86interp.mli. You should not change the interface file, but it's fine to change the code we've already provided in x86interp.ml. In particular, for the correctness tests, we will only check those functions exposed in the .mli. (In fact, since the tests are in a separate module, OCaml wouldn't let us do otherwise.) This means that, for example, you are free to define map_memory however you wish (or even to delete map_memory from the code). Its signature is provided only as a hint.
The code we have provided gives you a design to start from. It manages control flow using exceptions and the OCaml stack. Should you decide to use this code, you will need to implement the currently-failwith instructions in single_insn (and the helper functions that the provided code for Mov, Jmp, Call and Ret depends upon). You must still implement the interface, including condition_matches, but you may trust that the code for execute_mbb and interp_mbbs is complete modulo the functions it calls.
The code provided in x86interp.ml describes some assumptions that you can make about the code your simulator will be expected to execute. To summarize:
Certain other cases are already handled by the provided code:
Part of your grade will be based on testing. Some example tests and utility functions are provided in x86interptests.ml. For this assignment, we require that you define at least 10 new unit tests. (These must be sufficiently different from one another to count— tests like 1 + 1 == 2, 1 + 2 == 3, 1 + 3 == 4 are too similar to be useful). A good way to hit and surpass this requirement is to write tests for each instruction. You are required to share at least one of these tests on the class mailing list and are encouraged to share the rest. You may count tests that others write toward your 10, but remember to cite the authors.
We also ask that you write a significant functional test of your interpreter. This test should at least demonstrate some interesting control flow (eg, a loop with a conditional guard). A good strategy is to choose and implement a function (like factorial). We will add these tests to our grading test file and run them on all projects. You should not share this test (but may share other tests of equal size).
Edit the included readme.txt file, making sure to fill in your name(s) and email address(es).
You should also spend some time to ensure that your code is readable and well-commented. We have some suggestions and requirements for your programming style. You will definitely lose points for the file submission requirements (code must compile, 80 column limit, no tabs); however, barring any particularly egregious cases, you may take the remaining rules as suggestions.
The grading breakdown for this project is as follows:
Remember that your raw score will be scaled— that is, more difficult assignments will be worth more than less difficult assignments, even if the more difficult assignment has fewer available points.
Only one submission is necessary per group.
First, make sure to clean your project with omake clean. All of
the files you've written should be in projects/x86interp. Submit
your assignment on ENIAC by switching to the projects directory
and typing: