Skip to content

Commit

Permalink
Merge commit '8ed1556594f833dc5cb8e59585fcbe9c43eba308'
Browse files Browse the repository at this point in the history
  • Loading branch information
nand2mario committed May 19, 2024
2 parents 34e4147 + 8ed1556 commit 00f4de3
Show file tree
Hide file tree
Showing 30 changed files with 625 additions and 349 deletions.
64 changes: 51 additions & 13 deletions build.tcl
Original file line number Diff line number Diff line change
@@ -1,11 +1,55 @@
add_file -type verilog "src/EEPROM_24C0x.sv"
add_file -type verilog "src/NESGamepad.v"
if {$argc == 0} {
puts "Usage: $argv0 <device> [<controller>]"
puts " device: nano20k, primer25k"
puts " controller: snes, ds2"
puts "Note: nano20k supports both controllers simultaneously, so build with just: gw_sh build.tcl nano20k"
exit 1
}

set dev [lindex $argv 0]
if {$argc == 2} {
set controller [lindex $argv 1]
} else {
set controller ""
}

# process $dev and $controller
if {$dev eq "nano20k"} {
set_device GW2AR-LV18QN88C8/I7 -device_version C
add_file src/nano20k/config.v
add_file -type cst "src/nano20k/nestang.cst"
add_file -type verilog "src/nano20k/gowin_pll_hdmi.v"
add_file -type verilog "src/nano20k/gowin_pll_nes.v"
# nano20k supports both controllers simultaneously
set_option -output_base_name nestang_${dev}
} elseif {$dev eq "primer25k"} {
set_device GW5A-LV25MG121NC1/I0 -device_version A
if {$controller eq "snes"} {
add_file src/primer25k/config_snescontroller.v
add_file -type cst "src/primer25k/nestang_snescontroller.cst"
} elseif {$controller eq "ds2"} {
add_file src/primer25k/config.v
add_file -type cst "src/primer25k/nestang.cst"
} else {
error "Unknown controller $controller"
}
add_file -type verilog "src/primer25k/gowin_pll_27.v"
add_file -type verilog "src/primer25k/gowin_pll_hdmi.v"
add_file -type verilog "src/primer25k/gowin_pll_nes.v"
set_option -output_base_name nestang_${dev}_${controller}
} else {
error "Unknown device $dev"
}

add_file -type verilog "src/apu.v"
add_file -type verilog "src/autofire.v"
add_file -type verilog "src/cart.sv"
add_file -type verilog "src/compat.v"
add_file -type verilog "src/controller_snes.v"
add_file -type verilog "src/controller_ds2.sv"
add_file -type verilog "src/dpram.v"
add_file -type verilog "src/dualshock_controller.v"
add_file -type verilog "src/EEPROM_24C0x.sv"
add_file -type verilog "src/game_loader.v"
add_file -type verilog "src/hdmi2/audio_clock_regeneration_packet.sv"
add_file -type verilog "src/hdmi2/audio_info_frame.sv"
Expand All @@ -26,18 +70,17 @@ add_file -type verilog "src/iosys/simpleuart.v"
add_file -type verilog "src/iosys/spi_master.v"
add_file -type verilog "src/iosys/spiflash.v"
add_file -type verilog "src/iosys/textdisp.v"
add_file -type verilog "src/mappers/FDS.sv"
add_file -type verilog "src/mappers/generic.sv"
add_file -type verilog "src/mappers/iir_filter.v"
add_file -type verilog "src/mappers/JYCompany.sv"
add_file -type verilog "src/mappers/misc.sv"
add_file -type verilog "src/mappers/MMC1.sv"
add_file -type verilog "src/mappers/MMC2.sv"
add_file -type verilog "src/mappers/MMC3.sv"
add_file -type verilog "src/mappers/MMC5.sv"
add_file -type verilog "src/mappers/Namco.sv"
add_file -type verilog "src/mappers/Sachen.sv"
add_file -type verilog "src/mappers/Sunsoft.sv"
add_file -type verilog "src/mappers/generic.sv"
add_file -type verilog "src/mappers/iir_filter.v"
add_file -type verilog "src/mappers/misc.sv"
add_file -type verilog "src/nes.v"
add_file -type verilog "src/nes2hdmi.sv"
add_file -type verilog "src/nestang_top.sv"
Expand All @@ -51,14 +94,7 @@ add_file -type verilog "src/uart_tx_V2.v"
add_file -type verilog "src/usb_hid_host.v"
add_file -type verilog "src/usb_hid_host_rom.v"

if {$dev eq "nano20k"} {
set_device GW2AR-LV18QN88C8/I7 -device_version C
} elseif {$dev eq "primer25k"} {
set_device GW5A-LV25MG121NC1/I0 -device_version A
}

set_option -synthesis_tool gowinsynthesis
set_option -output_base_name nestang_$dev
set_option -top_module nestang_top
set_option -verilog_std sysv2017
set_option -rw_check_on_ram 1
Expand All @@ -67,6 +103,8 @@ set_option -use_ready_as_gpio 1
set_option -use_done_as_gpio 1
set_option -use_i2c_as_gpio 1
set_option -use_cpu_as_gpio 1
set_option -use_sspi_as_gpio 1

set_option -multi_boot 1

run all
23 changes: 23 additions & 0 deletions buildall.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

@echo off
set GWSH=c:\Gowin\Gowin_V1.9.9_x64\IDE\bin\gw_sh

echo.
echo ============ Building nano20k ===============
echo.
%GWSH% build.tcl nano20k

echo.
echo ============ Building primer25k with snes/nes controller ===============
echo.
%GWSH% build.tcl primer25k snes

echo.
echo ============ Building primer25k with ds2 controller ===============
echo.
%GWSH% build.tcl primer25k ds2

dir impl\pnr\*.fs

echo "All done."

15 changes: 6 additions & 9 deletions nestang_nano20k.gprj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
<Device name="GW2AR-18C" pn="GW2AR-LV18QN88C8/I7">gw2ar18c-000</Device>
<FileList>
<File path="src/EEPROM_24C0x.sv" type="file.verilog" enable="1"/>
<File path="src/NESGamepad.v" type="file.verilog" enable="1"/>
<File path="src/apu.v" type="file.verilog" enable="1"/>
<File path="src/autofire.v" type="file.verilog" enable="1"/>
<File path="src/cart.sv" type="file.verilog" enable="1"/>
<File path="src/compat.v" type="file.verilog" enable="1"/>
<File path="src/controller_ds2.sv" type="file.verilog" enable="1"/>
<File path="src/controller_snes.v" type="file.verilog" enable="1"/>
<File path="src/dpram.v" type="file.verilog" enable="1"/>
<File path="src/dualshock_controller.v" type="file.verilog" enable="1"/>
<File path="src/game_loader.v" type="file.verilog" enable="1"/>
Expand Down Expand Up @@ -45,6 +46,9 @@
<File path="src/mappers/generic.sv" type="file.verilog" enable="1"/>
<File path="src/mappers/iir_filter.v" type="file.verilog" enable="1"/>
<File path="src/mappers/misc.sv" type="file.verilog" enable="1"/>
<File path="src/nano20k/config.v" type="file.verilog" enable="1"/>
<File path="src/nano20k/gowin_pll_hdmi.v" type="file.verilog" enable="1"/>
<File path="src/nano20k/gowin_pll_nes.v" type="file.verilog" enable="1"/>
<File path="src/nes.v" type="file.verilog" enable="1"/>
<File path="src/nes2hdmi.sv" type="file.verilog" enable="1"/>
<File path="src/nestang_top.sv" type="file.verilog" enable="1"/>
Expand All @@ -54,17 +58,10 @@
<File path="src/t65/T65_ALU.v" type="file.verilog" enable="1"/>
<File path="src/t65/T65_MCode.v" type="file.verilog" enable="1"/>
<File path="src/t65/T65_Pack.v" type="file.verilog" enable="1"/>
<File path="src/tang_nano_20k/config.sv" type="file.verilog" enable="1"/>
<File path="src/tang_nano_20k/gowin_pll_hdmi.v" type="file.verilog" enable="1"/>
<File path="src/tang_nano_20k/gowin_pll_nes.v" type="file.verilog" enable="1"/>
<File path="src/uart_tx_V2.v" type="file.verilog" enable="1"/>
<File path="src/usb_hid_host.v" type="file.verilog" enable="1"/>
<File path="src/usb_hid_host_rom.v" type="file.verilog" enable="1"/>
<File path="src/tang_nano_20k/nestang.cst" type="file.cst" enable="1"/>
<File path="src/tang_primer_25k/nestang.cst" type="file.cst" enable="0"/>
<File path="src/tang_nano_20k/nestang.sdc" type="file.sdc" enable="1"/>
<File path="src/tang_primer_25k/nestang.sdc" type="file.sdc" enable="0"/>
<File path="src/clock.gao" type="file.gao" enable="0"/>
<File path="src/nano20k/nestang.sdc" type="file.sdc" enable="1"/>
<File path="src/nes.gao" type="file.gao" enable="0"/>
</FileList>
</Project>
3 changes: 2 additions & 1 deletion nestang_primer25k.gprj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
<Device name="GW5A-25A" pn="GW5A-LV25MG121NC1/I0">gw5a25a-002</Device>
<FileList>
<File path="src/EEPROM_24C0x.sv" type="file.verilog" enable="1"/>
<File path="src/NESGamepad.v" type="file.verilog" enable="1"/>
<File path="src/apu.v" type="file.verilog" enable="1"/>
<File path="src/autofire.v" type="file.verilog" enable="1"/>
<File path="src/cart.sv" type="file.verilog" enable="1"/>
<File path="src/compat.v" type="file.verilog" enable="1"/>
<File path="src/controller_ds2.sv" type="file.verilog" enable="1"/>
<File path="src/controller_snes.v" type="file.verilog" enable="1"/>
<File path="src/dpram.v" type="file.verilog" enable="1"/>
<File path="src/dualshock_controller.v" type="file.verilog" enable="1"/>
<File path="src/game_loader.v" type="file.verilog" enable="1"/>
Expand Down
177 changes: 0 additions & 177 deletions src/NESGamepad.v

This file was deleted.

Loading

0 comments on commit 00f4de3

Please sign in to comment.