FPGA Genesis with Sound

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Shaho
Interested
Posts: 10
Joined: Mon Nov 26, 2012 2:07 pm

FPGA Genesis with Sound

Post by Shaho » Sun Dec 02, 2012 2:44 am

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.
Last edited by Shaho on Thu Dec 05, 2013 10:13 pm, edited 4 times in total.

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Sun Dec 02, 2012 3:05 am

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.

Torlus
Interested
Posts: 10
Joined: Mon Jan 11, 2010 9:16 am
Location: Toulouse, France
Contact:

Post by Torlus » Sun Dec 02, 2012 8:09 pm

Nice to see that my project is useful to someone ;)
Keep up the good work.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Dec 02, 2012 8:29 pm

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.

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Mon Dec 03, 2012 12:33 pm

Some VDP glitches (possible sprite limitation or priority). But anyway - greate job!

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Mon Dec 03, 2012 3:40 pm

Awesome!

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

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Dec 03, 2012 7:38 pm

Well, for Altera, the best home boards are probably the DE1 or DE2. Not sure for Xilinx.

Shaho
Interested
Posts: 10
Joined: Mon Nov 26, 2012 2:07 pm

Post by Shaho » Mon Dec 03, 2012 8:08 pm

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.

Shaho
Interested
Posts: 10
Joined: Mon Nov 26, 2012 2:07 pm

Post by Shaho » Tue Dec 04, 2012 10:25 pm

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.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Tue Dec 04, 2012 10:40 pm

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
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Shaho
Interested
Posts: 10
Joined: Mon Nov 26, 2012 2:07 pm

Post by Shaho » Tue Dec 04, 2012 10:48 pm

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.

tinctu
Very interested
Posts: 97
Joined: Tue Oct 30, 2007 8:28 pm

Post by tinctu » Thu Dec 06, 2012 11:17 am

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?

slobu
Very interested
Posts: 85
Joined: Tue Apr 03, 2012 6:02 pm

Post by slobu » Thu Dec 06, 2012 3:38 pm

I think if he wanted this to be easily available he'd create a new core for the MiniMig and call it a day.

tinctu
Very interested
Posts: 97
Joined: Tue Oct 30, 2007 8:28 pm

Post by tinctu » Fri Dec 07, 2012 10:49 am

Why MINIMIG? MINIMIG is overpriced...

mikej
Newbie
Posts: 4
Joined: Fri Dec 14, 2012 9:48 am

Post by mikej » Fri Dec 14, 2012 9:51 am

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

Post Reply