Saffron

How about designing a video game console?

Recommended Posts

Hi all!

 

I'm a video game developer who loves to do crazy electronics projects in my spare time :P

 

I've created some primitive game consoles in the past, using microcontrollers (atmega, parallax sx), interfacing sound chips, doing some video processing, etc. Also I've done some projects with open handled consoles like the GP32 and the GP2X (3D software engines and small games).

 

I'm new to the FPGA world, and since I mostly like to create homemade consoles, I was thinking on creating something similar to the fifth generation (think Playstation, 3DO or Saturn).

 

That would mean designing a GPU with basic 3D support (vector math and such), a sound processor (I would love to implement a SID chip + something to play PCM data for FX) and the CPU would only handle the game logic and gamepads (Would be the ZPU enough for that?).

 

After googling for FPGA kits, Papilio looks like the best choice, but I was wondering if the Papilio DUO would have enough power to do what I want. I was planing to buy the 2MB version with the computing shield, so I can use the SD Card as game loader, the VGA output (I'm not planning to add NTSC/PAL video signal generation, at least for now...) and of course the atari port is great for connecting my megadrive pads :D

 

So, I'm really crazy of it's really doable? what do you think? :lol:

Share this post


Link to post
Share on other sites

Hi,

 

not crazy but maybe not completely in touch with reality :) Anyway, welcome to the show.

 

You can find the source code for a 3D-accelerated GPU somewhere referenced on this site. It's interesting for reading, at least. The problem is, this type of circuit doesn't map very well to FPGA hardware. Doing it from scratch, the work effort seems unreasonable (~manyears. Not something done for fun)

 

Doing a 1980-style video card is no big deal (dozens of hours for an experienced designer), but serious graphics, I doubt that's going to happen. And if it does, it won't leave much room on the device.

 

Audio is a different story, especially if you don't need polyphony, or just a few voices via copy&paste. Many modern high-end synthesizers are FPGA-based.

 

Real FPGA programming is much harder than writing sequential code, but that's what makes it so much fun.

It's relatively easy to create a simple audio output, with the option of upgrading later to an external converter for high-quality audio.

 

My advice is, set yourself some easy targets. If you're new to HDL (Verilog/VHDL), even a very basic VGA signal generator can be quite a challenge. "Challenge" meaning that you easily run into problems that are best debugged with an oscilloscope or logic analyzer.

 

The Papilios are really friendly boards to get started, but the only feature you really need for a couple of weeks (if your intention is to write code yourself, not try to bring other people's code to life) is a single LED.

Share this post


Link to post
Share on other sites

It's worth looking at some of the existing projects that are out there. There is at least one implementation of the NES for which the code has been released and as it sits it's too large to fit in the Spartan6 on the Papilio Pro. Most projects like this tend to be RAM/ROM bound since FPGAs are not really designed to implement a SOC like this and adding external RAM and/or ROM can considerably improve the situation. Trying to create a Playstation generation console is a very *very* ambitious project for an experienced FPGA developer that would likely take years, I don't think it's realistic for a beginner to take on something of that nature. Once you get past the basics and start looking for an ambitious project, I would suggest trying to implement a clone of one of the many 8-bit microcomputers that were common in the late 70s-mid 80s. There are lots to choose from, some of them common and some rather obscure, and softcores for most of the 8 bit CPUs and peripheral chips already exist.

 

Anyway good luck, it would be great to have more people contributing, things have been a bit slow around here lately, not many new creations shared in a while.

Share this post


Link to post
Share on other sites

Based just on how much real-estate is needed for even simple 8 bit processors, my guess is you'd need something bigger than the LX9 in the Papilio to get something close to a PS1 or Saturn, the Pipistrello is an LX45 which is pretty much as big as you can go with the free tools, my guess is that might get you close in terms of needed resources.

 

As others have said it's probably not a good starter project. But certainly something interesting to aim at.

 

I did game development for 25+ years and I'd consider myself a pretty proficient developer, but it's taken me a lot longer to get my head around FPGA programming than I thought it would. Learning Verilog or VHDL is the easy bit, getting my head around what a piece of Verilog or VHDL is turned into took me months. There is a tendency to treat it like software when you start, but you really do have to consider what it is your describing to get a good (or often just working)  implementation.

Share this post


Link to post
Share on other sites

This is a Japanese developer's page. Maybe what you want to make is close to this, isn't it?

SNES on FPGA: 

  http://pgate1.at-ninja.jp/SNES_on_FPGA/ 

 

The contents are written in Japanese, so just skip to the last part with lots of screen shots on that page. 

 

Have a dream and make it!! 

It's just the same as written in that page < SNES on FPGA.  :)

Share this post


Link to post
Share on other sites

Perhaps the thing to do is to start with something like the primitive, micro controller based systems you mentioned, and start extending from there.  Using an FPGA lets you add custom peripheral "chips" to your design.  You can create and include peripherals or accelerators that are suited to your needs or ideas.  Unfortunately, the highest performing stuff doesn't fit on the hobbyist-priced FPGAs, and the fanciest designs can take quite a long time to build and debug.

 

Debugging is what takes a lot of time, at least for me.  If I hadn't honed my debugging skills (and patience) over years as a programmer, I'd have gotten nowhere in Verilog.

 

Polygonhell mentions the space required by 8 bit processors.  It's not necessarily that much.  There's a re-creation of the 6502 (used in many personal computers and consoles of the 8 bit era) which ends up taking about 10% of the slice LUTs on the LX9.  CPU is only part of the matter -- some other devices are also complex, and even simple ones can add up.  For example, my current project has a 6502 with text-mode video [1], serial, and PS/2 interfaces, and comes in around 30% of the slice LUTs.  (I'm hoping I can get it to coexist with the "socz80" system, another 8 bit one, which comes to about 70%.)

 

There's a lot of variation in how much space things take up.  There are a variety of 32 bit processors that will fit on the LX9.  ZPU/ZPUino is one, and there are quite a few others, including some historic ones.  (I was just now reading about the "J2" core, based on the "SH2" architecture, that was one of the processors in the Saturn.)  While some 8 bit architectures are a bit cramped.

 

[1] Arguably the text-mode video is only half in "hardware:"  Vertical timing and addressing are done in software.

Share this post


Link to post
Share on other sites

Thanks to all for the replies, it's been really helpful!

 


You can find the source code for a 3D-accelerated GPU somewhere referenced on this site. It's interesting for reading, at least. The problem is, this type of circuit doesn't map very well to FPGA hardware. Doing it from scratch, the work effort seems unreasonable (~manyears. Not something done for fun)

 

I'll take a look at that, just to get a better picture :)

It's a pity, because my main focus with this project was the GPU part. For the sound part I was going to "just" interface some physical chip (or another board) and the CPU requeriment is "just the simplest one that can do the work". From my lack of knowledge, I imagined that it would be doable to write some vector math logic and a simple rasterizer and framebuffer and get it to work. I must also clarify that I'm not pretending to create a perfect replica or something of the exact complexity of a Playstation console, my goal is to create a basic GPU that can work and output graphics in a similar way to those generation of consoles.

 


As others have said it's probably not a good starter project. But certainly something interesting to aim at.

 

 

Yeah, it's not a project that a newbie is going to start the first day the FPGA arrives home :lol:

My idea is start with the basics, learn how things works, doing a not gate, some led switching, etc... this is obviously a project that I see more of a future target, rather than something I hope to finish in one week.

 

This is a Japanese developer's page. Maybe what you want to make is close to this, isn't it?

SNES on FPGA: 

  http://pgate1.at-ninja.jp/SNES_on_FPGA/ 

 

The contents are written in Japanese, so just skip to the last part with lots of screen shots on that page. 

 

Have a dream and make it!! 

It's just the same as written in that page < SNES on FPGA.   :)

 

The page it's not accesible, I'll try later.

 

Perhaps the thing to do is to start with something like the primitive, micro controller based systems you mentioned, and start extending from there.  Using an FPGA lets you add custom peripheral "chips" to your design.  You can create and include peripherals or accelerators that are suited to your needs or ideas.  Unfortunately, the highest performing stuff doesn't fit on the hobbyist-priced FPGAs, and the fanciest designs can take quite a long time to build and debug.

 

Yes, that's exactly what I want to do, start with the basics, then move onto something similar I've already done with microcontrollers, and keep progressing.

 

For example, it would be nice interfacing some sound chips as I've already done it with microcontrollers:

 

And you're right, in electronics debugging and testing is a nightmare compared to software development :P

Share this post


Link to post
Share on other sites

>> my goal is to create a basic GPU that can work and output graphics in a similar way to those generation of consoles.

 

As a learning experiment, why not. If you can make it work ("if") and write a blog about it, you'll have something serious to put into your CV.

That said, I see a certain pattern of people dreaming up things they could do with an FPGA. Some day they buy one, hit reality, and are never heard of again. You have been warned :)

My advice is, set yourself some easier goals and push them ahead as you reach them.

The fixed point math alone is something few people would touch with a 10-foot pole, without being paid for it.

 

FPGAs are the bleeding edge of technology. There's nothing beyond (well, ASICs are one step ahead if you have a 7-to-9 digit budget), and the FPGA on a Papilio is fundamentally no different from what you put into, say, a cruise missile. But, you'll have to work for it.

Share this post


Link to post
Share on other sites

That's funny, because I was thinking that implementing fixed point math, as it was done in the ancient times, would be really fun (maybe ignorance is bliss? :D).

 

Anyway, after doing some research this board looks good, so I'll probably order it as soon as the 2MB model gets restocked. I think it's a great starting point for FPGA programming.

 

BTW. Is there an European reseller? I would prefer to avoid customs charges.

Share this post


Link to post
Share on other sites

Interfacing to other chips can be a challenge because the number of IO pins on the Papilio is somewhat limited due to the use of TQFP packages on a double sided board and the SDRAM using up a sizable chunk of them. There is also the issue that modern FPGAs have 3.3V IO and many chips that you might want to interface are 5V. The Papilio boards are great learning platforms though and there's a lot you can do with them. I like the Papilio 500k with the Logicstart megawing as it's a very compact development board that has almost everything I need for simple projects. I do wish it also incorporated a PS/2 port though.

 

FPGA development has a very, very steep learning curve and it has taken me around 2 years to go from zero to being able to patch together stuff out of modules other people wrote, debug and write some of my own VHDL. The hardest part if you're already accustomed to programming is to get used to the fact that with VHDL you're not writing a program but describing in code-like words the function of a digital circuit. A solid understanding of TTL logic design, the use of gates, flip-flops, counters, registers, clocks and other concepts is more helpful than coding background. There's a great classic book on this called The TTL Cookbook. It's a bit dated but much of what it covers still applies.

 

It's loads of fun though, once I started making real progress it became easy to get completely drawn in and spend hours coding. Having a FPGA board is a bit like having a breadboard the size of a whole room and a mountain of free logic chips.

Share this post


Link to post
Share on other sites

That's funny, because I was thinking that implementing fixed point math, as it was done in the ancient times, would be really fun (maybe ignorance is bliss? :D).

Anyway, after doing some research this board looks good, so I'll probably order it as soon as the 2MB model gets restocked. I think it's a great starting point for FPGA programming.

BTW. Is there an European reseller? I would prefer to avoid customs charges.

Yeah there is a euro store. It's on stores link on main page. Whereabouts are you from

Share this post


Link to post
Share on other sites

>> because I was thinking that implementing fixed point math, as it was done in the ancient times, would be really fun

 

Same here, and it's still going strong, for example in cell phones.

Just remember to add 1/2 LSB before you chop off the bits behind the decimal point, and you'll be fine :-)

 

PS speaking of which, is this thing really called decimal point when everything is binary...

Share this post


Link to post
Share on other sites

I/O pins are always a problem, I've used multiplexers in the past for that. And level shifters for the 3/5V signals.

 

Having a FPGA board is a bit like having a breadboard the size of a whole room and a mountain of free logic chips.

 

It does sounds fun :)

Share this post


Link to post
Share on other sites

Yeah there is a euro store. It's on stores link on main page. Whereabouts are you from

 

Thanks, I didn't see the link the first time :wacko:

I'm from Spain.

 

I've just ordered the papilio duo from the exp tech store, I'll keep looking at the web tutorials to be ready for when it arrives :rolleyes:

Share this post


Link to post
Share on other sites

You may as well download Xilinx ISE while you wait, it's a massive download. You can also request a free DVD if you don't want to download several gigs, at least in the US they sent me one for free.

Share this post


Link to post
Share on other sites

>> The page it's not accessible, I'll try later.

 

The address is correct but protected from viewing from CGI or .php-linked pages, maybe for security

(to avoid server cracking).

Then, type the address manually, by hand, on your browser.  

    //pgate1.at-ninja.jp/SNES_on_FPGA/

    (Plz attach "http" at the top of the address.)

 

If the page is still unaccessible, I'll reprint the screen shots here. :)

 

I watched the YouTube movies - Episodio 1, 2, and 3, --- burst into laugh

when I saw the title is shown with 8-bit characters!!  :) 

Share this post


Link to post
Share on other sites

Back in the early 90's, I wrote a 3D renderer. I started off doing most everything in FP, but to get speed eventually it was pretty much all fixed point. At the back end, it was doing interpolations over and over, I'd interpolate to get polygon edges, interpolate shading values and planned to use the same scheme to interpolate across textures when I heard about OpenGL and Direct3D coming to the PC, at which point I dropped the project. So if you just built an interpolation unit, as a wishbone device or something, you should get a big boost over software-only. And of course you have all those hard multipliers, so a fixed point vector unit. The source code to Quake is in the public domain, one strategy might be to start software only and modify both software and hardware incrementally.

Share this post


Link to post
Share on other sites

You may as well download Xilinx ISE while you wait, it's a massive download. You can also request a free DVD if you don't want to download several gigs, at least in the US they sent me one for free.

 

Thanks for the advice, I'll download it. It's a big download but these days any steam game is around the same size so... :P

 

>> The page it's not accessible, I'll try later.

 

The address is correct but protected from viewing from CGI or .php-linked pages, maybe for security

(to avoid server cracking).

Then, type the address manually, by hand, on your browser.  

    //pgate1.at-ninja.jp/SNES_on_FPGA/

    (Plz attach "http" at the top of the address.)

 

If the page is still unaccessible, I'll reprint the screen shots here. :)

 

I watched the YouTube movies - Episodio 1, 2, and 3, --- burst into laugh

when I saw the title is shown with 8-bit characters!!   :)

 

I was able to access the page, it looks really cool! I would love to recreate the SPC in a FPGA some day.

 

Back in the early 90's, I wrote a 3D renderer. I started off doing most everything in FP, but to get speed eventually it was pretty much all fixed point. At the back end, it was doing interpolations over and over, I'd interpolate to get polygon edges, interpolate shading values and planned to use the same scheme to interpolate across textures when I heard about OpenGL and Direct3D coming to the PC, at which point I dropped the project. So if you just built an interpolation unit, as a wishbone device or something, you should get a big boost over software-only. And of course you have all those hard multipliers, so a fixed point vector unit. The source code to Quake is in the public domain, one strategy might be to start software only and modify both software and hardware incrementally.

 

Some years ago I programmed a 3D software engine for the GP32 and my intention with this project is similar to what you suggest, start with all the math running in ZPUino (or any soft core that I ended using) and then work on a fixed point unit and the geometric transformation unit which I want it to work in a similar fashion to the famous GTE (http://psx.rules.org/gte.txt), after getting that done I'll move into the GPU part.

 

There's lots of forks of Quake, some of them even uses fixed point, it would be cool to port it to the system. But right now it's only a dream :D

 

Probably I'll end doing a simple raycast engine for starters. The last I one I wrote was like ten years ago... also in the GP32:

gp32_wolfy.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now