Friday, 24 May 2013

This experiment is to gain some experience on using the ddr2 ram on the Spartan 3a Starter Kit (Rev.C) with a soft core 8-bit microprocessor, thus vhdl sources from the original links have been ported. The only enhancement is that games can be loaded from the sd card attached to the board through a simple spi vhdl module.
The games are loaded into the ddr2 ram from a fat16 sd card. The ddr2 ram acts as a 32K cartridge rom after the selected game has been loaded and then write protected. This is required for some games to work properly.
The Spartan XC3S700a does not have enough block ram or distributed ram to accommodate the 8K bios, 16K video ram and 32K cartridge rom on chip even if the bios is in the flash rom.
I have modified Mr.Uwe Becker's ddr2 core from Opencores to provide simple access to 32K of external ram. Only 1 byte is used out of every 8-byte burst. The dcm frequency for the ddr2 has to be increased to 150Mhz from the original 130Mhz for the emulation to work.  It is not easy to verify if any modifications will impede the auto refresh and crossing clock domain, timings etc. I'm sure there's a better way of managing the top level to take advantage of the burst feature. I've been looking for a working ddr2 controller simple enough for a novice to modify for the longest time and I'm glad it works as described by the author. Use sdram for quicker results.

How to use :
  • Build/buy a sd card adaptor. Reference the spi pins used on J2  from the ucf file
  • Unzip the contents of the sd_card.rar to your sd card
  • You may modify the menu.txt file. The menu.txt file is used to index the selected file. The spaces and position of  the ';' delimiter is important. File description before the ';' file name after
  • PS2 keys: Arrow keys, Z-button1 X-button 2,  Q is '*' and W is  '#', 0-9-numeric keypad
  • Use the rotary knob centre button for hard reset or use the ESC key for soft reset to the main menu screen.( Works in most games)           

* This project has not been tested extensively. Not tested on other revisions of the starter board. Please feel free to improve as you see fit.
Credits to the original authors for providing the sources.
* If you see any 3D effects, or white smoke rising from the board or the emulation hang in the middle of an exciting game, it is definitely my fault.
* Original links :,, 
Some pictures:


Compiled using ISE WebPack 14.5

SD card contents :sd_card.rar 
Video link: video