Hi cr1901
just in case it helps, here's the tabulation from the visual6502 simulation:
Code:
cycle ab db rw Fetch pc a x y s p ir
0 0000 88 1 DEY 0000 aa 00 00 fd nv‑BdIZc 00
0 0000 88 1 DEY 0000 aa 00 00 fd nv‑BdIZc 00
1 0001 d0 1 0001 aa 00 00 fd nv‑BdIZc 88
1 0001 d0 1 0001 aa 00 00 fd nv‑BdIZc 88
2 0001 d0 1 BNE 0001 aa 00 00 fd nv‑BdIZc 88
2 0001 d0 1 BNE 0001 aa 00 00 fd nv‑BdIZc 88
3 0002 02 1 0002 aa 00 ff fd Nv‑BdIzc d0
3 0002 02 1 0002 aa 00 ff fd Nv‑BdIzc d0
We can all agree that adding a DEY to a program will add two cycles. As Michael puts it:
Quote:
As pointed our here (or on another thread), a rudimentary amount of overlapped instruction fetch and execution is provided. Perhaps it may be more clearly stated to say that the these processors try to overlap the instruction fetch and write back phases of an instruction's execution.
From a CPU implementation perspective, I think it is helpful to see four cycles of activity corresponding to that DEY - two or three of which are overlapped. The final write back cycle is worth including because there is no overlap in the case where it's a memory store, only when it's a write back to a register. For the case of an instruction like DEY, we have:
Cycle 0: fetch, maybe overlapped with previous instruction's writeback
Cycle 1: decode
Cycle 2: execute, may be overlapped with next instruction's fetch
Cycle 3: writeback, may be overlapped with next instruction's decode
If you trace also the signals sb, alu, DPControl in visual6502, you'll see that the new value for Y is written back to the Y register during the first half of cycle 3, over the sb (Special Bus) - therefore it's valid to say that the 6502 is still working on the DEY in that cycle, even though the IR now contains the next instruction. There are pipelined state bits in the random control logic which continue to control the datapath with the appropriate actions for the previous instruction. For example, node 460 goes low in the second half of Cycle 2, and then dpc1_SBY is valid in the first half of Cycle 3 for the writeback.
It can be useful also to trace the Execute and State pseudosignals, or to use the Logmore button.
http://visual6502.org/JSSim/expert.html ... ,DPControlIf you're not thinking about CPU implementation, but only thinking about programming the CPU, then you don't need to go into such fine detail - you probably only care about the incremental extra cycles for each instruction, if you even care about that. Of course, the datasheets are written for programmers, not for CPU designers.
Hope this helps
Ed