Dr Jefyll wrote:
BigDumbDinosaur wrote:
VDA and VPA for device access qualification should be a part of any design. It may be the simplified method suggested above by Jeff (Dr. Jefyll) or the "belt and suspenders" method that ORs VDA and VPA
Thanks for the plug, BDD! I admit the "simplified method" is a new idea for me, although perhaps others have used it previously.
Looking back at an old revision of POC V1.0's circuit after the 2692 problem surfaced, it seems I did sketch up a circuit using VDA alone to qualify I/O, but then added VPA to the mix to prevent an opcode fetch out of the I/O block, mostly as protection against a programming error (a read out of I/O when
VDA && VPA is true returns $00).
Quote:
This discussion has forced me to do some careful thinking. Hence the realization that, for protection against dummy cycles, it's entirely sufficient to use VDA alone to qualify reads of I/O devices.
Unfortunately, "belt and suspenders" is a poor characterization for the method that ORs VDA and VPA. That method has no advantage except in a limited sense which I will explain (and dismiss) directly. But the disadvantages include added complexity, extra prop delay, and -- this last point is a double-edge sword -- it causes program accesses (code fetches) to be allowed rather than suppressed.
In principle, I agree with your approach, in that it reduces the gate count to some extent and thus prop time. In POC V1.1's case, I already had a 74AC32 quad OR gate in the circuit, with two unused gates available. So it was merely a case of hooking up a few extra connections—no additional PCB real estate was used. A byproduct of that arrangement is that all RAM, ROM and I/O accesses are fully qualified, so I didn't have to be concerned about an invalid address causing any trouble. The way in which I did it adds no prop time to decoding—a goal I had set of having no more than two gates between the address bus and device selects was maintained.
Quote:
BigDumbDinosaur wrote:
some hardware will malfunction if subjected to random selects due to invalid address bus states. We don't know what that hardware may be.
..."How can I determine which memory & IO devices need protection?" Regarding "which devices need protection?" there are three choices:
- consult the device datasheet
My first recommendation. The only caveat is that the quality of data sheets widely varies and sometimes the side-effects of random selections resulting from invalid bus states may not be couched in the best of terms. In some cases, the data sheet may actually be incorrect in describing the "gotcha." For example, the Philips/NXP 26xx data sheet implies that command register accesses are timing-sensitive only following a write—which I subsequently found out isn't the case (any access is timing-sensitive).
Quote:
c. protect all the memory & IO devices, because you're uncomfortable or lack confidence in (a) and (b).
That was my approach with POC V1.1, which is why I attached the "belt and suspenders" adjective.
It is a bit of an overkill approach in my application.
Quote:
Option (c) translates to including the OR gate. That's because memory devices may contain code, and, as noted, ORing in VPA is what causes code fetches to be allowed rather than suppressed. Oops! Now we're forced to ask, is it worth adding complexity and increasing propagation time to avoid options (a) and (b)? Probably not. And avoiding options (a) and (b) is the only extra protection afforded by the belt & suspenders method.
So far, the effects of invalid bus states have mostly been manifested in I/O device errors of one sort or another. However, cbscpe describes an
issue involving an EEPROM subject to in-circuit programming. Since opcode fetches are to be expected from an EEPROM that contains the system firmware, the ORing of VDA and VPA becomes necessary to qualify access. Of course, if the EEPROM is only a data source, VDA qualification alone will suffice.
The effects of interposing yet another gate in the logic path are largely effaced if programmable logic is used, as a PLD's prop time is pin-to-pin, regardless of the number of gates actually in between inputs and outputs (pin nodes are different, but seldom needed in CPLDs and FPGAs). In a protected hardware environment, it would make sense to prevent opcode fetches on I/O hardware, a feature easily implemented in a PLD. Also, the logic could be made to look at opcodes as they are about to be fetched and do something if an opcode is not allowed (e.g., STP). VPA would have to be accounted for in such a case.
That said, not everyone is ready to dive into programmable logic, so your simplified method has plenty of merit, as long as the experimenter understands the implications of leaving VPA out of the equation.
Quote:
BigEd wondered if it might be better to use the term "incidental" rather than "invalid" bus states, and remarked there's "nothing surprising going on." That remark may be a tad too strongly stated, but let's be clear about one thing: it is possible for mere mortals to understand the dummy cycles and predict their effect on various devices!
Presumably, anyone using the 65C816 in a homebrew computer, or as an upgrade to an existing design, would have the ability to read and understand the relevant data sheets. Of course, sometimes things aren't adequately described in data sheets and something gets lost in the process. I ran into that with the 53C94's data sheet when I was trying to get my SCSI host adapter up and running.
I suppose WDC could expand on the description of VDA and VPA in a way that would make it crystal clear to the designer that the invalid bus states are a potential source of trouble. However, anything they would write in that regard would necessarily be quite generalized.
Quote:
For example, BDD, you mentioned that the Dallas DS1511Y timekeeper doesn't seem to care about dummy cycles...a quick skim of the DS1511Y datasheet gives us the heads-up about a latent threat...TDF, WDF, KSF, and IRQF (these are interrupt flags) are cleared by reading the flag register...
I mentioned that because I use indexing to write setup values into the DS1511Y's registers, using the same coding technique as used for other I/O devices. No malfunctions have occurred, and didn't occur in POC V1.0 before I patched it to deal with VDA and VPA. I should note that during the 1511's setup, interrupts are disabled and following reset, the device has no interrupt sources enabled. So if an access to the interrupt flag register were to occur due to an invalid bus state, it wouldn't cause any harm. However, once the 1511 has been programmed, IRQs are enabled and now a wild access could cause trouble, especially considering that the 1511 generates the 100 Hz jiffy IRQ. If that dies so does the system.
Quote:
The subject needn't be a breeding ground for F.U.D. (fear/uncertainty/doubt)! That's probably why Ed wanted to avoid the term "invalid states" -- it's too mysterious and threatening. I don't believe he intended to "dismiss this characteristic of the 65C816 as unimportant."
I'm certainly not trying to foment FUD (that's Microsoft's job
vis a vis Windows XP). I just don't want someone to make the error I made of dismissing the importance of this characteristic.
Quote:
(BTW and FWIW, "dummy cycles" is the term I prefer.
)
I use the word "invalid" because that is what WDC uses in the data sheet. Pedantically speaking, there are no dummy cycles in the '816, as some kind of processing goes on during every instruction cycle. It's the state of the address and data buses during those intermediate cycles of which we have to be aware.