54 points · by ibobev · 4y ago · 32 comments
lda #firstbyte
sta dest+0
lda #secondbyte
sta dest+1
etc.
6 cycles per byte, so 166KB/sec. But we can do better: there are only 256 different bytes, so group the stores by byte value so that you don't have to reload before each one: lda #0
sta dest+10 ; All the places that get 0
sta dest+29
sta dest+42
lda #1
sta dest+3 ; All the places that get 1
sta dest+82
etc.
Up to 250 KB/sec and less space. If the prior data in dest is known, it could be even faster: skip stores where the destination already has the correct data. And even faster: for video, skip stores which have a low hamming distance from the prior bytes and put up with a bit of noise..Also FYI, that 6 cycles to load/store each byte is only if you're writing to zero page (an 8-bit address, meaning the first 256 bytes of the address space.) Stores to a 16-bit address take one more cycle, 4 instead of 3, to read the operand when it's a two-byte address instead of one.
Is anyone here an EE, who has access to original circuit design, knows how to translate to vhdl, verilog, or what have you, and also just happen to have the money lying around to have TSMC tape out the design so we can find out? :D
You could also do pipelining and parallel/out-of-order execution like modern processors, if you weren't worried about retaining cycle-for-cycle compatibility. You could even build it with a wider bus, so that you could read all of a 2/3/4 byte instruction in one cycle. Although at that point it's really semantics as whether you call it a 6502 or a new processor with binary compatibility.
I think this could work, although if that means the ram is on die, setting up the memory map is much more complex (although maybe you just have a chip select pin for the on-die ram, and have your address decoder circuitry select it when appropriate for your system)
> You could also do pipelining and parallel/out-of-order execution like modern processors
I don't think that fits the prompt of same fundamental design though.
You could hypothetically make a 6502 with a wider or dual bus, so that it could read or write more than one byte per cycle or both at the same time, if whatever else is on the bus on the other ends of the reads/writes is compatible with that. In that way you could speed up executing 6502 instructions by more than just increasing clock speed.
You can get a 100Mhz FPGA based 6502. http://www.e-basteln.de/computing/65f02/65f02/
Since FPGAs are significantly slower than ASICs, it seems like a 1Ghz 6502 wouldn't be unreasonable. The problem is, what would you do with it? The CPU would be severely bottlenecked by its peripheral interfaces.
Here’s a “100 MHz 6502”: http://www.e-basteln.de/computing/65f02/65f02/
Obviously execution was slow, but it was a great exercise to show the class just how simple the 6502 was.
The more interesting thing I think is that the existence of this official IP core implies that it is already out in production in millions of components, like the Tamagotchi[1] and Furby[2], presumably running at a very diverse array of clock frequencies. I wonder which product has the fastest WDC 6502?
[1] https://hackaday.com/2013/05/24/tamagotchi-rom-dump-and-reve...
[2] https://official-furby.fandom.com/wiki/Furby_(1998)/Technica...
https://3.14.by/en/read/arduino-liquid-nitrogen-overclocking