GithubHelp home page GithubHelp logo

ironsteel / nes_ecp5 Goto Github PK

View Code? Open in Web Editor NEW
35.0 35.0 15.0 336 KB

NES FPGA implementation synthesized for the ulx3s ecp5 based fpga board

Makefile 0.40% Verilog 24.98% Python 2.12% SystemVerilog 56.50% VHDL 16.00%

nes_ecp5's Introduction

FPGA NES on the ulx3s board using prj trellis, nextpnr and yosys

Intro

This is a port of the MIST NES core to the ulx3s board using only open source tools for synthesys and place and route.

At the moment it has working DVI out (640x480@60Hz), games can be loaded from the onboard SPI flash from offset 0x200000 or from the sdcard using the esp32 OSD functionality and audio out from the 3.5mm jack

Three options are available for joystick input:

  1. The ulx3s onboard buttons
  2. An external NES gamepad
  3. This usb gamepad connected to us2 via usb-otg adapter

Getting started

  1. Make sure you have ghdl and ghdl-yosys-plugin installed in addition to nextpnr and yosys.
  2. Type
make prog_flash

to synth and PnR the design and flash it to the ulx3s

  1. Follow emard's esp32 setup guide
  2. Upload the esp32/nes.py file from this repo to the esp32's flash root dir
  3. Change the esp32 main.py file to match something like this
import network
from machine import SDCard
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect("YourWifiAP", "YourPassowrd")
os.mount(SDCard(slot=3),"/sd")
import uftpd
import nes

  1. Add some nes ROM's to your sdcard
  2. Hook up your ulx3s to a monitor and press all the direction buttons on the board at the same time to bring up the file browser on the screen
  3. Choose your ROM and load it by pressing the right button on the board.
  4. If everything's right, the game should start

Customization

By default the project is built with sdcard support for loading the roms via the esp32 and joystick support using the onboard buttons and the usb gamepad connected to us2 connector.

You can also load the games from the onboard flash memory by changing the value of the parameters in the top.v file like this:

  parameter C_flash_loader=1, // fujprog -j flash -f 0x200000 100in1.img
  parameter C_esp32_loader=0 // usage: import nes # for OSD press together A B SELECT START or all 4 directions

and recompiling the bitstream and reflashing it to the board.

And then upload your game:

  1. Find and download your favorite game rom file
  2. Type
fujprog -j FLASH -f 0x200000 [path_to_your_game].nes

If everything went well the game should start.

If you have an original NES joypad you can use it by changing

parameter use_external_nes_joypad=1

in the top.v file and connecting it to the J1 header as follows:

J1 HEADER TOP ROW, LEFT TO RIGHT
[3.3V] [GND] [joy_data] [joy_clock] [joy_strobe]

Changing the target ecp5 device

The target ecp5 device by default is a 12K one.

If you have a ulx3s board with a bigger ecp5 FPGA, you can override it using

FPGA_SIZE=45 make prog

or changing the FPGA_SIZE variable in the Makefile.

Unsupported mappers

mapper16, mapper69, mapper83, VRC7, MapperFDS and MapperNSF.

These mappers are not supported because their source code is using system verilog features that yosys doesn't support right now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.