Bus timing for 65c816 is potentially more challenging than timing for 65c02. Although address lines A15-A0 have the same job as on a 6502, D7-D0 carry extra activity. As noted in the data sheet, "The Data/Bank Address Bus pins provide both the Bank Address and Data. The bank address is present during the first half of a memory cycle, and the data value is read or written during the second half of the memory cycle." I started this thread because I thought it was worth discussing the details.
First, two diagrams. Below is my own edited version of Figure 4-1 from the '816 Data Sheet (Sept 2010 version). To put all the various delays in perspective I squeezed and stretched things so that
the diagram is now approximately to scale along the horizontal axis.
Assuming a 70 ns cycle (14 MHz), WYSIWYG!
WDC's original diagram has two errors of omission; my corrections are shown
in blue (I added 2 missing arrowheads and the value name tBH). Proofreaders welcome. Also, from Table 4-2, I copied in the actual delays (in ns.) that pertain to 5V operation. The clock rise & fall times have not been adjusted to scale.
Attachment:
65816 timing.gif [ 48.31 KiB | Viewed 15294 times ]
The next diagram (below) shows the extra activity on D7-D0, as compared to a 6502. D7-D0 are bidirectional, meaning that the CPU and the system board must both drive them -- but of course never simultaneously, which would amount to a collision (aka
bus contention).
Attachment:
data bus activity for 6502 vs 65816.gif [ 10.8 KiB | Viewed 14932 times ]
It's when the bus reverses direction that there's potential for a problem. A graceful reversal demands that the CPU release the bus before the memory or transceiver on the system board commences to drive it. Likewise the system board must release the bus before the CPU commences to drive it.
With 6502, it's easy. The bus never reverses direction except when read cycles are interspersed with writes. More to the point, neither the processor nor the system board (if it's properly designed) drives the data bus during Phase 2 low.
The "dead time" during 65c02 Phase 2 low is actually extremely valuable! It acts as a timing cushion that accommodates real-world variability -- for example, the tri-state enable & disable delays of the memory or transceiver that drives the bus, the delay of the glue logic in control of that, and the timing variability of the CPU's own internal bus driver. These delays can't be exactly predicted, and vary independently of one another. The dead time will be at its most brief when the device releasing is at its slowest and the device asserting is at its fastest. But the 6502 has plenty of wiggle room. The dead time is nominally 50% of the cycle, and won't get eaten up even after a margin is subtracted for variability in logic and tri-state delays.
With the '816, it's a stickier situation. Even in the case of successive read cyles, the bus must reverse direction. But really the crucial issue is...
- in Phase 2 low the CPU drives the Bank Address onto the data bus
- instantly thereafter, during Phase 2 high, memory drives data on the bus
- instantly thereafter it's back to the CPU driving the Bank Address onto the data bus
Stated another way, the dead time is zero even
before a margin is subtracted for variability in logic and tri-state delays. Of course the variability might trend in your favor,
creating a dead time. But it equally might trend the other way and create bus contention. I'm not aware of any really good solution for this.
What I'd like to determine is how best to design for the '816. Here's Figure 5-1.
Attachment:
65816 Bank Address Latching Circuit.gif [ 15.86 KiB | Viewed 15320 times ]
I'm sure this circuit has been used successfully many times, but it's somewhat vague. Is it safe to assume that, for the "74x245" bus transceiver, we can use anything from a 74LS245 to a 74BCT245? What if it's a CPLD or some other device that connects to D7-D0? How do we ensure that the bus enable and bus inhibit times are appropriate for avoiding bus collisions with the '816? Here's what we have to go on:
Attachment:
65816 bus assert-release.gif [ 9.18 KiB | Viewed 15294 times ]
- I think we can accept tBAS (max 33ns) as the maximum delay from Phase 2 low until the '816 asserts the bus. What's the minimum?
- Likewise, tBH (min 10) can be interpreted as the minimum delay from Phase 2 high until the '816 releases the bus. What's the maximum?
- tDHR (min 10) can be interpreted as the minimum delay from Phase 2 low until the system board releases the bus. What's the maximum?
- As for the delay from Phase 2 high until the system board asserts the bus, none of the values in the diagram seems directly pertinent, either for maximum or minimum.
Is there something I've overlooked, or do these specifications fail to tell the whole story?
cheers,
Jeff
[Edits: 2 more missing specs noted in the last paragraph. Altered text and new "data bus activity" and to clarify contention issue.]