[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 6502 illegal opcodes questions



John Selck wrote:
Michael J. Mahon wrote:

True, but the decoding in the 6502 is handled by a kind of PLA, so
it would likely not be very expensive (in real estate) to trap or
NOP the invalid combinations.


The 6502 is a design to have as few transistors as possible. The whole CPU only has a few thousand of them. Handling the illegals would have increased this small amount a lot.

Actually, neither of us has the data on how much would have been
required.  I argued that if the decoding is regular--as in PLA--
then the cost might have been relatively modest.

From looking at the Hungarian reverse engineering of the 6502, it
appears that I was right about the PLA decoder.  A PLA is used to
derive control signals from the op register.

Admittedly, though, the microprocessor design culture at that time
was not oriented toward "protecting" undefined space, as they all
have been in the years since.


It's not about culture, it's about being able to do more with just a few transistors. What CPU would you buy? The one which can do less has NOPs instead of illegals, or the one which can do more?

The difference would be in die size, and therefore cost.

And just "getting it done" with absolute minimal die size *is* a design
culture.  (One that is no longer current in commercial microprocessors.)

Moore's "Law" has provided a great deal of freedom in design cultures.
;-)

Removing illegals is ok if you only waste 1000 transistors of 1000000, but if it's 1000 transistors of 6000, then it's a whole different matter.

I admit that I don't have a quantitative estimate of the number of
transistors (PLA terms) required to protect at least most of the
unused opcode space, but I suspect it would not be more than a few
hundred (out of about 3700 in the 6502).

Since the decoding is done with a regular (rectangular) PLA, the real
issue is not the number of transistors, but the number of rows and
columns required to make a "complete" decoder.  This would add slightly
to the chip dimensions.  Adding terms to the PLA within the existing
matrix would not add to chip size.

Any quantitative estimate would need to be based on the actual 6502
implementation.

-michael

Music synthesis for 8-bit Apple II's!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."