Enhanced Dynamically Reconfigurable Systems Using CPLD/FPGA
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Arlet wrote:
Quote:
Using multiple clocks may not even be necessary. What I did in my project was generate an internal 96 MHz clock, and divide it by 12 to generate the 8 MHz output clock for the 65C02. Starting at falling edge of PHI2 I would wait (internal) 4 cycles, and grab the address from the 6502 bus, and copy it to the SRAM address bus. Two cycles later, I would take the data from the SRAM bus, and write it to the 6502 bus, with a few cycles to spare. In the remaining 10/11 cycles the SRAM was free to be used by the FPGA.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
jmp(FFFA) wrote:
I'm not sure what you are using all of the I/O pins for
Quote:
Have a look at the two FPGAs above and let me know what you think. If you don't need more than 160 pins for what you're thinking of using it for, then perhaps there is no need to go to a BGA package. I don't expect that soldering the 240-PQFP package will be fun, however! 
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Quote:
PS/2 port for a keyboard interface (USB is another possibility though more work)
How about audio out ?
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Arlet wrote:
Quote:
PS/2 port for a keyboard interface (USB is another possibility though more work)
How about audio out ?
Regarding audio -- there are many approaches possible here. If processing power were not a factor, I'd probably want a 44.1 kHz stereo audio codec. But if the sound will be generated by the 65C02 or 65C816 directly, it makes sense to scale this down a bit. As I recall, machines from circa 1990 often had an 8 kHz mono 8-bit codec chip, which is probably within the realm of possibilities for a fast 65C02 or 65C816 to work with. I guess it also depends for what purpose you have in mind to put this machine. I prefer an audio codec for general purpose use. But if you have in mind specific applications (like gaming), then other choices may make more sense. Perhaps a third choice would be to provide some kind of audio accelerator which would, for example, allow the 65C02 to pre-generate various sounds, store them in memory somewhere, and then tell the FPGA to play the sequences at specific times of its choosing. That would offload the processing from the CPU but allow high quality sound to be generated if desired (at the cost of some memory).
Thanks for the schematic -- I will spend some time with it a bit later today and probably come back with questions...
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Quote:
Regarding audio -- there are many approaches possible here. If processing power were not a factor, I'd probably want a 44.1 kHz stereo audio codec.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Arlet wrote:
I was thinking about a simple I2S chip, like the PCM1744: http://www.ti.com/lit/ds/symlink/pcm1744.pdf It only requires 4 wires to the FPGA, and produces CD quality stereo out. How you would use it in the system is up to you. Possible options include playing samples from RAM/SD card, or use the FPGA to implement a retro sound chip that can be controlled by the 65C02.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Quote:
What about audio input?
I was also thinking about using SDRAM instead of SRAM. Instead of 1MB of SRAM, you can get 32MB of SDRAM, using fewer I/O pins, and less money. And as long as you stay in the same page, a random read only takes 3 cycles @ 133MHz, which is still fast enough to support an 8 MHz CPU without wait states. Since you need to offer a windowed view of the RAM anyway, the window could be aligned with the SDRAM page, so you could do random access anywhere in that window. When moving the window, the SDRAM interface would have enough time to activate the new page. Everything outside the SDRAM window, such as executable code, zeropage, stack, and working memory would be mapped to FPGA internal RAM.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Arlet wrote:
How about PCM1808 or the AK5358, which are specifically made as audio input ADCs (stereo, 24 bit, up to 96 ksps). But it would depend on the I/O availability.
Arlet wrote:
I was also thinking about using SDRAM instead of SRAM. Instead of 1MB of SRAM, you can get 32MB of SDRAM, using fewer I/O pins, and less money. And as long as you stay in the same page, a random read only takes 3 cycles @ 133MHz, which is still fast enough to support an 8 MHz CPU without wait states. Since you need to offer a windowed view of the RAM anyway, the window could be aligned with the SDRAM page, so you could do random access anywhere in that window. When moving the window, the SDRAM interface would have enough time to activate the new page. Everything outside the SDRAM window, such as executable code, zeropage, stack, and working memory would be mapped to FPGA internal RAM.
- VGA clock wants to be 25.175 MHz. VGA memory access can't be delayed, but a FIFO can be used if necessary.
- Would like to run the 65C02/65C816 as fast as possible -- e.g. as close to the limit of 8 MHz as possible.
- SDRAM limit is ~133 MHz.
This doesn't factor in the audio codecs at all either, though since they are low speed devices synchronization won't be an issue if they need their own clock domain.
Did you want to consider making this work both with a 65C02 and a 65C816, or just stick with the 65C02? If the former then it would be worth spending some time to come up with an MMU scheme for the 65C02 that maps onto the 65C816 addressing scheme relatively cleanly. The SDRAM would need to be fast enough to do a random access for the VGA at 25.175 MHz if memory access is to be interleaved with the CPU. At first glance, I don't see any problems there, however.
Would also be nice to have some kind of off-CPU DMA engine available for moving memory around at high speeds. Nice to have for video acceleration, audio, and perhaps even moderately high-speed I/O (e.g. between a microSD card and memory directly rather than going trough the CPU).
In the end, the CPU winds up being like a traffic cop just directing traffic rather than doing any heavy lifting itself.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
jmp(FFFA) wrote:
What sort of clocking arrangement were you thinking of?
- VGA clock wants to be 25.175 MHz. VGA memory access can't be delayed, but a FIFO can be used if necessary.
- Would like to run the 65C02/65C816 as fast as possible -- e.g. as close to the limit of 8 MHz as possible.
- SDRAM limit is ~133 MHz.
Quote:
A system clock frequency of 125.875 MHz would allow you to keep everything in the same clock domain: VGA would be /5, PHI2 would be /16, and the SDRAM can run at the system clock frequency. Otherwise the additional synchronization between clock domains could introduce excessive latency into the system, even though it may allow slightly higher clocking rates.
Quote:
Did you want to consider making this work both with a 65C02 and a 65C816, or just stick with the 65C02?
Quote:
Would also be nice to have some kind of off-CPU DMA engine available for moving memory around at high speeds.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Arlet wrote:
Or 133 MHz, and /16 for 8.3MHz PHI2. Slightly overclocked, but I don't expect problems from what I hear from others, or 128 MHz and /16 for exact 8 MHz PHI2.
Quote:
Mostly 65C02, but try to keep it 65C816 compatible if possible with a minimum of compromises.
Arlet wrote:
Yes, that should be possible and quite helpful. [DMA engine and hardware acceleration in general]
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Quote:
I would love to build two boards, one with a 65C02 and the other with a 65C816.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
I've got SDRAM attached to FPGA and routed. The SDRAM is a MT48LC32M8, but will also fit a MT48LC64M8. It's 8 bit wide, and it has 4 banks of 8MB. The idea is that 2 banks will be available for the CPU, and 2 banks for the video generator. Random CPU accesses to the same page, in a bank not in use by the video generator should be possible without delay. Accesses that conflict with video may result in a few cycles of clock stretching. By flipping two video pages back and forth between CPU and video generator, it should be possible to avoid that.
I took some care to make the trace lengths between FPGA and SDRAM similar (within 2 mm), so as not to generate any unnecessary skew. I'm planning a 4 layer board from Eurocircuits (0.15mm trace/clearance and 0.25mm drill). With the smaller SDRAM pitch, compared to the SRAM, it would result in too much layout compromises to try this on a double sided board. Also, I'm using 0402 bypass caps.
If there's interest, I can reflow the boards, and sell them at cost. I'll also make the Eagle files available if anybody wants make modifications.
I took some care to make the trace lengths between FPGA and SDRAM similar (within 2 mm), so as not to generate any unnecessary skew. I'm planning a 4 layer board from Eurocircuits (0.15mm trace/clearance and 0.25mm drill). With the smaller SDRAM pitch, compared to the SRAM, it would result in too much layout compromises to try this on a double sided board. Also, I'm using 0402 bypass caps.
If there's interest, I can reflow the boards, and sell them at cost. I'll also make the Eagle files available if anybody wants make modifications.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
Arlet wrote:
I've got SDRAM attached to FPGA and routed. The SDRAM is a MT48LC32M8, but will also fit a MT48LC64M8. It's 8 bit wide, and it has 4 banks of 8MB. The idea is that 2 banks will be available for the CPU, and 2 banks for the video generator. Random CPU accesses to the same page, in a bank not in use by the video generator should be possible without delay. Accesses that conflict with video may result in a few cycles of clock stretching. By flipping two video pages back and forth between CPU and video generator, it should be possible to avoid that.
Arlet wrote:
I took some care to make the trace lengths between FPGA and SDRAM similar (within 2 mm), so as not to generate any unnecessary skew. I'm planning a 4 layer board from Eurocircuits (0.15mm trace/clearance and 0.25mm drill). With the smaller SDRAM pitch, compared to the SRAM, it would result in too much layout compromises to try this on a double sided board. Also, I'm using 0402 bypass caps.
Arlet wrote:
If there's interest, I can reflow the boards, and sell them at cost. I'll also make the Eagle files available if anybody wants make modifications.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
I'm definitely going to reflow this for myself, so I'll order the stencil anyway. It's no problem to make a few more.
Yes I've worked with eurocircuits before for dozens of other designs and probably over 1000 boards total.
Yes I've worked with eurocircuits before for dozens of other designs and probably over 1000 boards total.
Re: Enhanced Dynamically Reconfigurable Systems Using CPLDs
The Eagle schematic and board file are available on github. You should be able to view the files with free Eagle, but you won't be able to edit because of its two layer restriction.
https://github.com/Arlet/6502-sandbox
Some stuff is new, some is from V1, or V2. The schematic of the CPU shows which pins I intend to connect to FPGA, so you can already look at that and let me know if you disagree, or spot a mistake.
https://github.com/Arlet/6502-sandbox
Some stuff is new, some is from V1, or V2. The schematic of the CPU shows which pins I intend to connect to FPGA, so you can already look at that and let me know if you disagree, or spot a mistake.