Page 1 of 4

FPGA Genesis with Sound

Posted: Sun Dec 02, 2012 2:44 am
by Shaho
As mentioned in another post, my group is implementing a full Sega Genesis system on an FPGA. This is built off the fpgagen project by Gregory Estrade (Torlus): http://code.google.com/p/fpgagen/. We've ported the project from Altera to Xilinx and added an original YM2612 driver and cartridge/controller interfaces. Here are the preliminary results of our work:

http://www.youtube.com/watch?v=zDLWVD2OwmI

So far I have channels 1-4 plus the DAC output running. The other 2 channels would be easy to add but Xilinx is running out of memory trying to synthesize them. LFO and SSGEG are not implemented yet. As you can tell, there are a good number of bugs in the sound, but the basic channel output calculations are solid. Lots of thanks to Nemesis and the MAME authors for helping to get this off the ground.

Also thanks to everyone's help on this board for getting the sound to the output driver. I'll be releasing additional videos and open sourcing the code once everything's cleaned up if anyone's interested.

UPDATE: Fixed up most of the sound. Still a little bit of buzzing that we need to identify and get rid of. The problem was overflow in calculating the attenuation along with hardware issues. See the video here: http://www.youtube.com/watch?v=x17vwVRRScc
WARNING: I apologize for all the talking in the background (including myself). Our lab is pretty busy right now and there's not a lot of time to shoot the video. I'll get a clean version up when everything is completely done.

UPDATE2: Better video here: http://www.youtube.com/watch?v=zZyLj1gX0_k

UPDATE3: Source available at http://sourceforge.net/projects/teamgenesis/. Not cleaned up/commented in many places, peruse at your own risk.

Posted: Sun Dec 02, 2012 3:05 am
by sega16
Wow this is pretty good now I guess you will just have to optimize memory usage to finish the ym2612 emulation then I am sure that your project will beat firecore's emulation.

Posted: Sun Dec 02, 2012 8:09 pm
by Torlus
Nice to see that my project is useful to someone ;)
Keep up the good work.

Posted: Sun Dec 02, 2012 8:29 pm
by Chilly Willy
Once this design gets far enough along, it would be a great project to make a board using it to take the place of the one in the RetroGen or GenMobile. Have a REAL portable Genesis as opposed to the AtGames junk.

Posted: Mon Dec 03, 2012 12:33 pm
by HardWareMan
Some VDP glitches (possible sprite limitation or priority). But anyway - greate job!

Posted: Mon Dec 03, 2012 3:40 pm
by djcouchycouch
Awesome!

Fpga noob question: what kind of board would be best to run this at home?

Posted: Mon Dec 03, 2012 7:38 pm
by Chilly Willy
Well, for Altera, the best home boards are probably the DE1 or DE2. Not sure for Xilinx.

Posted: Mon Dec 03, 2012 8:08 pm
by Shaho
Thanks guys! Especially Torlus, thank you so much for some clean, easily modifiable code :D. I'm glad you're still checking in here.

As for the board, we're using a Xilinx XUPV5-LX110T through our university. This is definitely overkill, and in fact would have probably been easier through with a DE1 or DE2, since we were forced to use DVI instead of VGA video output. The audio codec would have to be changed from AC97 to the codec on the Altera board, but that's fairly straightforward. I don't recall a cheap Xilinx board that combines DVI/VGA output with audio off the top of my head.

I've cleaned up the FM chip to be able to synthesize all six channels, but I haven't checked the board usage after this change. It was about 50% before with rather inefficient code so it should be better than that.

Posted: Tue Dec 04, 2012 10:25 pm
by Shaho
We added the 3 tone channels of the PSG. Sonic makes jumping noises now! We also cleaned up the YM2612 quite a bit. To my ears, it sounds pretty good, but please let me know if you see/hear anything wrong. New video is here: http://www.youtube.com/watch?v=zZyLj1gX0_k.

I'll also take requests if anyone wants to see/hear any game in particular, since we may not have access to this board after this week. We are still missing the LFO, SSGEG, and CH3/6 independent frequencies in the YM2612, and the white noise generator in the PSG.

Posted: Tue Dec 04, 2012 10:40 pm
by TmEE co.(TM)
The sound has fuzz in it that is not right for sure, but that may just be distortion from being too loud. Not sure.
SoR does not quite sound right either

Posted: Tue Dec 04, 2012 10:48 pm
by Shaho
Thanks! I'll run through an emulator later and compare. One thing is we are outputting at ~53 kHz and sampling at 48 kHz, so there's a little bit of data loss there. Not sure how much that would affect it. We shifted everything to a 16 bit output with 14-bits of precision, where I think the Genesis used 9 bits.

Edit: I see what you mean about Streets of Rage. It's way off, especially the drums and punch effects. Only thing I noticed from the emulator debug was that Channel 3 special mode was being used, so I may have to implement that and see if it makes a difference. Again, thanks so much for pointing that out.

Posted: Thu Dec 06, 2012 11:17 am
by tinctu
This is cool.
Can you make your own FPGA dev board like Arduino or Raspberry Pi but as MD/Genny?
How much will such board cost? Or FPGA chip itselfs?

Posted: Thu Dec 06, 2012 3:38 pm
by slobu
I think if he wanted this to be easily available he'd create a new core for the MiniMig and call it a day.

Posted: Fri Dec 07, 2012 10:49 am
by tinctu
Why MINIMIG? MINIMIG is overpriced...

Posted: Fri Dec 14, 2012 9:51 am
by mikej
Hi,

I designed the fpgaarcade replay board and have been looking at porting this to the board (based on a Spartan3 1600e) . I am happy to help out!

www.fpgaarcade.com

Best,
/Mike