6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 10:50 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Jun 02, 2023 1:32 pm 
Offline

Joined: Wed Jun 26, 2013 9:06 pm
Posts: 56
Single meaning, that the output changes as soon as it gets written to, vs double, as in a "slave-master" flip-flop where the second latch waits for the first latch to finish latching before it updates the output.

The fact that most websites describe the fetch cycle in the fetch-decode-execute pipeline is "Program counter gets copied to address bus output register, and fetches the instruction" which implies that it uses a single latch. However, I know that CPUs are supposed to keep the bus latency to a minimum which kind of implies that they use double latches, but if that is the case, then the "fetch" cycle would simply be just preparing the next address, and the "decode" cycle would be fetching the memory for real, and the "execute" cycle would be doing both the actual instruction decoding and executing at the same time. Or maybe the memory address gets output from the second half of the fetch instruction, and the actual instruction decoding starts in the second half of the decode instruction.


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 02, 2023 8:28 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
I'm not totally sure what you're asking; but the '816 data sheet has a portion, Table 5-7 Instruction Operation, which also covers the '02, regarding what happens in each cycle of each instruction.  I see the one we have on this website needs updating.  Slightly newer is the one at http://www.westerndesigncenter.com/wdc/ ... 5c816s.pdf .  I'll try to get ours updated.  The address goes out soon after Φ2 falls, as shown in the 65c02's timing diagrams, and the time limits are given in the "AC Characteristics" table.  The address is valid and stable well ahead of the rise of Φ2, and remains there until just after the fall of Φ2.  The instruction at that address is fetched.  It cannot be decoded at the same time, because the processor allows the memory time to respond, right up to a few nanoseconds' setup time before the fall of Φ2, whereupon the value on the data bus gets latched into the processor.  In the next cycle, the next address is read, even though it is not known yet what it will be for, while the instruction that was read in the first cycle is being decoded.  The processor only puts out one address per cycle.  Instruction decoding and executing do not happen at the same time.  What happens in the case of many of them is that the next instruction's op code is being fetched while execution of the current instruction is finishing.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 03, 2023 6:08 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
All modern logic uses master slave flip flops. Latches are only used in a few specialty circuits. Older logic, such as the NMOS 6502, used latches throughout the design. In theory, taking a flip flop apart into 2 latches and then separate them, gives you more design flexibility. In practice, it's not worth it, because the gains are small, and timing analysis gets a lot harder.

Statements such "Program counter gets copied to address bus output register" should not always be taken literally. There's an address bus output register, and that gets loaded with the output of a combinatorial logic tree, which has the program counter as one of the possible inputs. For instance, there could be a program counter register, and there could be a case where you need to increment PC and then transfer AB <= PC. While that is a natural way to describe things, the reality is that PC <= PC + 1 happens in parallel with AB <= PC + 1 so it can be done in a single cycle.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 04, 2023 4:40 am 
Offline

Joined: Wed Jun 26, 2013 9:06 pm
Posts: 56
If all modern CPUs use master-slave flip flops, does that mean the PC has to be copied to the address bus register a cycle ahead of time?


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 04, 2023 5:01 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Aaendi wrote:
If all modern CPUs use master-slave flip flops, does that mean the PC has to be copied to the address bus register a cycle ahead of time?

In a sense, yes. At every cycle N, you have to figure out, using the current state and inputs, what you're going to load in the registers on cycle N+1. If you don't know yet what to do, because you're waiting for a decoder, then typically you simply increment the address bus register, because that's most likely to be correct. If it turns out that was not correct, for instance because you needed to take a branch instead of continuing straight, then an extra delay cycle gets inserted to catch up.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: pdragon and 41 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: