diff --git a/Basic/FOMU/FOMU_blink/makeit.sh b/Basic/FOMU/FOMU_blink/makeit.sh index a53d2e83..67e805b4 100755 --- a/Basic/FOMU/FOMU_blink/makeit.sh +++ b/Basic/FOMU/FOMU_blink/makeit.sh @@ -2,8 +2,45 @@ set -o nounset set -o errexit -yosys -DPVT -p 'synth_ice40 -top top -json blink.json' blink.v -nextpnr-ice40 --up5k --package uwg30 --pcf fomu-pvt.pcf --json blink.json --asc blink.asc +# Based on https://github.com/im-tomu/fomu-workshop/blob/master/hdl/board.mk +PCF_PATH="../../../FemtoRV/BOARDS" +test -v FOMU_REV || { echo 'error Unrecognized FOMU_REV value. must be "evt1", "evt2", "evt3", "pvt", or "hacker"'; exit 1; } +case "$FOMU_REV" in + evt1) + YOSYSFLAGS="-D EVT=1 -D EVT1=1 -D HAVE_PMOD=1" + PNRFLAGS="--up5k --package sg48" + PCF="$PCF_PATH/fomu-evt2.pcf" + ;; + evt2) + YOSYSFLAGS="-D EVT=1 -D EVT2=1 -D HAVE_PMOD=1" + PNRFLAGS="--up5k --package sg48" + PCF="$PCF_PATH/fomu-evt2.pcf" + ;; + evt3) + YOSYSFLAGS="-D EVT=1 -D EVT3=1 -D HAVE_PMOD=1" + PNRFLAGS="--up5k --package sg48" + PCF="$PCF_PATH/fomu-evt3.pcf" + ;; + hacker) + YOSYSFLAGS="-D HACKER=1" + PNRFLAGS="--up5k --package uwg30" + PCF="$PCF_PATH/fomu-hacker.pcf" + ;; + pvt) + YOSYSFLAGS="-D PVT=1" + PNRFLAGS="--up5k --package uwg30" + PCF="$PCF_PATH/fomu-pvt.pcf" + ;; + *) + echo 'error Unrecognized FOMU_REV value. must be "evt1", "evt2", "evt3", "pvt", or "hacker"' + exit 1 + ;; +esac + +# shellcheck disable=SC2086 # Double quote to prevent globbing and word splitting. +yosys $YOSYSFLAGS -p 'synth_ice40 -top top -json blink.json' blink.v +# shellcheck disable=SC2086 # Double quote to prevent globbing and word splitting. +nextpnr-ice40 $PNRFLAGS --pcf "$PCF" --json blink.json --asc blink.asc icepack blink.asc blink.bit cp blink.bit blink.dfu dfu-suffix -v 1209 -p 70b1 -a blink.dfu diff --git a/FemtoRV/BOARDS/fomu-evt2.pcf b/FemtoRV/BOARDS/fomu-evt2.pcf new file mode 100644 index 00000000..2c7ca0ac --- /dev/null +++ b/FemtoRV/BOARDS/fomu-evt2.pcf @@ -0,0 +1,37 @@ +set_io rgb0 39 +set_io rgb1 40 +set_io rgb2 41 +set_io pmoda_1 25 +set_io pmoda_2 26 +set_io pmoda_3 27 +set_io pmoda_4 28 +set_io pmod_1 25 +set_io pmod_2 26 +set_io pmod_3 27 +set_io pmod_4 28 +set_io clki_alt 20 +set_io clki 44 +set_io user_1 48 +set_io user_2 47 +set_io user_3 46 +set_io user_4 45 +set_io user_5 42 +set_io user_6 38 +set_io spi_mosi 14 +set_io spi_miso 17 +set_io spi_clk 15 +set_io spi_io2 18 +set_io spi_io3 19 +set_io spi_cs 16 +set_io uart_tx 21 +set_io uart_rx 13 +set_io usb_dn 37 +set_io usb_dp 34 +set_io usb_dp_pu 35 +set_io usb_dn_pu 36 +set_io dbg_1 20 +set_io dbg_2 12 +set_io dbg_3 11 +set_io dbg_4 23 +set_io dbg_5 10 +set_io dbg_6 9 diff --git a/FemtoRV/BOARDS/fomu-evt3.pcf b/FemtoRV/BOARDS/fomu-evt3.pcf new file mode 100644 index 00000000..a1b2986f --- /dev/null +++ b/FemtoRV/BOARDS/fomu-evt3.pcf @@ -0,0 +1,41 @@ +set_io rgb0 39 +set_io rgb1 40 +set_io rgb2 41 +set_io pmod_1 28 +set_io pmod_2 27 +set_io pmod_3 26 +set_io pmod_4 23 +set_io pmoda_1 28 +set_io pmoda_2 27 +set_io pmoda_3 26 +set_io pmoda_4 23 +set_io clki_alt 20 +set_io clki 44 +set_io user_1 48 +set_io user_2 47 +set_io user_3 46 +set_io user_4 45 +set_io user_5 42 +set_io user_6 38 +set_io pmodb_1 48 +set_io pmodb_2 47 +set_io pmodb_3 46 +set_io pmodb_4 45 +set_io spi_mosi 14 +set_io spi_miso 17 +set_io spi_clk 15 +set_io spi_io2 18 +set_io spi_io3 19 +set_io spi_cs 16 +set_io uart_tx 21 +set_io uart_rx 13 +set_io usb_dn 37 +set_io usb_dp 34 +set_io usb_dp_pu 35 +set_io usb_dn_pu 36 +set_io dbg_1 20 +set_io dbg_2 12 +set_io dbg_3 11 +set_io dbg_4 25 +set_io dbg_5 10 +set_io dbg_6 9 diff --git a/FemtoRV/BOARDS/fomu-hacker.pcf b/FemtoRV/BOARDS/fomu-hacker.pcf new file mode 100644 index 00000000..e2582d06 --- /dev/null +++ b/FemtoRV/BOARDS/fomu-hacker.pcf @@ -0,0 +1,16 @@ +# Configuration for the Fomu hacker board. +set_io rgb0 A5 # Blue LED +set_io rgb1 B5 # Green LED +set_io rgb2 C5 # Red LED +set_io clki F5 # Clock input from 48MHz Oscillator +set_io spi_mosi F1 # SPI Master Out, Slave In Pin +set_io spi_miso E1 # SPI Master In, Slave Out Pin +set_io spi_clk D1 # SPI Master Clock Output Pin +set_io spi_cs C1 # SPI Chip Select +set_io user_1 F4 # User touch pad 1 +set_io user_2 E5 # User touch pad 2 +set_io user_3 E4 # User touch pad 3 +set_io user_4 F2 # User touch pad 4 +set_io usb_dn A2 # USB D- pad +set_io usb_dp A4 # USB D+ pad +set_io usb_dp_pu D5 # USB D+ pull up (indicates device connected) diff --git a/FemtoRV/BOARDS/fomu-pvt.pcf b/FemtoRV/BOARDS/fomu-pvt.pcf index 718f4552..68da2bbc 100644 --- a/FemtoRV/BOARDS/fomu-pvt.pcf +++ b/FemtoRV/BOARDS/fomu-pvt.pcf @@ -9,7 +9,7 @@ set_io pmoda_1 E4 set_io pmoda_2 D5 set_io pmoda_3 E5 set_io pmoda_4 F5 -set_io pclk F4 +set_io clki F4 set_io user_1 E4 set_io user_2 D5 set_io user_3 E5 @@ -27,4 +27,3 @@ set_io spi_cs C1 set_io usb_dn A2 set_io usb_dp A1 set_io usb_dp_pu A4 -set_io RESET E4 diff --git a/FemtoRV/TUTORIALS/FOMU.md b/FemtoRV/TUTORIALS/FOMU.md index 473c8bf7..2691b973 100644 --- a/FemtoRV/TUTORIALS/FOMU.md +++ b/FemtoRV/TUTORIALS/FOMU.md @@ -13,6 +13,7 @@ Test a simple FOMU design (optional) ``` $ cd learn-fpga/Basic/FOMU/FOMU_blink +$ export FOMU_REV=pvt $ ./makeit.sh ```