While testing Computer.hdl ,the first C-instruction of the loaded file took 2 time units to execute while all the other instructions took the required amount of time to execute.
The memory and the CPU implementations are correct as the Script-Based simulation's result was:
"End of Script-Comparison ended successfully" and I tried interactive simulation and got the desired result for the Memory and the CPU chip. I am not able to understand this problem. Any suggestion?
Isn't the issue you are asking about is why the first instruction seems to take two clock cycles to execute?
The answer is that it doesn't. The first clock cycle the chip is in reset and the second clock cycle is when it executes the first instruction. So the PC is 0 for both of those clock cycles, but for different reasons.
If that's not the problem you are trying to explain, please try to explain the problem in more detail.
What happened was, that you told me to look properly at the PC. While doing that, I noticed that because of the circle problem I had stored the output of the PC into a register which made the computer slow.
While trying to fix the PC problem, I removed the register which stored the output of the PC. To prevent the circle problem, I tried to put the output of the ROM into a register.
But even that made the computer slow.