Look at the the lines that are miscomparing:
|time| inM | instruction |reset| outM |writeM |addre| pc |DRegiste|
cmp: |14 | 11111|1110110111100000| 0 |*******| 0 | 1000| 16| -1 |
out: |14 | 11111|1110110111100000| 0 | -4639| 0 |28128| 16| -1 |
The instruction that is failing is 1110110111100000. Look in CPU.tst to decode the instruction.
set instruction %B1110110111100000, // A=A+1
The previous instruction, @999, set A=999, so this instruction should set it to 1000.
The A register is being loaded with a value that appears to be unrelated to the ALU output.
Fix this one problem, and your CPU will pass.
Hint:
// if this instruction is a-instruction
Not(in=instruction[15], out=aInst);
//if this instruction is c-instruction
Not(in=aInst, out=cInst);
Making aInst and cInst is a very good idea. You should move this code to the beginning of PARTS: because it is very important. Then you should use aInst and cInst throughout the remaining code instead if instruction[15]. This will make the code more understandable and help prevent errors like this one.
--Mark
Please edit your post to remove the HDL.