View unanswered posts | View active topics It is currently Wed Apr 24, 2024 1:23 am



Reply to topic  [ 2 posts ] 
 6502 instruction pipeline 
Author Message

Joined: Mon Dec 28, 2015 11:37 am
Posts: 13
In another thread...
BigEd wrote:
If you look at the tabulated state changes in this simulation you'll see that the Z flag is updated in cycle 9...

This is the program:
Code:
LDX #$02
DEX
BEQ skip
DEX
BEQ zero
LDA #$7f
skip:
LDA #$44
zero:
LDA #$67
NOP
NOP

Wow! I learned something new today, ehm tonight. Looking at the DEX instruction, the 6502 have a much deeper pipeline than I ever thought!

I always assumed that cycle 1 was a fetch, and everything else happened in cycle 2, decode, execute, writeback.
The above simulation show that even on a single byte instruction nothing is executing before cycle 3. Cycle 2 is decode, cycle 3 is execute, and cycle 4 is writeback.
Fetch cycle and execute from previous instruction is overlapping as is the decode cycle and writeback from previous instruction.

That double instruction fetch after single byte instructions always seemed strange (wasted) to me but now I understand why... It just took me 40 years. :)


Last edited by spiff on Thu Aug 31, 2023 11:06 am, edited 1 time in total.



Tue Aug 29, 2023 9:59 pm
Profile

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1783
I think we all learned a lot when visual6502 came out! But some things can be figured out from observation and thinking hard.

For reference, this is the thread you mention


Wed Aug 30, 2023 2:47 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software