Thanks for the replies, everyone.
BigEd wrote:
Welcome! You've got a good example there of the 6502's design style - it does indeed get more performance than you'd expect, in that data arriving on the data bus towards the end of one cycle can be output on the address bus early in the next cycle. You can do that on FPGA but you will have to pay attention to where you put your clock boundaries. Arlet's core manages to keep 6502 cycle counts, I think, even using synchronous memory. See
viewtopic.php?f=10&t=3453I'll take a look at that post now; thank you!
Rob Finch wrote:
There are a few different ways to work around the asynchronous vs synchronous ram issue. One would be to use two clock cycles for every equivalent 6502 clock in order to read the ram. There’s one 6502 emulator that uses four clock cycles per 6502 clock for instance. As long as the multiple is fixed, cycle counted games should still work.
By 6502 clock do you mean, for instance, if we're trying to emulate a 6502 running at 1 MHz, 1 us? And, if I'm understanding the idea you've proposed correctly, I could run the FPGA block RAM with a clock of half that (500 ns), thereby packing two FPGA cycles into a single 6502 cycle?
Rob Finch wrote:
If using the block ram in an FPGA asynchronous memory can be simulated by using the opposite (negative edge) of the clock while reading.
To make sure I'm understanding this correctly, I could use a synchronous block RAM which clocks out data on positive edges, and capture that data on negative edges, thereby capturing data in the same cycle that the data is read out of the RAM. This way, I'll have the captured the data before the next cycle, so it's almost like an asynchronous RAM. Is that correct?
For a bit of context, I'm interested in emulating an NES on an FPGA. At first, I thought I might just use already available 6502 cores, but then figured it would be a more interesting and educational project if I built the 6502 up from scratch. Based on your post, it seems that I might run into issues with some software, though, if I use one of these synchronous block RAM workarounds.