Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic/FOMU/FOMU_blink/makeit.sh: recognize different types of board (FOMU_REV) #44

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions Basic/FOMU/FOMU_blink/makeit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions FemtoRV/BOARDS/fomu-evt2.pcf
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions FemtoRV/BOARDS/fomu-evt3.pcf
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions FemtoRV/BOARDS/fomu-hacker.pcf
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 1 addition & 2 deletions FemtoRV/BOARDS/fomu-pvt.pcf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions FemtoRV/TUTORIALS/FOMU.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Test a simple FOMU design (optional)

```
$ cd learn-fpga/Basic/FOMU/FOMU_blink
$ export FOMU_REV=pvt
$ ./makeit.sh
```

Expand Down