How does PC chip have to behave in CPU.hdl ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How does PC chip have to behave in CPU.hdl ?

Dasso
This post was updated on .
I have a compararison failure at line 53 in CPU.tst and I am surprising to see that the pc counter can stay to the same state PC(t) = PC(t-1) although the rules for the pc counter in CPU.hdl is normally :
if jump(t) the PC(t) = A(t-1)
else PC(t) = PC(t-1) + 1
So what behaviour pc counter has to respect ?
compare of CPU.tst
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How does PC chip have to behave in CPU.hdl ?

cadet1620
Administrator
The instruction that is being executed at time 26 is what's failing. Time 25+ shows the register values after the previous instruction.
|time| inM  |  instruction   |reset| outM  |writeM |addre| pc  |DRegiste|
|25+ | 11111|1110001100000101|  0  |*******|   0   | 1000| 1000|     -1 |
|26  | 11111|1110001100000101|  0  |*******|   0   | 1000| 1000|     -1 |
The failing instruction is "D;JNE". The D Register value is -1 so the jump should occur. Since the A Register—addre[ssM] column—is 1000, the PC should be loaded with 1000. Because the PC was already 1000, it appears as if it was unchanged.

I'm guessing that your miscompare is because the PC was incremented due to an error in your jump control logic.

For a jump not taken, look at the instruction at time 30. This is a "D;JGT" with D=0, so the PC increments.
|29+ | 11111|1110001100000001|  0  |*******|   0   | 1000| 1001|      0 |
|30  | 11111|1110001100000001|  0  |*******|   0   | 1000| 1002|      0 |
--Mark
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How does PC chip have to behave in CPU.hdl ?

Dasso
Thanks for your prompt and clear reply, now with your explanations my comparison ended successfully.

Dasso  :)
Loading...