Monday, January 4, 2010

USB

I'm sure many of you have seen the new SNES PowerPak. After it was released, I sort of lost interest in some of the stuff I wanted to work on (SDRAM interface, menu system, etc) since none of it was really "new" anymore. Plus my job has been pretty intellectually fulfilling, so I hadn't spent much time on side projects.

Well, we had a week off for Christmas so I finally got bored enough to sit down and work on some things. I finished bringing up the USB port on my prototype, so I can load the FPGA core over usb. It enumerates as a HID device (no drivers, woooo!), and I use a little custom app to transfer the core file. For this FPGA, the cores end up being roughly 277kb max, and take about 4 seconds or so to fully transfer (64kbyte/sec, max speed for HID).


you can see the usb cable sticking out of the side of the prototype:


I also looked into some soft-cpu options to try and understand if it would be feasible to emulate the DSP chip in software on the cart. My main concerns were:
- Ability to fit on the inexpensive 250k gate spartan 3e (turns out the biggest issue is probably the amount of on-chip BRAM)
- Availability of a reasonable C toolchain (avoiding asm if possible.. the project is hard enough as it is)

Since we only have about 27kbyte of BRAM to work with, some of which the soft-cpu will have to dedicate for processing, I was concerned about how much code gets produced from a small C app with the given toolchain.

I played around with the Zylin ZPU. Which has a gcc toolchain, and if you use the larger implementation of the processor, the binaries are very small, merely 54 bytes (demo code) for looping to wait on a register, and then setting another register.

I think that it should be pretty feasible to emulate the DSP with this method. As for the other special chips... I'm not sure. For things like DMA engines, surely it will need a hardware implementation. I am assuming that there are enough hardware parts that it might make sense to just do everything in hardware.

I wish I knew a good book on doing custom CPUs with VHDL/Verilog. I can probably make it up as I go along, but it would be nice to have some background from a knowledgeable source.

10 comments:

  1. Hey, sorry to bug you on an unrelated blog, but is anything going on with iift/iigt or are submissions closed? Seems like nothing's updated there for over a year, wanted to submit something, but not sure anyone's listening...

    ReplyDelete
  2. It's great to see you posting after a long while of absence

    I had a much longer post but blogger ignored it.

    Basically they never update and don't do much, they only have dsp if you pay an extra 11 for it, the thing comes out to around $160 without postage, yours should be able to do so much more and I will support you a majorly important thing is region coding, the powerpak can only emulate games for your region. Pal games only work on pal machines, ntsc on ntsc, if you can patch that, you'll already have exceeded what they can do. The snes mini (ntsc-J model 2) doesn't work with theirs either, so keep on working on it. You can do it.

    ReplyDelete
  3. Scott,
    Just found your blog today, read every last word! Fantasic!

    I'm a student at Northern Illinois University working on my masters of EE, and I'd love a reason to dive into FPGA's. This is a GREAT project, I was wondering if I could follow in your foot steps, do you have any design notes that could be passed along to get me started? Please e-mail me stevebarnaby@msn.com if you are willing to lend a hand. I know that there is SNES powerpack but I'd rather do it myself to gain the knowledge. Hope to hear from you soon!
    Thanks,
    Steve

    ReplyDelete
  4. Scotty G! Keep up the good work

    ReplyDelete
  5. Keep up the good work I am waiting for a more reasonably priced alternative to the powerpak :D

    ReplyDelete
  6. What's up?
    I'm in the process of uploading / open-sourcing the firmware & user side code for a new USB Game Boy cartridge.
    Hope to hear progress has been made on your end!
    Regards,
    Bleep Bloop

    ReplyDelete
  7. Don't get discouraged. Do something that none of the other flash carts can do. :)

    ReplyDelete
  8. pleasant to read. Hope you'll post more in the future.

    ReplyDelete
  9. i really have good memories with SNES, i always play some SNES roms. check this if you want back to your childhood best-roms.com

    ReplyDelete