In the last line, your CPU changed the D register when it was not supposed to.
The instruction is an A-instruction (@21).
Why is D being loaded during this A-instruction? Hint: look at what instruction bits are set for the binary value for 21.

[Please edit you post to remove the HDL after you solve your problem.]