6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Sep 20, 2024 3:36 pm

All times are UTC




Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Sun Jun 07, 2009 4:11 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
BigDumbDinosaur wrote:
BigEd wrote:
"... paragraph 2.24 ... RDY ... halt ... current state." I'm not left with any doubt about the behaviour of the address bus in a wait cycle.

I am, because the discussion dwells on the state of D0-D7 but doesn't explicitly describe the state of A0-A15 while *RDY is asserted.
[/quote]
Are you reading too much into section 7.6, which only aims to clarify the dual-use of the databus? 2.24 has already done the job of specifying what happens. If 7.6 were missing, you might be better off because you wouldn't be hunting for an explicit statement about the address bus.

BigDumbDinosaur wrote:
BigEd wrote:
However, I'm hesitant to proceed on a design without knowing for sure.

Maybe you need a prototype. Or maybe you can get more reassurance from WDC than they've given you so far. I'm sure the part works the way you want it to. How else could it work? It was designed for ease of use and compatibility with the 65C02, by very capable people, and it's had a long and successful life.

BigDumbDinosaur wrote:
Have you worked out how to actually generate the wait state for n Ø2 cycles?

Not in detail, but the shift register design noted earlier would be the way I'd go. If n is small that's just one or two flops, of course. See also http://tinyurl.com/o49kkf

Cheers
Ed


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 07, 2009 4:47 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
BigEd wrote:
BigDumbDinosaur wrote:
Have you worked out how to actually generate the wait state for n Ø2 cycles?

Not in detail, but the shift register design noted earlier would be the way I'd go. If n is small that's just one or two flops, of course.

Noted earlier where?

BigEd wrote:

I'm familiar with the above circuit. However, it has the limitation of generating a wait-state of a fixed duration. A better design would be one where n would be determined according to the device being accessed. For example, if a slow EPROM is being accessed, a longer wait state would be required than when accessing an I/O device. Some means of changing n based upon the address of the accessed device would be ideal.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jun 07, 2009 4:57 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Quote:
Noted earlier where?

I gave this link to André's design.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jun 07, 2009 5:54 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
BigEd wrote:
Quote:
Noted earlier where?

I gave this link to André's design.

Hmm...I don't recall seeing your reference to it. Guess I must be too bleary-eyed when I read these posts. :)

I have looked at that one in the past. It too produces a fixed length wait-state.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jun 07, 2009 7:42 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8510
Location: Southern California
Quote:
In all likelihood, a design meant to run at 20 MHz would be better served by using some sort of PLD to generate the required logic.

I think what I'd do is use a variable delay device like you can get from Dallas Semiconductor or Data Delay Devices, Inc., with perhaps 256 steps of 1/4ns each (not that you would need that many steps), put it in parallel with a fixed-delay buffer so one feeds phase 2 to the system and the other feeds the address high byte latch, and find out what value lets the whole thing operate at the highest possible frequency. When I was looking at the timing charts years ago regarding the '573 latch timing, there were conflicts, but there was a 20MHz '816 design in production and being sold; so I knew it was possible. I wrote to WDC about it; but although they acknowledged what I was saying, they weren't able to give a good answer other than recommend experimenting.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jun 07, 2009 8:14 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
GARTHWILSON wrote:
When I was looking at the timing charts years ago regarding the '573 latch timing, there were conflicts, but there was a 20MHz '816 design in production and being sold; so I knew it was possible. I wrote to WDC about it; but although they acknowledged what I was saying, they weren't able to give a good answer other than recommend experimenting.

The F Max vs. VDD curve (fig. 4-2 on page 27 of the data sheet) suggests the current production MPUs can still run at 20 MHz. Given today's wafer production capabilities, a relatively uncomplicated design like the '816 (as compared to, say, an Athlon 64) should produce high yields capable of running at the top end of the curve. After all, as we all know, there is no such thing as a computer that is too fast. :)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 18, 2009 5:46 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
BigDumbDinosaur wrote:
Hi all:

I'm in the early stages of developing a 65C816 design in which I may need to generate wait states when accessing one of the I/O devices. It seems the key to doing so is judicious use of the MPU's *RDY line.

Upon reading the WDC data sheet and studying the somewhat stilted timing diagram, my understanding of how the MPU behaves when *RDY is asserted is that if the assertion occurs when Ø2 goes high, the MPU will halt and maintain the state of the address and data lines. If this is true, it seems any address the MPU placed on A0-A15 would remain valid and the slow device would have adequate setup time to respond to R/W.

Can anyone here confirm this? Am I misinterpreting this?

:-)

It has been determined that the '816 will maintain the state of A0-A15 when *RDY is asserted. If *RDY is asserted when Ø2 is high and if the MPU is stalled by *RDY while executing a write operation, the state of D0-D7 will also be valid. Therefore, it should be possible to reliably execute wait states of any duration, as long as the assertion of *RDY occurs when Ø2 goes high.

It is clear that a practical system utilizing wait states should qualify all addresses relative to Ø2. If a wait state is to be generated, *RDY should not be asserted while Ø2 is low, as doing so would prevent the bank address from being latched.

Once the wait state period has expired, *RDY can be de-asserted without regard to the state of Ø2, as the MPU will not resume until Ø2 goes high again following the release of *RDY.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 20, 2009 1:20 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1041
Location: near Heidelberg, Germany
BigDumbDinosaur wrote:
BigEd wrote:
I'd also agree that it may be convenient to derive RDY externally from a register clocked by the rising edge of PHI2. I see André Fachat has a page on this site about RDY generation (admittedly for 65C02).

Unless I'm misreading the WDC 65C02 data sheet, it would respond to *RDY in the same fashion as the '816. André's circuit seems unnecessarily complicated, given that the 'C02 data sheet specifically states that A0-15 and D0-D7 will maintain state if *RDY is asserted when Ø2 is high.


I will put a note on the page - this special case is where the actual slow chip is clocked with the select line, as it does not have an own Phi2 input. Otherwise the circuit could really be simpler.

André


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 20, 2009 1:24 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1041
Location: near Heidelberg, Germany
BigDumbDinosaur wrote:
Once the wait state period has expired, *RDY can be de-asserted without regard to the state of Ø2, as the MPU will not resume until Ø2 goes high again following the release of *RDY.


Does that actually mean I should have to release *RDY during Phi2 low to have the actual transfer following in the next Phi2 high phase?

Your statement implies that if I release *RDY during Phi2 high, the CPU will wait for Phi2 low, and then Phi2 high again to actually do the memory transfer?

This could - not necessarily but probably - explain some weird issues I have with my 65816 prototype board where I release *RDY during Phi2 high - expecting that the actual data transfer happens during that Phi2 high where I released *RDY.

Can you clarify this?

Many thanks
André


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 20, 2009 2:21 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
My understanding is that the 816 samples RDY on the falling edge of PHI2 - right at the end of the clock cycle - and uses that value to decide whether the next cycle is a wait state. Internally, it is exactly as if the sampled RDY input can hold the internal version of PHI2 high. In a wait state, the core of the chip does not see a falling PHI2 (or indeed the next rising PHI2)

Therefore, it doesn't matter whether RDY changes early in the cycle - during PHI2 low - or late - so long as it is stable by the falling edge less a setup time. RDY is a clocked input.

In the case of a read with wait states, the CPU will effectively sample and capture the databus when there's a PHI2 falling with RDY high.


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 20, 2009 6:50 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
fachat wrote:
BigDumbDinosaur wrote:
Once the wait state period has expired, *RDY can be de-asserted without regard to the state of Ø2, as the MPU will not resume until Ø2 goes high again following the release of *RDY.

Does that actually mean I should have to release *RDY during Phi2 low to have the actual transfer following in the next Phi2 high phase?

Your statement implies that if I release *RDY during Phi2 high, the CPU will wait for Phi2 low, and then Phi2 high again to actually do the memory transfer?

Unfortunately, the '816 data sheet's description of the MPU's behavior in response to RDY leaves a bit to be desired. However, two key sentences, along with study of the timing diagram and some discourse with WDC, helps a bit:


    A low input logic level will halt the microprocessor in its current state. Returning RDY to the active high state releases the microprocessor to continue processing following the next PHI2 negative transition.

65C816 Timing Diagram

The description of RDY in the 65C02 data sheet is actually more illuminating. Here's an excerpt:


    3.10 Ready (RDY)

    A low input logic level on the Ready (RDY) will halt the microprocessor in its current state. Returning RDY to the high state allows the microprocessor to continue operation following the next PHI2 negative transition...A negative transition to the low state prior to the falling edge of PHI2 will halt the microprocessor with the output address lines reflecting the current address being fetched...This condition will remain through a subsequent PHI2 in which the ready signal is low...The microprocessor will be released when RDY is high and a falling edge of PHI2 occurs.

My analysis suggests the following (see above timing diagram):

  • To start a wait state, assert RDY on the rise of Ø2 (PHI2). At that point in time, the MPU has made all relevant outputs valid except D0-D7. The MPU will not react to RDY until tMDS nanoseconds have elapsed, during which time D0-D7 will have become valid (if a write operation). At the expiration of tMDS the MPU will sample RDY and will halt, maintaining the state of all outputs. RDY should be held low for as many clock cycles needed for the addressed device to become active.

  • To end a wait state, de-assert RDY on the rise of Ø2. Again, the MPU will not sample RDY until the expiration of tMDS. Resumption of operation will occur on the fall of Ø2 immediately after the sampling of RDY.

Although the timing diagram implies that RDY can be asserted at any time, I was told that the MPU's behavior is undefined if RDY is asserted when Ø2 is low and hence the bank address may not be valid. I believe that any design that asserts/de-asserts RDY on the rise of Ø2 should work as expected.

BigEd wrote:
My understanding is that the 816 samples RDY on the falling edge of PHI2 - right at the end of the clock cycle - and uses that value to decide whether the next cycle is a wait state. Internally, it is exactly as if the sampled RDY input can hold the internal version of PHI2 high. In a wait state, the core of the chip does not see a falling PHI2 (or indeed the next rising PHI2)

Therefore, it doesn't matter whether RDY changes early in the cycle - during PHI2 low - or late - so long as it is stable by the falling edge less a setup time. RDY is a clocked input.

In the case of a read with wait states, the CPU will effectively sample and capture the databus when there's a PHI2 falling with RDY high.

See above comments.

————————————————————
EDIT: Fixed link to timing diagram image.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Last edited by BigDumbDinosaur on Sun Oct 23, 2022 12:53 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 20, 2009 7:20 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
BigDumbDinosaur wrote:
Although the timing diagram implies that RDY can be asserted at any time, I was told that the MPU's behavior is undefined if RDY is asserted when Ø2 is low and hence the bank address may not be valid.


Interesting if the behaviour is indeed undefined, and perhaps a little inconvenient.

BigDumbDinosaur wrote:
I believe that any design that asserts/de-asserts RDY on the rise of Ø2 should work as expected.

Your rule is stricter than mine, and if we've reason to doubt then following that rule would be safe. Someday I might be a position to investigate the behaviour of parts I have, and I could prove myself wrong. I couldn't show I was right, if the behaviour is not defined.

The thing is, I haven't seen the ambiguity in the datasheet which you saw.

It's certainly true that if RDY is not sampled, but just modifies the internal clocking combinatorially, modifying it during PHI1 might cause the role of the databus to switch between data and address. And it's true that if it is sampled, its value outside the setup+hold window can't change the behaviour of the device.

I think neither of us have experimental evidence either way - just possibly André has seen something, except he describes modifying RDY during PHI2, which both of us think should be fine.


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 20, 2009 7:34 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
BigDumbDinosaur wrote:
My analysis suggests the following (see above timing diagram):
    * To start a wait state, assert RDY on the rise of Ø2 (PHI2). At that point in time, the MPU has made all relevant outputs valid except D0-D7. The MPU will not react to RDY until tMDS nanoseconds have elapsed, during which time D0-D7 will have become valid (if a write operation). At the expiration of tMDS the MPU will sample RDY and will halt, maintaining the state of all outputs. RDY should be held low for as many clock cycles needed for the addressed device to become active.

    * To end a wait state, de-assert RDY on the rise of Ø2. Again, the MPU will not sample RDY until the expiration of tMDS.


BDD, looking again at the timing diagram, and re-reading your description above, I wonder: are you reading tMDS differently from the way I am? For me, the text is vertically mis-aligned. It describes the distance from PHI2 rising to the earliest time that the databus will hold valid data. It isn't saying anything about the timing of data relative to the processor control signals. It's a description, not a constraint.


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 20, 2009 8:13 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
BigEd wrote:
BDD, looking again at the timing diagram, and re-reading your description above, I wonder: are you reading tMDS differently from the way I am?

Now that you mention it, could be. It appears at first blush that tMDS extends from the time that D0-D7 become valid until the MPU samples RDY. The data sheet description of tMDS isn't particularly illuminating:

tMDS -- Write Data Delay Time

A second look suggests that tMDS actually starts at the rise of Ø2, which means data (write operation) becomes valid about midway through the Ø2 high cycle. Be that as it may, it still appears the best time to change the state of RDY is on the rise of Ø2.

Perhaps WDC needs to hire a new artist to draw the timing diagrams, or I need to have my glasses prescription re-evaluated. :)

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Dec 20, 2009 8:25 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
fachat wrote:
... some weird issues I have with my 65816 prototype board where I release *RDY during Phi2 high - expecting that the actual data transfer happens during that Phi2 high where I released *RDY.


The way I see it, if you started the cycle with RDY low, it's a wait state. Which is to say, the function of the previous cycle is extended into this cycle. If during PHI2 you bring RDY high again, the next cycle will be the normal next cycle (perhaps an instruction fetch) and the memory access you're performing will finish at the end of this cycle: the falling edge of PHI2. For a write, that simply means the databus and address bus will change shortly after the fall of PHI2. For a read, it means the processor samples the databus on the fall of PHI2, and that's the value seen by the read.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 44 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: