MemoryDiag tests the following:
At the end of this test it is normal to see some pixels set on the screen. This is because the results of the test are written to RAM[17000] – RAM[17008] which is in the Screen memory. MemoryDiag does not put its results in the first 16K of RAM because it must not interfere with the Memory.jack that is being tested.
When the test fails to compare, look at the MemoryDiag.out file and note the RAM[17000] value. This is the test step that failed. Look through the Main.jack code and find the corresponding
let out[0] = step;
statement. The function immediately following this statement is where the failure occurred.
For example, if RAM[17000] is 51, the
do Memory.deAlloc(b);
call did not return. Either there was a simulation error like a bad address or deAlloc() got stuck in a loop.
Supplied Memory.vm passes:
|RAM[17000|RAM[17001|RAM[17002|RAM[17003|RAM[17004|RAM[17005|RAM[17006|RAM[17007|RAM[17008| | 100 | 333 | 334 | 2050 | 2072 | 2077 | 2050 | 2050 | 2050 |Memory.Jack using the Coursera implementation passes:
|RAM[17000|RAM[17001|RAM[17002|RAM[17003|RAM[17004|RAM[17005|RAM[17006|RAM[17007|RAM[17008| | 100 | 333 | 334 | 16364 | 16359 | 15857 | 15852 | 7850 | 8850 |Broken Memory.jack fails (alloc() returns duplicate block address):
|RAM[17000|RAM[17001|RAM[17002|RAM[17003|RAM[17004|RAM[17005|RAM[17006|RAM[17007|RAM[17008| | 32 | 333 | 334 | 2050 | 2050 | 0 | 0 | 0 | 0 |Broken Memory.jack fails (deAlloc() does not recycle memory blocks):
|RAM[17000|RAM[17001|RAM[17002|RAM[17003|RAM[17004|RAM[17005|RAM[17006|RAM[17007|RAM[17008| | 73 | 333 | 334 | 16364 | 16359 | 15857 | 15852 | 7850 | 0 |