trashernet-soc/fpga/build.sh

44 lines
1.4 KiB
Bash
Raw Normal View History

2024-06-12 20:03:04 +02:00
#!/bin/bash
2024-07-06 19:14:39 +02:00
# -------------------------------------------------------------------------- --
# TRASHERNET SoC - A Trashy Ethernet SoC for FPGAs --
# -------------------------------------------------------------------------- --
# TODO
# -------------------------------------------------------------------------- --
# Author : Markus Koch <markus@notsyncing.net>
# Contributors : None
# License : Mozilla Public License (MPL) Version 2
# -------------------------------------------------------------------------- --
if [ "$1" == "flash" ]; then
openFPGALoader --unprotect-flash -f -c ft2232 -b ice40_generic build/bitstream.bin
exit 0
fi
2024-06-12 20:03:04 +02:00
mkdir -p build
cd build
set -e
../run.py --compile
BASEDIR=".."
2024-07-06 19:14:39 +02:00
DEVICE=--up5k # --up5k, --u4k
2024-06-12 20:03:04 +02:00
PACKAGE=sg48
# Collect pre-analyzed VHDL sources
GHDLINCDIRS=`find ./vunit_out/ghdl/libraries -maxdepth 1 -mindepth 1 -type d | sed "s/^/-P/" | tr '\n' ' '`
# Collect Verilog sources
SERV="$BASEDIR/hdl/serv"
VLOGS=`echo ../hdl/serv/rtl/*.v`
VLOGS="$VLOGS $SERV/servant/servant_ram.v $SERV/servant/servant_timer.v"
# Synthesize and PnR
# -device <hx | lp | u>
yosys -m ghdl -p "read_verilog $VLOGS; ghdl --std=08 $GHDLINCDIRS design.top; synth_ice40 -abc9 -device u -top top -json netlist.json"
2024-07-06 19:14:39 +02:00
nextpnr-ice40 $DEVICE --package $PACKAGE --asc netlist.asc --report report.json --detailed-timing-report --json netlist.json --pcf ../constraints.pcf
2024-06-12 20:03:04 +02:00
# Generate bitstream
icepack netlist.asc bitstream.bin