Bug fix and termination when two trace files finish

Fixed the bug that the returned write data packet's threadID is not initialized.
Now the trace based simulation finishes when both traces finish, so we can assign
a large simulation cycle time, and the program will automatically terminate when both
traces finish.