I'm trying to work through the CPU.cmp file, to write out the instructions and see if what's written in CPU.cmp makes sense.
On line 17 (time 8)
|time| inM | instruction |reset| outM |writeM |addre| pc |DRegiste|
|6+ | 0|0000001111101001| 0 |*******| 0 | 1000| 6| 11111 |a @1001
|7 | 0|0000001111101001| 0 |*******| 0 | 1001| 7| 11111 |a
|7+ | 0|1110001110011000| 0 | 11110| 1 | 1001| 7| 11110 |c MD = D-1; null
|8 | 0|1110001110011000| 0 | 11109| 1 | 1001| 8| 11110 |c
As you can see, the value of the D register decrements by 1 from (decimal) 11111 to 11110, and the value of the outM reflects that. However, then outM decrements again, to 11109. Why does it do that? The instruction is MD = D-1, so it should decrement D reg once, and store the value in two locations. How does it happen that RAM[A] and D end up with different values?
I expected them to be the same...